Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER
Дата
Msg-id 1ef887e1-ee85-f577-232c-facdfe454a64@BlueTreble.com
обсуждение исходный текст
Ответ на Re: Adding the optional clause 'AS' in CREATE TRIGGER  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] Improve OR conditions on joined columns (common starschema problem)
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] Checksums by default?