pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Merge near-duplicate code in RI triggers. 2+ messages / 2 participants [nested] [flat]
* pgsql: Merge near-duplicate code in RI triggers. @ 2017-11-18 21:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2017-11-18 21:24 UTC (permalink / raw) To: pgsql-committers Merge near-duplicate code in RI triggers. Merge ri_restrict_del and ri_restrict_upd into one function ri_restrict. Create a function ri_setnull that is the common implementation of RI_FKey_setnull_del and RI_FKey_setnull_upd. Likewise create a function ri_setdefault that is the common implementation of RI_FKey_setdefault_del and RI_FKey_setdefault_upd. All of these pairs of functions were identical except for needing to check for no-actual-key-change in the UPDATE cases; the one extra if-test is a small price to pay for saving so much code. Aside from removing about 400 lines of essentially duplicate code, this allows us to recognize that we were uselessly caching two identical plans whenever there were pairs of triggers using these duplicated functions (which is likely very common). Ildar Musin, reviewed by Ildus Kurbangaliev Discussion: https://postgr.es/m/ca7064a7-6adc-6f22-ca47-8615ba9425a5@postgrespro.ru Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4797f9b519995ceca5d6b8550b5caa2ff6d19347 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 715 ++++++++---------------------------- 1 file changed, 146 insertions(+), 569 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Merge near-duplicate code in RI triggers @ 2019-02-28 19:44 Peter Eisentraut <peter@eisentraut.org> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2019-02-28 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Merge near-duplicate code in RI triggers Merge ri_setnull and ri_setdefault into one function ri_set. These functions were to a large part identical. This is a continuation in spirit of 4797f9b519995ceca5d6b8550b5caa2ff6d19347. Author: Corey Huinker <corey.huinker@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/3f61999cc9da68890174dd8cf97f2cb96b223e81 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 181 ++++++++---------------------------- 1 file changed, 40 insertions(+), 141 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-02-28 19:44 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-11-18 21:24 pgsql: Merge near-duplicate code in RI triggers. Tom Lane <tgl@sss.pgh.pa.us> 2019-02-28 19:44 pgsql: Merge near-duplicate code in RI triggers Peter Eisentraut <peter@eisentraut.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox