Sample Header Ad - 728x90

Why doesn't the $1 syntax work for all queries?

0 votes
1 answer
952 views
I tried to do this: COPY postgres_log FROM $1 WITH csv; And with a separately sent file path, like I make all normal queries (SELECT/UPDATE/INSERT/DELETE). However, it gives: ERROR: syntax error at or near "$1" Um... So does that mean that I'm forced to send it a scary string like this? COPY postgres_log FROM '/full/path/to/logfileblablabla.csv' WITH csv; If so, why? Why don't all query types support the parameterized queries interface? Isn't this like *asking* to enable SQL query injection vulnerabilities?
Asked by user215888
Sep 19, 2020, 10:58 PM
Last activity: Apr 23, 2025, 12:02 PM