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");


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,
        });


This error is thrown:
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
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
drizzle-bug-prepared-pg. Contribute to greidinger-reis/drizzle-prepared-stmt-null-bug-node-pg development by creating an account on GitHub.
Was this page helpful?