Re: How to check if a field exists in NEW in trigger

2019-08-09 Thread Peter J. Holzer
On 2019-08-07 15:54:33 -0700, Igal @ Lucee.org wrote: > There is no reason, however, for an email address to be not-lower-cased, so > while in some cases (no pun intended) it makes sense to keep the original > CaSe while performing a case insensitive comparison, when it comes to email > addresses I

Re: How to check if a field exists in NEW in trigger

2019-08-07 Thread David G. Johnston
On Sun, Aug 4, 2019 at 3:52 PM Igal @ Lucee.org wrote: > I have the following statement in a trigger: > > new.email = lower(new.email); > > When I try to update a record without setting the email column however, I > get an error: > > SQL Error [42703]: ERROR: record "new" has no field "email"

Re: How to check if a field exists in NEW in trigger

2019-08-07 Thread Igal @ Lucee.org
On 8/5/2019 11:34 AM, Michael Lewis wrote: As a note to the original poster, you might want to check out- https://www.postgresql.org/docs/current/citext.html Thanks, Michael.  I'm familiar with the citext module. There is no reason, however, for an email address to be not-lower-cased, so whi

Re: How to check if a field exists in NEW in trigger

2019-08-05 Thread Michael Lewis
As a note to the original poster, you might want to check out- https://www.postgresql.org/docs/current/citext.html

Re: How to check if a field exists in NEW in trigger

2019-08-05 Thread Pavel Stehule
po 5. 8. 2019 v 10:10 odesílatel Thomas Kellerer napsal: > Pavel Stehule schrieb am 05.08.2019 um 08:19: > >>> I have seen some hacks suggesting TRY/CATCH or converting to a JSON > >>> and checking if the field exists, but I would think that there's a > >>> better way to check if the field is in

Re: How to check if a field exists in NEW in trigger

2019-08-05 Thread Thomas Kellerer
Pavel Stehule schrieb am 05.08.2019 um 08:19: >>> I have seen some hacks suggesting TRY/CATCH or converting to a JSON >>> and checking if the field exists, but I would think that there's a >>> better way to check if the field is in the NEW record, no? > >> I assume using to_jsonb(new) and then che

Re: How to check if a field exists in NEW in trigger

2019-08-04 Thread Pavel Stehule
po 5. 8. 2019 v 7:55 odesílatel Thomas Kellerer napsal: > Igal @ Lucee.org schrieb am 05.08.2019 um 00:52: > > I have the following statement in a trigger: > > > > new.email = lower(new.email); > > > > When I try to update a record without setting the email column however, > I get an error: >

Re: How to check if a field exists in NEW in trigger

2019-08-04 Thread Thomas Kellerer
Igal @ Lucee.org schrieb am 05.08.2019 um 00:52: > I have the following statement in a trigger: > >     new.email = lower(new.email); > > When I try to update a record without setting the email column however, I get > an error: > > SQL Error [42703]: ERROR: record "new" has no field "email" >  

Re: How to check if a field exists in NEW in trigger

2019-08-04 Thread Adrian Klaver
On 8/4/19 3:52 PM, Igal @ Lucee.org wrote: I have the following statement in a trigger:     new.email = lower(new.email); When I try to update a record without setting the email column however, Do you mean: 1) There is no actual email column? 2) There is an email column but no value for i