Is insert/update to a boolean supported for truthy strings?
rytido opened this issue · comments
rytido commented
Based on the postgres docs and the parse function I could find, I would expect this to result in a true. Am I missing something?
sql.begin(async (sql) => {
await sql`create temp table t(boolcol boolean)`;
const x = { boolcol: "t" };
await sql`insert into t ${sql(x)}`;
await sql`update t set ${sql(x)}`;
console.log(await sql`select boolcol from t`);
});
Result(1) [ { boolcol: false } ]
Rasmus Porsager commented
The parse function is what is used when values is retrieved from the db, so you should look at the serialize function for what is sent serialize: x => x === true ? 't' : 'f'
Line 25 in cc688c6