motis-project / prima

2 stars 4 forks source link

Setting Availability does not work #44

Closed felixguendling closed 4 months ago

felixguendling commented 4 months ago
error: duplicate key value violates unique constraint "availability_pkey"
    at /home/felix/code/prima/node_modules/pg/lib/client.js:526:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PostgresConnection.executeQuery (file:///home/felix/code/prima/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js:69:28)
    at async file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:35:28
    at async #run (file:///home/felix/code/prima/node_modules/kysely/dist/esm/driver/single-connection-provider.js:24:16)
    at async DefaultQueryExecutor.executeQuery (file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:16)
    at async InsertQueryBuilder.execute (file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js:768:24)
    at async Promise.all (index 0)
    at async eval (/home/felix/code/prima/src/routes/api/availability/+server.ts:109:3)
    at async file:///home/felix/code/prima/node_modules/kysely/dist/esm/kysely.js:412:32
    at PostgresConnection.executeQuery (file:///home/felix/code/prima/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js:89:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:35:28
    at async #run (file:///home/felix/code/prima/node_modules/kysely/dist/esm/driver/single-connection-provider.js:24:16)
    at async DefaultQueryExecutor.executeQuery (file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:16)
    at async InsertQueryBuilder.execute (file:///home/felix/code/prima/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js:768:24)
    at async Promise.all (index 0)
    at async eval (/home/felix/code/prima/src/routes/api/availability/+server.ts:109:3)
    at async file:///home/felix/code/prima/node_modules/kysely/dist/esm/kysely.js:412:32
    at async DefaultConnectionProvider.provideConnection (file:///home/felix/code/prima/node_modules/kysely/dist/esm/driver/default-connection-provider.js:10:20) {
  length: 201,
  severity: 'ERROR',
  code: '23505',
  detail: 'Key (id)=(2) already exists.',
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: 'public',
  table: 'availability',
  column: undefined,
  dataType: undefined,
  constraint: 'availability_pkey',
  file: 'nbtinsert.c',
  line: '666',
  routine: '_bt_check_unique'
nilspenzel commented 4 months ago

Ich hatte grade ein ähnliches Problem mit company, mein Verdacht ist, dass das Problem Auftritt weil in test_data/default konkrete ids angegeben sind und damit evtl der Auto_Increment-Counter nicht passt. Ich werde das morgen früh testen.

nilspenzel commented 4 months ago

error: duplicate key value violates unique constraint "company_pkey" at /home/nils/code/prima/prima_nils/node_modules/pg/lib/client.js:526:17 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async PostgresConnection.executeQuery (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js:69:28) at async file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:35:28 at async DefaultConnectionProvider.provideConnection (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/driver/default-connection-provider.js:10:20) at async DefaultQueryExecutor.executeQuery (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:16) at async InsertQueryBuilder.execute (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js:768:24) at PostgresConnection.executeQuery (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js:89:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:35:28 at async DefaultConnectionProvider.provideConnection (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/driver/default-connection-provider.js:10:20) at async DefaultQueryExecutor.executeQuery (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-executor/query-executor-base.js:34:16) at async InsertQueryBuilder.execute (file:///home/nils/code/prima/prima_nils/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js:768:24) { length: 186, severity: 'ERROR', code: '23505', detail: 'Key (id)=(1) already exists.', hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: 'public', table: 'company', column: undefined, dataType: undefined, constraint: 'company_pkey', file: 'nbtinsert.c', line: '666', routine: '_bt_check_unique' }

felixguendling commented 4 months ago

good catch!!