Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-02 Thread Sebastian Tennant
Quoth Alvaro Herrera <[EMAIL PROTECTED]>: > Sebastian Tennant wrote: >> Quoth Alvaro Herrera <[EMAIL PROTECTED]>: >> > Sebastian Tennant wrote: >> > >> >> P.S. Emacs users of PostgreSQL might like to know that there's a >> >> texinfo version of the manual (version 8.3.3) available for >> >>

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-02 Thread Alvaro Herrera
Sebastian Tennant wrote: > Quoth Alvaro Herrera <[EMAIL PROTECTED]>: > > Sebastian Tennant wrote: > > > >> P.S. Emacs users of PostgreSQL might like to know that there's a > >> texinfo version of the manual (version 8.3.3) available for > >> download from here: > >> > >> http:

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Quoth Alvaro Herrera <[EMAIL PROTECTED]>: > Sebastian Tennant wrote: > >> P.S. Emacs users of PostgreSQL might like to know that there's a >> texinfo version of the manual (version 8.3.3) available for >> download from here: >> >> http://www.emacswiki.org/PostGreSQL > > Hmm, w

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Alvaro Herrera
Sebastian Tennant wrote: > P.S. Emacs users of PostgreSQL might like to know that there's a > texinfo version of the manual (version 8.3.3) available for > download from here: > > http://www.emacswiki.org/PostGreSQL Hmm, we did have a patch to add a texinfo target to the doc

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Quoth Tom Lane <[EMAIL PROTECTED]>: > Sebastian Tennant <[EMAIL PROTECTED]> writes: >> I sometimes think this kind of gotcha is purposely buried, or not >> addressed at all, in order to force users to read the manual. > > Where exactly do you think we should document it, if not in the > manual? I

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Quoth "Richard Broersma" <[EMAIL PROTECTED]>: > On Mon, Dec 1, 2008 at 8:35 AM, Sebastian Tennant > <[EMAIL PROTECTED]> wrote: IF (NEW. != OLD.) THEN ... >>> >>> IF( NEW.* IS DISTINCT FROM OLD.* ) THEN ... >>> >> I sometimes think this kind of gotcha is purposely buried, or not >> addressed a

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Tom Lane
Sebastian Tennant <[EMAIL PROTECTED]> writes: > I sometimes think this kind of gotcha is purposely buried, or not > addressed at all, in order to force users to read the manual. Where exactly do you think we should document it, if not in the manual? In any case it's SQL-standard behavior that any

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Richard Broersma
On Mon, Dec 1, 2008 at 8:35 AM, Sebastian Tennant <[EMAIL PROTECTED]> wrote: >>> IF (NEW. != OLD.) THEN ... >> >> IF( NEW.* IS DISTINCT FROM OLD.* ) THEN ... > > I sometimes think this kind of gotcha is purposely buried, or not > addressed at all, in order to force users to read the manual. I wou

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Quoth "Richard Broersma" <[EMAIL PROTECTED]>: > On Mon, Dec 1, 2008 at 7:18 AM, Sebastian Tennant > <[EMAIL PROTECTED]> wrote: > >> IF (NEW. != OLD.) THEN ... > > The != operator doesn't work the way you might think when nulls are > thrown into the mix. I asked a similar question a while back an

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Quoth Adrian Klaver <[EMAIL PROTECTED]>: > On Monday 01 December 2008 7:18:51 am Sebastian Tennant wrote: >> I had thought that OLD holds the record as it was before the update, >> and that NEW holds the record as it is since the update (but before >> the update has been committed)? '42.10 Trigger

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Richard Broersma
On Mon, Dec 1, 2008 at 7:18 AM, Sebastian Tennant <[EMAIL PROTECTED]> wrote: > IF (NEW. != OLD.) THEN ... The != operator doesn't work the way you might think when nulls are thrown into the mix. I asked a similar question a while back and was kindly pointed to the following syntax: IF( NEW.*

Re: [GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Adrian Klaver
On Monday 01 December 2008 7:18:51 am Sebastian Tennant wrote: > Hi list, > > First steps in trigger functions and PL/pgSQL so please bear with me... > > How can one detect changes to certain fields in before update trigger > functions? > > IF (NEW. != OLD.) THEN ... > > doesn't work, so obviously

[GENERAL] Detecting changes to certain fields in 'before update' trigger functions

2008-12-01 Thread Sebastian Tennant
Hi list, First steps in trigger functions and PL/pgSQL so please bear with me... How can one detect changes to certain fields in before update trigger functions? IF (NEW. != OLD.) THEN ... doesn't work, so obviously my understanding of the values of the varriables NEW and OLD in before update