From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | paul(dot)coyne(at)diridium(dot)com |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14609: ON CONSTRAINT (aka UPSERT) code fails when excluded.<columname> used in calculation. |
Date: | 2017-03-31 21:54:30 |
Message-ID: | CAH2-Wz=f4fEKwfGz=hZdqx4DNCm3n5w3-zjv7aQrKfAuCwxfgg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Mar 31, 2017 at 5:10 PM, <paul(dot)coyne(at)diridium(dot)com> wrote:
> Can excluded.variablename be used in a calculation? It appears to have the
> value NULL in the formula.
I'm on a flight, and haven't looked at this properly, but I have a
hard time following the expression in the UPDATE part of your INSERT
within the plpgsql function. What is this supposed to do?
IF(COALESCE(NULLIF(p_sendingfacility,''),excluded.sendingfacility),'""')
WHERE excluded.mrn = p_mrn and excluded.site_code = p_site_code
It's also weird that "WHERE excluded.mrn = p_mrn" is there, since
you're proposing that same value (function argument) for insertion in
the first place (same with site_code).
Are you sure that this isn't just an "IS NULL vs. =" issue?
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Coyne | 2017-03-31 22:47:15 | Re: BUG #14609: ON CONSTRAINT (aka UPSERT) code fails when excluded.<columname> used in calculation. |
Previous Message | paul.coyne | 2017-03-31 21:10:11 | BUG #14609: ON CONSTRAINT (aka UPSERT) code fails when excluded.<columname> used in calculation. |