Closed heftig closed 1 year ago
Context: I stumbled on this because the bridge logs an error for each configured channel when starting:
ERROR:PublicitySyncer Failed to sync publicity for #foobar: syntax error at or near "$1"
N.B. Commit contains sign off.
Merged via #1698, thanks!
Arrays passed as query parameters become PostgreSQL arrays. However,
foo IN $1
is not valid syntax, asIN
can only be used with subqueries (foo IN (SELECT ...)
) and lists (foo IN ($1, $2)
), which require parentheses.foo IN ($1)
is interpreted as a list and the expression is compared with the whole array, not checked against its members.The correct syntax for checking if a value matches any member of an array parameter is
foo = ANY($1)
, described in https://www.postgresql.org/docs/15/functions-comparisons.html#id-1.5.8.30.16.Fix
getIrcChannelsForRoomIds
andgetRoomsVisibility
. While we're at it, replacegetMappingsForChannelByOrigin
's workable but awkward building of a parameter list.