Created
February 20, 2020 05:00
-
-
Save ivan/9e7ccc83e1dc55a8dae904e5b11ac910 to your computer and use it in GitHub Desktop.
pg_tmp_lets_me_truncate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
uri=$(pg_tmp) | |
psql --no-psqlrc "$uri" -c "SELECT SESSION_USER, CURRENT_USER;" | |
psql --no-psqlrc "$uri" -c "CREATE TABLE dirs (id bigserial PRIMARY KEY);" | |
psql --no-psqlrc "$uri" -c "REVOKE TRUNCATE ON dirs FROM current_user;" | |
psql --no-psqlrc "$uri" -c "TRUNCATE dirs;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment