Re: trigger example for plsample - Mailing list pgsql-hackers

From chap@anastigmatix.net
Subject Re: trigger example for plsample
Date
Msg-id f648af4930cde44c512bacc92679110a@anastigmatix.net
Whole thread Raw
In response to Re: trigger example for plsample  (Mark Wong <markwkm@gmail.com>)
Responses Re: trigger example for plsample  (Mark Wong <markwkm@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: New function(s) to get various timelines that the postgres server deals with.
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: How about a psql backslash command to show GUCs?