From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Throw suitable error for COPY TO STDOUT/FROM STDIN in a SQL func |
Date: | 2017-01-14 18:28:12 |
Message-ID: | E1cST3k-0004fT-1V@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Throw suitable error for COPY TO STDOUT/FROM STDIN in a SQL function.
A client copy can't work inside a function because the FE/BE wire protocol
doesn't support nesting of a COPY operation within query results. (Maybe
it could, but the protocol spec doesn't suggest that clients should support
this, and libpq for one certainly doesn't.)
In most PLs, this prohibition is enforced by spi.c, but SQL functions don't
use SPI. A comparison of _SPI_execute_plan() and init_execution_state()
shows that rejecting client COPY is the only discrepancy in what they
allow, so there's no other similar bugs.
This is an astonishingly ancient oversight, so back-patch to all supported
branches.
Report: https://postgr.es/m/BY2PR05MB2309EABA3DEFA0143F50F0D593780@BY2PR05MB2309.namprd05.prod.outlook.com
Branch
------
REL9_6_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/8a70d8ae7501141d283e56b31e10c66697c986d5
Modified Files
--------------
src/backend/executor/functions.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-01-14 21:02:54 | pgsql: Change representation of statement lists, and add statement loca |
Previous Message | Magnus Hagander | 2017-01-14 16:18:22 | pgsql: Change default values for backup and replication parameters |