How to provide values of complex types to parameterized statements?
See original GitHub issueFor instance, how can I use node-postgres
to execute the parameterized statement SELECT $1::circle[]
with the value ARRAY[ '<(0, 0), 1>'::circle ]
assigned to $1
?
None of the following work:
client.query('SELECT $1::circle[]', [ [{ x: 0, y: 0, radius: 1 }] ])
client.query('SELECT $1::circle[]', ['{ <(0, 0),1> }'])
client.query('SELECT $1::circle[]', [`'{ <(0,0),1>'::circle }`])
client.query('SELECT $1::circle[]', [`ARRAY[ '<(0,0),1>'::circle ]`])
All fail with error: invalid input syntax for type circle: "<(0"
or similar.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Query Parameterization - OWASP Cheat Sheet Series
Dynamic SQL can be parameterized using bind variables, to ensure the dynamically constructed SQL is secure. Here are some examples of using bind...
Read more >Parameterized Queries | SQL Tutorial Documentation on data ...
Declare statements start with the keyword DECLARE , followed by the name of the parameter (starting with a question mark) followed by the...
Read more >Using parameterized queries - Amazon Athena
Use parameterized queries in Athena to re-run the same query with different values and avoid SQL injection attacks.
Read more >Create a parameter query (Power Query) - Microsoft Support
Use a parameter to change a data source · Select Home > Manage Parameters > New Parameter. · Enter the following information in...
Read more >Parameterized SQL Queries | Historian 7.2 Documentation
Parameterized SQL queries allow you to place parameters in an SQL query instead of a constant value. A parameter takes a value only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be clear, this should work too:
Holy shit, thank you so much! Seriously, I’ve spent hours on this, and you’ve solved it in a single sentence. Thank you.