pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Durumdara <durumdara@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: PLPGSQL - extra column existence in trigger
Date: Wed, 11 May 2022 12:29:04 +0200
Message-ID: <20220511102903.GA4161@depesz.com> (raw)
In-Reply-To: <CAKFQuwbEbnpexHDEz+PE7C+gDp1S6_Kkq+YVKO_0Qa09tx=RdA@mail.gmail.com>
References: <CAEcMXhmO-FjavfjRwf6+sbR-FV_RPyG14gR7H5G+yM3u6J=udg@mail.gmail.com>
	<CAKFQuwbEbnpexHDEz+PE7C+gDp1S6_Kkq+YVKO_0Qa09tx=RdA@mail.gmail.com>

On Sat, May 07, 2022 at 07:41:44AM -0700, David G. Johnston wrote:
> No.  I’d probably approach this by generically converting the NEW record to
> json and working with that.  Non-existent object keys return null when
> accessed.

One note - in my tests working with hstore was significantly faster than
json.

It could have changed since I wrote it, but you might want to check it
out:
https://www.depesz.com/2021/04/21/getting-value-from-dynamic-column-in-pl-pgsql-triggers/

depesz





view thread (6+ messages)  latest in thread

Message-ID: <20220511102903.GA4161@depesz.com>
Permalink:  ../20220511102903.GA4161@depesz.com/
Also on:    postgresql.org/message-id/20220511102903.GA4161@depesz.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: depesz@depesz.com, david.g.johnston@gmail.com, durumdara@gmail.com
  Subject: Re: PLPGSQL - extra column existence in trigger
  In-Reply-To: <20220511102903.GA4161@depesz.com>
  References: <CAEcMXhmO-FjavfjRwf6+sbR-FV_RPyG14gR7H5G+yM3u6J=udg@mail.gmail.com> <CAKFQuwbEbnpexHDEz+PE7C+gDp1S6_Kkq+YVKO_0Qa09tx=RdA@mail.gmail.com> <20220511102903.GA4161@depesz.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox