PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15900
PG Version12beta2
OSUbuntu 16.04
Opened2019-07-08 22:22:45+00
Reported byAlex Aktsipetrov
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15900
Logged by:          Alex Aktsipetrov
Email address:      (redacted)
PostgreSQL version: 12beta2
Operating system:   Ubuntu 16.04
Description:        

SELECT FOR UPDATE query that references a transition table in AFTER
INSERT/UPDATE triggers produces an unexpected error. The same query with FOR
UPDATE omitted finishes without any error, which is my expectation for the
original one as well. AFTER DELETE triggers were not tested.

For example, the following query:

	create table testtr (a int, b text);

	create function testtr_trigger() returns trigger language plpgsql as
	$$begin
	 perform(
	   select array_agg(a) from
	   (select testtr.a from testtr join new_table on testtr.a = new_table.a
for update)
	   as tmp
	 );
	 return new;
	end$$;

	create trigger testtr_trigger
	after insert on testtr
	referencing new table as new_table
	for each statement execute procedure testtr_trigger();

	insert into testtr values (1, 'one'), (2, 'two');

produces the following error:

	ERROR:  executor could not find named tuplestore "new_table"
	CONTEXT:  SQL statement "SELECT (
	   select array_agg(a) from
	   (select testtr.a from testtr join new_table on testtr.a = new_table.a
for update)
	   as tmp
	)"

I think the issue was introduced in ad0bda5d24ea2bcc72b5e50020e3c79bab10836b
as the query finishes successfully in its ancestor.

Messages

DateAuthorSubject
2019-07-08 22:22:45+00PG Bug reporting formBUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-08 23:32:55+00=?UTF-8?B?0JDQu9C10LrRgdCw0L3QtNGAINCQ0LrRhtC40L/QtdGC0YDQvtCy?=Re: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-08 23:39:23+00Alex AktsipetrovRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-08 23:49:19+00Thomas MunroRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-09 01:13:31+00Thomas MunroRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-09 11:47:28+00Thomas MunroRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-09 15:38:13+00Tom LaneRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-09 22:43:28+00Thomas MunroRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks
2019-07-11 00:52:02+00Andres FreundRe: BUG #15900: `executor could not find named tuplestore` in triggers with transition table and row locks