skipperjs / skipper-postgresql

Skipper Adapter for PostgreSQL and Sails.js
6 stars 2 forks source link

Upload fails when table does not exist #3

Open Enteee opened 8 years ago

Enteee commented 8 years ago

When I try to upload a file and the target table does not exist, I get the following error (from postgres & sails)

postgres_1  | ERROR:  relation "upload-certificates" does not exist at character 13
postgres_1  | STATEMENT:  insert into "upload-certificates" ("data", "dirname", "fd") values ($1, $2, $3) returning "fd", "dirname"
sails_1     | error: Sending 500 ("Server Error") response: 
sails_1     |  error: insert into "upload-certificates" ("data", "dirname", "fd") values ($1, $2, $3) returning "fd", "dirname" - relation "upload-certificates" does not exist
sails_1     |     at Connection.parseE (/web/node_modules/pg/lib/connection.js:539:11)
sails_1     |     at Connection.parseMessage (/web/node_modules/pg/lib/connection.js:366:17)
sails_1     |     at Socket.<anonymous> (/web/node_modules/pg/lib/connection.js:105:22)
sails_1     |     at emitOne (events.js:90:13)
sails_1     |     at Socket.emit (events.js:182:7)
sails_1     |     at readableAddChunk (_stream_readable.js:153:18)
sails_1     |     at Socket.Readable.push (_stream_readable.js:111:10)
sails_1     |     at TCP.onread (net.js:534:20) { [error: insert into "upload-certificates" ("data", "dirname", "fd") values ($1, $2, $3) returning "fd", "dirname" - relation "upload-certificates" does not exist]
sails_1     |   name: 'error',
sails_1     |   length: 111,
sails_1     |   severity: 'ERROR',
sails_1     |   code: '42P01',
sails_1     |   detail: undefined,
sails_1     |   hint: undefined,
sails_1     |   position: '13',
sails_1     |   internalPosition: undefined,
sails_1     |   internalQuery: undefined,
sails_1     |   where: undefined,
sails_1     |   schema: undefined,
sails_1     |   table: undefined,
sails_1     |   column: undefined,
sails_1     |   dataType: undefined,
sails_1     |   constraint: undefined,
sails_1     |   file: 'parse_relation.c',
sails_1     |   line: '1159',
sails_1     |   routine: 'parserOpenTable' }
sails_1     | Unhandled rejection error: insert into "upload-certificates" ("data", "dirname", "fd") values ($1, $2, $3) returning "fd", "dirname" - relation "upload-certificates" does not exist
sails_1     |     at Connection.parseE (/web/node_modules/pg/lib/connection.js:539:11)
sails_1     |     at Connection.parseMessage (/web/node_modules/pg/lib/connection.js:366:17)
sails_1     |     at Socket.<anonymous> (/web/node_modules/pg/lib/connection.js:105:22)
sails_1     |     at emitOne (events.js:90:13)
sails_1     |     at Socket.emit (events.js:182:7)
sails_1     |     at readableAddChunk (_stream_readable.js:153:18)
sails_1     |     at Socket.Readable.push (_stream_readable.js:111:10)
sails_1     |     at TCP.onread (net.js:534:20)

After that the table exists and all successive uploads seem to work. The very first upload is lost forever.