rvkulikov / pg-deps-management

Perfectionism through suffering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Temporary view _role_table_grants not dropping after function call

rvkulikov opened this issue · comments

Have to wrap function body in transaction;

I have made this modification, that seems to work in my case: I have modified your script so that it has temporary tables instead of temporary views, and adding the "ON COMMIT DROP" statement on their creation. Then, I surround my alteration scripts with commits. In this way, it seems to work, albeit being slightly slower than using temporary views.

@oscarfanchin Any chance you could share code? My SQL foo is not strong. I can't get past a ERROR: relation "_role_table_grants" already exists error. Wrapping things in transactions doesn't seem to change that outcome.

Unrelated, I love Postgres, but views make me want to take a warm bath with a razor blade. We have to use them for Hasura, and in theory their are a great idea. In practice having to manually drop and recreate an ENTIRE view chain just so I can update a timestamp from timestamp to timestamptz is an infuriating experience. We use Prisma for schema migrations, but they don't yet support views. Even if they did, it would puke out thousands of lines of DDL to drop/create the views every migration...

(╯°□°)╯︵ ┻━┻

facing the same error as @AThilenius here -- help would be appreciated!