👋 Is it possible to provide more information in the error output?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Hi 👋
I'm struggling to debug this query (even after reading the documentation... several times). I know it's highly likely I'm doing something wrong, but I'm wondering if it's possible to add any additional information to the error that is being thrown to help track down the issue? Like outputting the final SQL query with some formatting to highlight which part is failing?
const selectKeys = ['name', ...];
const department = 'food';
const category = undefined;
const field = 'price';
const direction = 'asc';
const productsQuery = sql`
select ${sql(selectKeys)}
from products
where department = ${department}
${category ? sql`and ${category} = any(categories)` : sql``}
${sql`order by ${sql(field)} ${direction}`}
limit ${limit}`;
// PostgresError: syntax error at or near "$2"
Side note: I really like the API of the library, I think you did a great job keeping it as close to writing standard sql while also being super powerful.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by reproducing the shown tagged-template query and inspecting how the current PostgresError is surfaced. Done should mean a decided, tested way to provide useful failing-query context without obscuring the query parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- api, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100