Re: delta relations in AFTER triggers

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Prabhat Sahu <prabhat.sahu@enterprisedb.com>, Kevin Grittner <kgrittn@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Haribabu Kommi <kommi.haribabu@gmail.com>, Jim Nasby <Jim.Nasby@bluetreble.com>, Craig Ringer <craig@2ndquadrant.com>, Michael Paquier <michael.paquier@gmail.com>, David Fetter <david@fetter.org>, Kevin Grittner <kgrittn@ymail.com>, Amit Khandekar <amit.khandekar@enterprisedb.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Corey Huinker <corey.huinker@gmail.com>
Date: 2017-05-10T03:18:18Z
Lists: pgsql-hackers
On Thu, May 4, 2017 at 5:51 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Reproduced here.  The stack looks like this:
>
>     frame #3: 0x000000010f06f8b0
> postgres`ExceptionalCondition(conditionName="!(readptr->eflags &
> 0x0002)", errorType="FailedAssertion", fileName="tuplestore.c",
> lineNumber=1237) + 128 at assert.c:54
>     frame #4: 0x000000010f0cbc85
> postgres`tuplestore_rescan(state=0x00007ff219840200) + 85 at
> tuplestore.c:1237
>     frame #5: 0x000000010eced9b1
> postgres`ExecReScanNamedTuplestoreScan(node=0x00007ff21d007840) + 81
> at nodeNamedtuplestorescan.c:197
>     frame #6: 0x000000010eca46a6
> postgres`ExecReScan(node=0x00007ff21d007840) + 822 at execAmi.c:216
>     frame #7: 0x000000010ece7eca
> postgres`ExecNestLoop(node=0x00007ff21d006310) + 538 at
> nodeNestloop.c:148
>
> I think the problem is that the tuplestore read pointer hasn't been
> opened with the "rewindable" flag.  It works for me with the attached.

Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Commits

  1. Don't permit transition tables with TRUNCATE triggers.

  2. Pass EXEC_FLAG_REWIND when initializing a tuplestore scan.

  3. Faster expression evaluation and targetlist projection.

  4. Remove obsoleted code relating to targetlist SRF evaluation.

  5. Implement syntax for transition tables in AFTER triggers.