Open dacosta23 opened 3 years ago
for code
supercopy( { sourceDir: path.join(dir, ".."), headerColumnNamePkPrefix: '.', topDownTableOrder: ['users', 'contacts'], client: client, schemaName: 'public', debug: true, }, function (err) { console.log(err, 'done!') client.end(); } )
the following error is seen:
ScriptRunner fail! ------------------ Failed : "COPY public.contacts(id,created_at,updated_at,email_address,first_name,last_name,user_id) FROM '/Users/ola/code/ent-supercopy/data/inserts/contacts.csv' CSV HEADER ;" Diagnostic: "insert or update on table "contacts" violates foreign key constraint "contacts_user_id_fkey"" ROLLBACK SUCCESSFUL. error: insert or update on table "contacts" violates foreign key constraint "contacts_user_id_fkey" at Parser.parseErrorMessage (/...path/node_modules/pg-protocol/src/parser.ts:369:69) at Parser.handlePacket (/...path/node_modules/pg-protocol/src/parser.ts:188:21) at Parser.parse (/...path/node_modules/pg-protocol/src/parser.ts:103:30) at Socket.<anonymous> (/...path/node_modules/pg-protocol/src/index.ts:7:48) at Socket.emit (node:events:369:20) at Socket.emit (node:domain:470:12) at addChunk (node:internal/streams/readable:313:12) at readableAddChunk (node:internal/streams/readable:288:9) at Socket.Readable.push (node:internal/streams/readable:227:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { length: 289, severity: 'ERROR', code: '23503', detail: 'Key (user_id)=(1c7efb7b-d454-4028-9862-4a4359412db9) is not present in table "users".', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'contacts', column: undefined, dataType: undefined, constraint: 'contacts_user_id_fkey', file: 'ri_triggers.c', line: '3266', routine: 'ri_ReportViolation' } ```
+1 #418
for code
the following error is seen: