We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anyone can help finding the issue? Getting syntax error on this query:
exports.updateMatches = async ({ payload: { matches } }) => { const formattedMatches = objArrToArr(matches); const cols = Object.keys(matches[0]); const colsWOId = cols .filter((item) => item !== "id") .map((item) => camelToSnake(item)); return await sql` update matches set ${colsWOId.map((col) => `${sql(col)} = excluded.${sql(col)}`).join(", ")} from (values ${sql(formattedMatches)}) as excluded(${cols.join(", ")}) where matches.id = (excluded.id):: int returning *;`; };
tried to follow the sql format from official documentation:
const users = [ [1, 'John', 34], [2, 'Jane', 27], ] await sql` update users set name = update_data.name, age = (update_data.age)::int from (values ${sql(users)}) as update_data (id, name, age) where users.id = (update_data.id)::int returning users.id, users.name, users.age `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Anyone can help finding the issue? Getting syntax error on this query:
tried to follow the sql format from official documentation:
The text was updated successfully, but these errors were encountered: