pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chap@anastigmatix.net
To: Mark Wong <markwkm@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Konstantina Skovola <konskov@gmail.com>
Subject: Re: trigger example for plsample
Date: Thu, 07 Apr 2022 10:30:13 -0400
Message-ID: <f648af4930cde44c512bacc92679110a@anastigmatix.net> (raw)
In-Reply-To: <Yk37rCOPVFW3+EJh@workstation-mark-wong>
References: <Yd8Cz22eHi80XS30@workstation-mark-wong>
	<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 2022-04-06 16:44, Mark Wong wrote:
> I think I've applied all of these suggestions and attached a new patch.

That looks good to me, though I wonder about the pfree(source).
In the simplest case of a PL that uses no advance compilation or
augmentation step, the Code Execution block might naturally refer
to source, so perhaps the example boilerplate shouldn't include
a pfree that needs to be removed in that case.

In fact, I wonder about the need for any retail pfree()s here. Those
added in this patch are the only ones in plsample.c. They are small
allocations, and maybe it would both streamline the example to leave
out the pfree calls, and be an illustration of best practice in letting
the memory context machinery handle all the deallocation at once, where
there isn't a special need to free something, like an especially large
allocation, at retail.

Regards,
-Chap





view thread (11+ messages)  latest in thread

Message-ID: <f648af4930cde44c512bacc92679110a@anastigmatix.net>
Permalink:  ../f648af4930cde44c512bacc92679110a@anastigmatix.net/
Also on:    postgresql.org/message-id/f648af4930cde44c512bacc92679110a@anastigmatix.net

 · 

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: chap@anastigmatix.net, markwkm@gmail.com, konskov@gmail.com
  Subject: Re: trigger example for plsample
  In-Reply-To: <f648af4930cde44c512bacc92679110a@anastigmatix.net>

* 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