| From: | "Igal (at) Lucee(dot)org" <igal(at)lucee(dot)org> |
|---|---|
| To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | How to check if a field exists in NEW in trigger |
| Date: | 2019-08-04 22:52:22 |
| Message-ID: | 0cc87310-590f-740e-977d-bcdde57eef1b@lucee.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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"
Where: SQL statement "SELECT lower(new.email)"
PL/pgSQL function on_record_modified() line 26 at assignment
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?
Any ideas? Thanks!
Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2019-08-05 00:29:40 | Re: How to check if a field exists in NEW in trigger |
| Previous Message | Julie Nishimura | 2019-08-04 22:39:13 | Re: adding more space to the existing server |