You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems userIntId in the query is always treated as text.
Another example is this query, which will cause the postgres error operator does not exist: integer = text:
consttestQuery=db.select().from(sql`(select 1 as "user_int_id", ${1} as "cmp")`).where(eq(sql`"user_int_id"`,sql`"cmp"`));console.log(pgDialect.sqlToQuery(testQuery.getSQL()));console.log(awaittestQuery.execute());
In my actual query, it fails because I need to compare the int value to another one and postgres complains about operator does not exist: integer = text
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an issue regarding placeholders used in sql templates.
The issue can be reduced down to the following example query:
The result of this query is
even though it should be
It seems
userIntId
in the query is always treated astext
.Another example is this query, which will cause the postgres error
operator does not exist: integer = text
:In my actual query, it fails because I need to compare the int value to another one and postgres complains about
operator does not exist: integer = text
Beta Was this translation helpful? Give feedback.
All reactions