Skip to content

Fix foreign key inconsistencies in QuestDB #2892

Open
@joanagmaia

Description

@joanagmaia

There are multiple foreign key inconsistencies in QuestDB, where entities reference IDs that do not exist in the corresponding PostgreSQL tables. Specifically:

  • activity.organizationId references a non-existent conversation in PostgreSQL.
  • activity.memberId references a non-existent conversation in PostgreSQL.
  • activity.conversationId references a non-existent conversation in PostgreSQL.
  • objectMemberId has similar inconsistencies.
{"name":"script","pid":1087,"component":"database.connection","level":"ERROR","err":{"message":"insert or update on table \"activities\" violates foreign key constraint \"activities_organizationId_fkey\"","name":"error","stack":"error: insert or update on table \"activities\" violates foreign key constraint \"activities_organizationId_fkey\"\n    at Parser.parseErrorMessage (/usr/crowd/app/crowd.dev/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)\n    at Parser.handlePacket (/usr/crowd/app/crowd.dev/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)\n    at Parser.parse (/usr/crowd/app/crowd.dev/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)\n    at TLSSocket.[anonymous] (/usr/crowd/app/crowd.dev/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)\n    at TLSSocket.emit (node:events:518:28)\n    at TLSSocket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:561:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n    at Readable.push (node:internal/streams/readable:392:5)\n    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)","code":"23503"},"msg":"{\n  query: {{update \"activities\" set \"type\"='authored-commit',\"isContribution\"=true,\"score\"=null,\"sourceId\"='d18c7bd95c3d1adf5de385acc8c0bdb64b1a8d68',\"sourceParentId\"=null,\"memberId\"='bebf4b16-bbcc-49ca-b7fc-47ee380a7d92',\"username\"='[email protected]',\"objectMemberId\"=null,\"objectMemberUsername\"=null,\"sentiment\"=null,\"attributes\"='{\"insertions\":3,\"timezone\":\"UTC-05:00\",\"deletions\":1,\"lines\":2,\"isMerge\":false,\"isMainBranch\":true}',\"body\"='btrfs: handle btrfs_record_root_in_trans failure in relocate_tree_block\\n}} +\n    '\\n' +\n    'btrfs_record_root_in_trans will return errors in the future, so handle\\n' +\n    'the error properly in relocate_tree_block.\\n' +\n    '\\n' +\n    'Reviewed-by: Qu Wenruo [[email protected]]\\n' +\n    'Signed-off-by: Josef Bacik [[email protected]]\\n' +\n    'Reviewed-by: David Sterba [[email protected]]\\n' +\n    {{Signed-off-by: David Sterba [[email protected]]',\"title\"=null,\"channel\"='https://github.com/dentproject/linux',\"url\"='https://github.com/dentproject/linux',\"updatedAt\"='2024-12-23 22:12:39.466000',\"organizationId\"='aa38db70-ae59-11ef-9bf6-872d3aab5bae',\"platform\"='git' where id = 'd1648587-c779-4841-8021-c1abf603d6d0'}},\n  params: undefined\n} Error executing a PostgreSQL query!","time":"2025-03-05T10:45:22.966Z","v":0}

Metadata

Metadata

Assignees

Labels

BugCreated by Linear-GitHub Sync

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions