postgresql/src/backend
Tom Lane 8a70d8ae75 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
2017-01-14 13:27:47 -05:00
..
access Fix ALTER TABLE / SET TYPE for irregular inheritance 2017-01-09 19:26:58 -03:00
bootstrap Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
catalog Log the creation of an init fork unconditionally. 2016-12-08 14:13:55 -05:00
commands Fix ALTER TABLE / SET TYPE for irregular inheritance 2017-01-09 19:26:58 -03:00
executor Throw suitable error for COPY TO STDOUT/FROM STDIN in a SQL function. 2017-01-14 13:27:47 -05:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Revert "Permit dump/reload of not-too-large >1GB tuples" 2016-12-06 12:46:03 -03:00
libpq Include <sys/select.h> where needed 2016-09-27 01:05:21 -03:00
main Repair a bit of pgindent damage. 2016-06-09 18:09:17 -04:00
nodes Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:38:13 -04:00
optimizer Fix cardinality estimates for parallel joins. 2017-01-13 13:36:09 -05:00
parser Fix CREATE TABLE ... LIKE ... WITH OIDS. 2016-12-22 16:23:34 -05:00
po Translation updates 2016-10-24 11:15:25 -04:00
port Try to find out the actual hugepage size when making a MAP_HUGETLB request. 2016-10-13 15:06:57 -04:00
postmaster If the stats collector dies during Hot Standby, restart it. 2016-10-27 14:54:35 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:12:16 -05:00
replication Fix base backup rate limiting in presence of slow i/o 2016-12-19 10:15:52 +01:00
rewrite pgindent run for 9.6 2016-06-09 18:02:36 -04:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Fix possible leak of semaphore count. 2017-01-05 14:33:29 -05:00
tcop Use TSConfigRelationId in AlterTSConfiguration() 2016-12-22 17:08:47 -05:00
tsearch Improve documentation around TS_execute(). 2016-12-16 11:50:18 -05:00
utils Invalidate cached plans on FDW option changes. 2017-01-06 14:12:52 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Provide and use a makefile target to build all generated headers. 2016-07-01 15:09:02 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00