Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryFailedError: there is no unique or exclusion constraint matching the ON CONFLICT #20

Open
sahil30123 opened this issue May 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sahil30123
Copy link

I'm currently trying to get updates of new members added to the group using group-participants.update , but in the meanwhile I'm receiving this error (on debug: true):

query: INSERT INTO "chat"("id", "messages", "newJid", "oldJid", "lastMsgTimestamp", "unreadCount", "readOnly", "endOfHistoryTransfer", "ephemera
lExpiration", "ephemeralSettingTimestamp", "endOfHistoryTransferType", "conversationTimestamp", "name", "pHash", "notSpam", "archived", "disappe
aringMode", "unreadMentionCount", "markedAsUnread", "participant", "tcToken", "tcTokenTimestamp", "contactPrimaryIdentityKey", "pinned", "muteEn
dTime", "wallpaper", "mediaVisibility", "tcTokenSenderTimestamp", "suspended", "terminated", "createdAt", "createdBy", "description", "support",
 "isParentGroup", "isDefaultSubgroup", "parentGroupId", "displayName", "pnJid", "selfMasked", "mute", "pin", "archive", "dBAuthId") VALUES ($1, 
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $2, $3, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, D
EFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, D
EFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $4) ON CONFLICT ( "id", "dBAuthId" ) DO UPDATE SET "id" = EXCLUD
ED."id", "dBAuthId" = EXCLUDED."dBAuthId", "conversationTimestamp" = EXCLUDED."conversationTimestamp", "name" = EXCLUDED."name"  RETURNING "DBId" -- PARAMETERS: ["[email protected]","1683136266","Jid",1]
query failed: INSERT INTO "chat"("id", "messages", "newJid", "oldJid", "lastMsgTimestamp", "unreadCount", "readOnly", "endOfHistoryTransfer", "e
phemeralExpiration", "ephemeralSettingTimestamp", "endOfHistoryTransferType", "conversationTimestamp", "name", "pHash", "notSpam", "archived", "
disappearingMode", "unreadMentionCount", "markedAsUnread", "participant", "tcToken", "tcTokenTimestamp", "contactPrimaryIdentityKey", "pinned", 
"muteEndTime", "wallpaper", "mediaVisibility", "tcTokenSenderTimestamp", "suspended", "terminated", "createdAt", "createdBy", "description", "su
pport", "isParentGroup", "isDefaultSubgroup", "parentGroupId", "displayName", "pnJid", "selfMasked", "mute", "pin", "archive", "dBAuthId") VALUE
S ($1, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $2, $3, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEF
AULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEF
AULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $4) ON CONFLICT ( "id", "dBAuthId" ) DO UPDATE SET "id" =
 EXCLUDED."id", "dBAuthId" = EXCLUDED."dBAuthId", "conversationTimestamp" = EXCLUDED."conversationTimestamp", "name" = EXCLUDED."name"  RETURNING "DBId" -- PARAMETERS: ["[email protected]","1683136266","Jid",1]
error: error: there is no unique or exclusion constraint matching the ON CONFLICT specification
    at Parser.parseErrorMessage (C:\Users\hey\IdeaProjects\proj\node_modules\pg-protocol\dist\parser.js:287:98)
    at Parser.handlePacket (C:\Users\hey\IdeaProjects\proj\node_modules\pg-protocol\dist\parser.js:126:29)
    at Parser.parse (C:\Users\hey\IdeaProjects\proj\node_modules\pg-protocol\dist\parser.js:39:38)
    at TLSSocket.<anonymous> (C:\Users\hey\IdeaProjects\proj\node_modules\pg-protocol\dist\index.js:11:42)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  length: 148,
  severity: 'ERROR',
  code: '42P10',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'plancat.c',
  line: '861',
  routine: 'infer_arbiter_indexes'
}
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
QueryFailedError: there is no unique or exclusion constraint matching the ON CONFLICT specification
    at PostgresQueryRunner.query (C:\Users\hey\IdeaProjects\proj\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:211:19)      
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async InsertQueryBuilder.execute (C:\Users\hey\IdeaProjects\proj\node_modules\typeorm\query-builder\InsertQueryBuilder.js:106:33)

I'm experiencing this only on group-participants.update's "add" events but not on "remove" or other events like message.upsert.

NOTE: I'm using WhiskeySockets by using yarn add @adiwajshing/baileys@github:WhiskeySockets/Baileys , compiles it using tsc, and thereby replaces with baileys-bottle/node_modules/@adiwajshing/baileys/. I'm using Postgres as my database type.

@sahil30123 sahil30123 added the bug Something isn't working label May 3, 2023
@deadlinecode
Copy link
Owner

Will take a look
I will also need to update the package to use whiskey isntead of baileys

@owuraku
Copy link

owuraku commented May 10, 2024

Will take a look I will also need to update the package to use whiskey isntead of baileys

What ever happened to this bug ?

@sahil30123 did you find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants