pgsql: Reset memory context once per tuple in validateForeignKeyConstra

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reset memory context once per tuple in validateForeignKeyConstra
Date: 2019-04-08 05:52:55
Message-ID: E1hDNDD-0006vj-SP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reset memory context once per tuple in validateForeignKeyConstraint.

When using tableam ExecFetchSlotHeapTuple() might return a separately
allocated tuple. We could use the shouldFree argument to explicitly
free it, but it seems more robust to to protect

Also add a CHECK_FOR_INTERRUPTS() after each tuple. It's likely that
each AM has (heap does) a CFI somewhere in the relevant path, but it
seems more robust to have one in validateForeignKeyConstraint()
itself.

Note that this only affects the cases that couldn't be optimized to be
verified with a query.

Author: Andres Freund
Reviewed-By: Tom Lane (in an earlier version)
Discussion:
https://postgr.es/m/19030.1554574075@sss.pgh.pa.us
https://postgr.es/m/CAKJS1f_SHKcPYMsi39An5aUjhAcEMZb6Cx1Sj1QWEWSiKJkBVQ@mail.gmail.com
https://postgr.es/m/20180711185628.mrvl46bjgk2uxoki@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4c9e1bd0a37e7b79dfc797dd91627336e871c1b0

Modified Files
--------------
src/backend/commands/tablecmds.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-04-08 06:36:57 pgsql: Tweak wording of documentation for pg_checksums
Previous Message Andres Freund 2019-04-08 05:16:32 pgsql: Fix a number of issues around modifying a previously updated row