BUG: Prepared statements with placeholder values .execute() not working on postgres

I'm trying to execute a prepared statement with placeholder() values
export const articlePreparedQueryNodePg = dbNodePg
.select()
.from(article)
.where(
sql`(${placeholder("author")} IS NULL OR ${
article.authorName
} = ${placeholder("author")})`
)
.limit(placeholder("limit"))
.offset(placeholder("offset"))
.prepare("article_prepared");
export const articlePreparedQueryNodePg = dbNodePg
.select()
.from(article)
.where(
sql`(${placeholder("author")} IS NULL OR ${
article.authorName
} = ${placeholder("author")})`
)
.limit(placeholder("limit"))
.offset(placeholder("offset"))
.prepare("article_prepared");
but when I do execute it
const articlesWithAuthor = await articlePreparedQueryNodePg.execute({
author: "John Doe",
limit: 10,
offset: 0,
});

//or
const allArticles = await articlePreparedQueryNodePg.execute({
author: null,
limit: 10,
offset: 0,
});
const articlesWithAuthor = await articlePreparedQueryNodePg.execute({
author: "John Doe",
limit: 10,
offset: 0,
});

//or
const allArticles = await articlePreparedQueryNodePg.execute({
author: null,
limit: 10,
offset: 0,
});
This error is thrown:
error: 'could not determine data type of
parameter $1'
error: 'could not determine data type of
parameter $1'
Is anyone having this issue in other db dialects? I opened an issue: https://github.com/drizzle-team/drizzle-orm/issues/709 Minimal repo to reproduce this: https://github.com/greidinger-reis/drizzle-prepared-stmt-null-bug-node-pg
GitHub
[BUG]: Prepared statement with placeholder error: could not determi...
What version of drizzle-orm are you using? 0.26.5 What version of drizzle-kit are you using? 0.18.1 Describe the Bug Description: The problem arises when attempting to use execute prepared() querie...
GitHub
GitHub - greidinger-reis/drizzle-prepared-stmt-null-bug-node-pg: dr...
drizzle-bug-prepared-pg. Contribute to greidinger-reis/drizzle-prepared-stmt-null-bug-node-pg development by creating an account on GitHub.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server