Re: [HACKERS] Repetitive code in RI triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>
Cc: Maksim Milyutin <milyutinma(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: [HACKERS] Repetitive code in RI triggers
Date: 2017-11-18 21:31:16
Message-ID: 25372.1511040676@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Ildar Musin <i(dot)musin(at)postgrespro(dot)ru> writes:
> [ ri_triggers_v2.patch ]

Pushed with two minor improvements. I noticed that ri_setdefault could
just go directly to ri_restrict rather than call the two separate triggers
that would end up there anyway; that lets its argument be "TriggerData
*trigdata" for more consistency with the other cases. Also, this patch
made it very obvious that we were caching identical queries under hash
keys RI_PLAN_RESTRICT_DEL_CHECKREF and RI_PLAN_RESTRICT_UPD_CHECKREF,
so we might as well just use one hash entry for both cases, saving a few
lines of code as well as a lot of cycles. Likewise in the other two
functions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-11-18 21:40:13 Re: spgist rangetypes compiler warning (gcc 7.2.0)
Previous Message David Fetter 2017-11-18 21:30:16 Re: percentile value check can be slow