Error when using expression in sql query | vercel postgres
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
await sql`
CREATE TABLE events (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
context UUID DEFAULT ${mainId},
start_date TIMESTAMP NOT NULL,
end_date TIMESTAMP NOT NULL
);
`; gives the following error:
NeonDbError: bind message supplies 1 parameters, but prepared statement "" requires 0When printing out the template string and running it manually, it looks correct and I don't get an error. If I hardcode an id instead of
${mainId} I also don't get an error.Anyone have a suggestion?