Error: syntax error at or near ")"
Closed this issue · 0 comments
AntonLocal commented
Hi, when I upgraded dependencies in my project from loopback-connector-postgresql": "5.2.0" to version "5.2.1" - got this error for some of the requests:
loopback:connector:postgresql error: syntax error at or near ")"
at TLSSocket.<anonymous> (…/node_modules/pg-protocol/dist/index.js:11:42)
at TLSSocket.emit (events.js:400:28)
at TLSSocket.emit (domain.js:470:12)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at TLSSocket.Readable.push (internal/streams/readable.js:204:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23) {
length: 91,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '221',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1149',
routine: 'scanner_yyerror'
}
After enabling debug output (DEBUG=loopback:connector:postgresql), I can see unexpected AND(()) in the request and additional parentheses after WHERE clause:
loopback:connector:postgresql SQL: SELECT "id","name" FROM "public"."lang" WHERE (("id" IN ($1,$2,$3)) AND (())) ORDER BY "id"
loopback:connector:postgresql Parameters: ["eng","fra","spa"] +2ms
loopback:connector:postgresql error: syntax error at or near ")"
The only changes from 5.2.0 -> 5.2.1 which could possibly affect this behaviour:
Could you please check what happened and why there are so many parentheses in the query. Thank you.
Additional information
Node 14.17.5
LB3
loopback-connector-postgresql 5.2.1