From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Okano, Naoki" <okano(dot)naoki(at)jp(dot)fujitsu(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Adding the optional clause 'AS' in CREATE TRIGGER |
Date: | 2017-02-13 01:21:59 |
Message-ID: | 1ef887e1-ee85-f577-232c-facdfe454a64@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 11/14/16 8:51 PM, Tom Lane wrote:
> 1. The impression I have is that most people write trigger functions
> so that they can be shared across multiple uses. That'd be impossible
> with anonymous trigger function blocks. So you'd be trading off merging
> two commands into one, versus having to write out the whole body of the
> trigger multiple times, which wouldn't be much of a win.
I've fairly frequently needed one-off triggers, usually to do some kind
of data validation that wasn't suitable in a CHECK constraint. Enough so
that twice now[1] I've created generic trigger functions that allow you
to specify an arbitrary expression to test against NEW and OLD.
1: Second, WIP example:
https://github.com/decibel/tg_sanity/blob/master/sql/tg_sanity.sql
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2017-02-13 01:29:52 | Re: Checksums by default? |
Previous Message | Jim Nasby | 2017-02-13 01:15:35 | Re: Improve OR conditions on joined columns (common star schema problem) |