From: | Jens-Wolfhard Schicke-Uffmann <drahflow(at)gmx(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Parameter binding for COPY TO queries |
Date: | 2025-02-14 14:39:00 |
Message-ID: | Z69VhFs7K840MMH8@adhil |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I'd like some input on the idea of adding parameter binding support to
queries executed as part of a COPY TO command. Is there a technical
or philosophical reason why these queries should not contain bindable
parameters?
As far as I could ascertain, the feature has been desired for a long
time (but only occasionally), see e.g.:
* https://www.postgresql.org/message-id/flat/12415.1550157763%40sss.pgh.pa.us#682d53c41bda2d21b7cd4fba5000793c
* https://postgrespro.com/list/thread-id/1893680
* https://stackoverflow.com/questions/69233792/how-to-pass-a-param-for-a-binding-in-postgresql-copy-to-stdout-format
* https://stackoverflow.com/questions/44190514/pdo-postgresql-copy/44190617#44190617
* https://github.com/npgsql/npgsql/issues/1677
* https://github.com/jackc/pgx/issues/2247#issuecomment-2645836118
Currently, the protocol forces users of COPY TO to use SQL quoting,
resulting in multiple client libraries not supporting parameters in COPY TO,
resulting in various users doing unsafe interpolations (I come here from
one such occasion).
I might have some time to attempt an implementation, but would first like
to know if there are reservations against it.
Thanks,
Drahflow
From | Date | Subject | |
---|---|---|---|
Next Message | Julien Rouhaud | 2025-02-14 14:39:45 | Re: pg_stat_statements and "IN" conditions |
Previous Message | Dmitry Dolgov | 2025-02-14 14:20:24 | Re: pg_stat_statements and "IN" conditions |