pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
To: Mark Wong <markwkm@gmail.com>
Cc: Chapman Flack <chap@anastigmatix.net>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Konstantina Skovola <konskov@gmail.com>
Subject: Re: trigger example for plsample
Date: Wed, 6 Apr 2022 18:12:08 -0300
Message-ID: <CAFcNs+oL581ToM-2VoJBXmL8TOnAsWjsQbfeXnXmCwsv4a05ow@mail.gmail.com> (raw)
In-Reply-To: <Yk37rCOPVFW3+EJh@workstation-mark-wong>
References: <Yd8Cz22eHi80XS30@workstation-mark-wong>
	<164581437973.1035.16436524743292685141.pgcf@coridan.postgresql.org>
	<Yh/PkdpVPbeydjC/@workstation-mark-wong>
	<622A8B8C.1060306@anastigmatix.net>
	<Yk37rCOPVFW3+EJh@workstation-mark-wong>

On Wed, Apr 6, 2022 at 5:44 PM Mark Wong <markwkm@gmail.com> wrote:
>
> On Thu, Mar 10, 2022 at 06:36:44PM -0500, Chapman Flack wrote:
> > On 03/02/22 15:12, Mark Wong wrote:
> >
> > > I've attached v2, which reduces the output:
> > >
> > > * Removing the notices for the text body, and the "compile" message.
> > > * Replaced the notice for "compile" message with a comment as a
> > >   placeholder for where a compiling code or checking a cache may go.
> > > * Reducing the number of rows inserted into the table, thus reducing
> > >   the number of notice messages about which code path is taken.
> >
> > I think the simplifying assumption of a simple interpreted language
allows
> > a lot more of this code to go away. I mean more or less that whole first
> > PG_TRY...PG_END_TRY block, which could be replaced with a comment saying
> > something like
> >
> >   The source text may be augmented here, such as by wrapping it as the
> >   body of a function in the target language, prefixing a parameter list
> >   with names like TD_name, TD_relid, TD_table_name, TD_table_schema,
> >   TD_event, TD_when, TD_level, TD_NEW, TD_OLD, and args, using whatever
> >   types in the target language are convenient. The augmented text can be
> >   cached in a longer-lived memory context, or, if the target language
uses
> >   a compilation step, that can be done here, caching the result of the
> >   compilation.
> >
> > That would leave only the later PG_TRY block where the function gets
> > "executed". That could stay largely as is, but should probably also have
> > a comment within it, something like
> >
> >   Here the function (the possibly-augmented source text, or the result
> >   of compilation if the target language uses such a step) should be
> >   executed, after binding these values from the TriggerData struct to
> >   the expected parameters.
> >
> > That should make the example shorter and clearer, and preserve the
output
> > tested by the regression test. Trying to show much more than that
involves
> > assumptions about what the PL's target language syntax looks like, how
its
> > execution engine works and parameters are bound, and so on, and that is
> > likely to just be distracting, IMV.
>
> I think I've applied all of these suggestions and attached a new patch.
>

Cool... I also have a look into the code. To me everything is also ok!!!

Regards,

--
Fabrízio de Royes Mello

view thread (11+ messages)  latest in thread

Message-ID: <CAFcNs+oL581ToM-2VoJBXmL8TOnAsWjsQbfeXnXmCwsv4a05ow@mail.gmail.com>
Permalink:  ../CAFcNs+oL581ToM-2VoJBXmL8TOnAsWjsQbfeXnXmCwsv4a05ow@mail.gmail.com/
Also on:    postgresql.org/message-id/CAFcNs+oL581ToM-2VoJBXmL8TOnAsWjsQbfeXnXmCwsv4a05ow@mail.gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: fabriziomello@gmail.com, markwkm@gmail.com, chap@anastigmatix.net, pgsql-hackers@lists.postgresql.org, konskov@gmail.com
  Subject: Re: trigger example for plsample
  In-Reply-To: <CAFcNs+oL581ToM-2VoJBXmL8TOnAsWjsQbfeXnXmCwsv4a05ow@mail.gmail.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