1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-03 22:24:49 +03:00
Tom Lane 9a785ad573 Fix creation of resjunk tlist entries for inherited mixed UPDATE/DELETE.
rewriteTargetListUD's processing is dependent on the relkind of the query's
target table.  That was fine at the time it was made to act that way, even
for queries on inheritance trees, because all tables in an inheritance tree
would necessarily be plain tables.  However, the 9.5 feature addition
allowing some members of an inheritance tree to be foreign tables broke the
assumption that rewriteTargetListUD's output tlist could be applied to all
child tables with nothing more than column-number mapping.  This led to
visible failures if foreign child tables had row-level triggers, and would
also break in cases where child tables belonged to FDWs that used methods
other than CTID for row identification.

To fix, delay running rewriteTargetListUD until after the planner has
expanded inheritance, so that it is applied separately to the (already
mapped) tlist for each child table.  We can conveniently call it from
preprocess_targetlist.  Refactor associated code slightly to avoid the
need to heap_open the target relation multiple times during
preprocess_targetlist.  (The APIs remain a bit ugly, particularly around
the point of which steps scribble on parse->targetList and which don't.
But avoiding such scribbling would require a change in FDW callback APIs,
which is more pain than it's worth.)

Also fix ExecModifyTable to ensure that "tupleid" is reset to NULL when
we transition from rows providing a CTID to rows that don't.  (That's
really an independent bug, but it manifests in much the same cases.)

Add a regression test checking one manifestation of this problem, which
was that row-level triggers on a foreign child table did not work right.

Back-patch to 9.5 where the problem was introduced.

Etsuro Fujita, reviewed by Ildus Kurbangaliev and Ashutosh Bapat

Discussion: https://postgr.es/m/20170514150525.0346ba72@postgrespro.ru
2017-11-27 17:54:07 -05:00
..
2017-11-24 13:59:25 +00:00
2017-10-20 19:26:10 -04:00
2017-10-20 19:26:10 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-10-17 15:10:33 -04:00
2017-10-20 19:26:10 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-10-09 07:47:44 -04:00
2017-11-23 09:44:28 -05:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00
2017-11-08 11:37:28 -05:00
2017-08-15 14:37:44 -04:00
2017-04-12 15:41:41 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-10-17 15:10:33 -04:00
2017-11-23 09:44:28 -05:00
2017-11-23 09:44:28 -05:00

<!-- doc/src/sgml/README.links -->

Linking within SGML documents can be confusing, so here is a summary:


Intra-document Linking
----------------------

<xref>
	use to get chapter/section number from the title of the target
	link, or xreflabel if defined at the target, or refentrytitle if target
        is a refentry;  has no close tag
	http://www.oasis-open.org/docbook/documentation/reference/html/xref.html

<link>
	use to supply text for the link, requires </link>
	http://www.oasis-open.org/docbook/documentation/reference/html/link.html

linkend=
	controls the target of the link/xref, required

endterm=
	for <xref>, allows the text of the link/xref to be taken from a
	different link target title


External Linking
----------------

<ulink>
	like <link>, but uses a URL (not a document target);  requires
	</ulink>; if no text is specified, the URL appears as the link
	text
	http://www.oasis-open.org/docbook/documentation/reference/html/ulink.html

url=
	used by <ulink> to specify the URL, required


Guidelines
----------

o  If you want to supply text, use <link>, else <xref>
o  Do not use text with <ulink> so the URL appears in printed output
o  Specific nouns like GUC variables, SQL commands, and contrib modules
   usually have xreflabels