postgresql/src/backend
Tom Lane 71db302ecf Prevent multicolumn expansion of "foo.*" in an UPDATE source expression.
Because we use transformTargetList() for UPDATE as well as SELECT
tlists, the code accidentally tried to expand a "*" reference into
several columns.  This is nonsensical, because the UPDATE syntax
provides exactly one target column to put the value into.  The
immediate result was that transformUpdateTargetList() got confused
and reported "UPDATE target count mismatch --- internal error".
It seems better to treat such a reference as a plain whole-row
variable, as it would be in other contexts.  (This could produce
useful results when the target column is of composite type.)

Fix by tweaking transformTargetList() to perform *-expansion only
conditionally, depending on its exprKind parameter.

Back-patch to 9.3.  The problem exists further back, but a fix would be
much more invasive before that, because transformTargetList() wasn't
told what kind of list it was working on.  Doesn't seem worth the
trouble given the lack of field reports.  (I only noticed it because
I was checking the code while trying to improve the documentation about
how we handle "foo.*".)

Discussion: <4308.1479595330@sss.pgh.pa.us>
2016-11-20 14:26:19 -05:00
..
access Fix possible pg_basebackup failure on standby with "include WAL". 2016-10-27 12:00:05 -04:00
bootstrap Protect against multixact members wraparound 2015-04-28 11:32:53 -03:00
catalog Fix another bug in merging of inherited CHECK constraints. 2016-10-13 17:05:15 -04:00
commands Fix EXPLAIN so that it doesn't emit invalid XML in corner cases. 2016-10-20 17:18:09 -04:00
executor Be sure to rewind the tuplestore read pointer in non-leader CTEScan nodes. 2016-09-22 11:34:44 -04:00
foreign Arrange to cache FdwRoutine structs in foreign tables' relcache entries. 2013-03-06 23:48:09 -05:00
lib Misc comment typo fixes. 2014-12-16 16:39:33 +02:00
libpq Include <sys/select.h> where needed 2016-09-27 01:05:21 -03:00
main Make fallback implementation of pg_memory_barrier() work in 9.2 and 9.3. 2016-04-16 10:42:07 -04:00
nodes Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:37:51 -04:00
optimizer Fix improper repetition of previous results from a hashed aggregate. 2016-08-24 14:37:51 -04:00
parser Prevent multicolumn expansion of "foo.*" in an UPDATE source expression. 2016-11-20 14:26:19 -05:00
po Translation updates 2016-10-24 10:55:55 -04:00
port Improve TranslateSocketError() to handle more Windows error codes. 2016-04-21 16:59:08 -04:00
postmaster If the stats collector dies during Hot Standby, restart it. 2016-10-27 14:56:42 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:11:52 -05:00
replication Fix typos 2016-02-29 18:11:58 -03:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:53 -05:00
snowball Fix ancient encoding error in hungarian.stop. 2014-06-10 22:48:39 -04:00
storage Fix WAL-logging of FSM and VM truncation. 2016-10-19 15:00:34 +03:00
tcop Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
tsearch Fix misestimation of n_distinct for a nearly-unique column with many nulls. 2016-08-07 18:52:02 -04:00
utils Fix nasty performance problem in tsquery_rewrite(). 2016-10-30 17:35:43 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk xlogreader.c: Fix report_invalid_record translatability flag 2015-01-09 12:34:24 -03:00