Creating this issue as a reminder.
While attempting to do a manual setup using ElephantSQL I was trying to issue the npm run db:reset and getting a driver error.
Error during schema drop:
QueryFailedError: must be owner of view pg_stat_statements
This was problematic trying to drop and refresh an instance I already had created a few months ago.
In addition, ElephantSQL appears to cap you off with only one concurrent connection at a time. Which meant I was getting partial database schema creation and then have no way to drop it.
Only workaround was paying the $5/mth instance and deleting and re-creating instances then running the command one at a time:
➜ chapter git:(test/user) npm run db:reset
> chapter@0.0.1 db:reset
> npm run db:drop && npm run db:sync && npm run db:seed
> chapter@0.0.1 db:drop
> npm run typeorm schema:drop
> chapter@0.0.1 typeorm
> cd server && node_modules/.bin/typeorm "schema:drop"
query: SELECT * FROM current_schema()
query: START TRANSACTION
query: SHOW SERVER_VERSION
query: SELECT 'DROP VIEW IF EXISTS "' || schemaname || '"."' || viewname || '" CASCADE;' as "query" FROM "pg_views" WHERE "schemaname" IN (current_schema()) AND "viewname" NOT IN ('geography_columns', 'geometry_columns', 'raster_columns', 'raster_overviews')
query: DROP VIEW IF EXISTS "public"."pg_stat_statements" CASCADE;
query: ROLLBACK
Error during schema drop:
QueryFailedError: must be owner of view pg_stat_statements
at QueryFailedError.TypeORMError [as constructor] (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/typeorm/error/TypeORMError.js:9:28)
at new QueryFailedError (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/typeorm/error/QueryFailedError.js:13:28)
at PostgresQueryRunner.<anonymous> (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:277:31)
at step (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/tslib/tslib.js:143:27)
at Object.throw (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/tslib/tslib.js:124:57)
at rejected (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/tslib/tslib.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
query: 'DROP VIEW IF EXISTS "public"."pg_stat_statements" CASCADE;',
parameters: undefined,
driverError: error: must be owner of view pg_stat_statements
at Parser.parseErrorMessage (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/Users/paulgamble/Coding/fcc/chapter/server/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
length: 100,
severity: 'ERROR',
code: '42501',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'aclchk.c',
line: '3622',
routine: 'aclcheck_error'
},
length: 100,
severity: 'ERROR',
code: '42501',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'aclchk.c',
line: '3622',
routine: 'aclcheck_error'
}
Describe the bug:
Creating this issue as a reminder.
While attempting to do a manual setup using ElephantSQL I was trying to issue the
npm run db:resetand getting a driver error.This was problematic trying to drop and refresh an instance I already had created a few months ago.
In addition, ElephantSQL appears to cap you off with only one concurrent connection at a time. Which meant I was getting partial database schema creation and then have no way to drop it.
Only workaround was paying the $5/mth instance and deleting and re-creating instances then running the command one at a time:
npm run db:syncnpm run db:seedTell us about your browser and operating system:
Error output