Test for trigger condition accessing system attributes

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Test for trigger condition accessing system attributes
Date: 2018-05-10 08:58:11
Message-ID: CAFjFpRerUFX=T0nSnCoroXAJMoo-xah9J+pi7+xDUx86PtQmew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I was investigating the cases when the system attributes are accessed
beyond the scans. After investigating set_plan_references(), I thought
that we never access system attributes beyond scans. This lead me to
assume that EEOP_INNER/OUTER_SYSVAR are not needed since we do not
access system attributes from an inner or outer slot. I removed the
defintions and code using those and ran regression. All the tests
passed. So, I was about to conclude that my assumption is correct. But
then looking at TriggerEnabled() I realised that we also (ab?)use
INNER/OUTER Vars for OLD/NEW tuples for trigger condition. If the WHEN
condition in CREATE TRIGGER command refers to a system attribute, we
will end up having INNER/OUTER var refering a system attribute, thus
exercising code for EEOP_INNER/OUTER_SYSVAR.

Here's patch containing a testcase exercizing that code using
EEOP_INNER/OUTER_SYSVAR.

0001 is the actual testcase and the output
0002 adds warnings where EEOP_OUTER/INNER_SYSVAR are used. This patch
is not for commit. It is only to make sure that the code gets
exercised by the test. When both the patches are applied, the test
shows those warnings.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
0001-Testcase-accessing-system-columns-from-a-trigger-fun.patch text/x-patch 2.5 KB
0002-Add-a-warning-message-when-creating-EEOP_INNER-OUTER.patch text/x-patch 951 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marina Polyakova 2018-05-10 09:36:22 Re: [HACKERS] path toward faster partition pruning
Previous Message Liudmila Mantrova 2018-05-10 07:57:45 Re: doc fixes: vacuum_cleanup_index_scale_factor