Case sensitive sql query #1493
Answered
by
imm
arashi-dev
asked this question in
Q&A
Case sensitive sql query
#1493
-
This is my code: db
.insert(schema.post)
.values(
posts.map(({title, publishedAt}) => ({
title,
publishedAt,
})))
.onConflictDoUpdate({
target: schema.post.title,
set: {
title: sql`EXCLUDED.title`,
publishedAt: sql`EXCLUDED.publishedAt`,
},
}); in the result query, the // same problem. they become publishedat
sql`EXCLUDED.${post.publishedAt.name}`
sql.raw("EXCLUDED.publishedAt") // Throws: syntax error at or near "$10"
sql`EXCLUDED.${post.publishedAt}` Is there any solution for that? other than changing the column names? |
Beta Was this translation helpful? Give feedback.
Answered by
imm
Nov 11, 2023
Replies: 1 comment 1 reply
-
Hi, Have you tried this? sql`EXCLUDED."publishedAt"` Without quotes, all identifiers are not case sensitive in SQL, as far as I know (at least in postgres). |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
arashi-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Have you tried this?
Without quotes, all identifiers are not case sensitive in SQL, as far as I know (at least in postgres).