Re: doc examples for pghandler

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Mark Wong <mark(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: doc examples for pghandler
Date: 2020-08-14 05:25:52
Message-ID: 20200814052552.GE2057@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 11, 2020 at 01:01:10PM -0700, Mark Wong wrote:
> Ah, right. For the moment I've added some empty conditionals for
> trigger and event trigger handling.
>
> I've created a new entry in the commitfest app. [1] I'll keep at it. :)

Thanks for the patch. I have reviewed and reworked it as the
attached. Some comments below.

+PGFILEDESC = "PL/Sample - procedural language"
+
+REGRESS = create_pl create_func select_func
+
+EXTENSION = plsample
+EXTVERSION = 0.1

This makefile has a couple of mistakes, and can be simplified a lot:
- make check does not work, as you forgot a PGXS part.
- MODULES can just be used as there is only one file (forgot WIN32RES
in OBJS for example)
- DATA does not need the .control file.

.gitignore was missing.

We could just use 1.0 instead of 0.1 for the version number. That's
not a big deal one way or another, but 1.0 is more consistent with the
other modules.

plsample--1.0.sql should complain if attempting to load the file from
psql. Also I have cleaned up the README.

Not sure that there is a point in having three different files for the
regression tests. create_pl.sql is actually not necessary as you
can do the same with CREATE EXTENSION.

The header list of plsample.c was inconsistent with the style used
normally in modules, and I have extended a bit the handler function so
as we return a result only if the return type of the procedure is text
for the source text of the function, tweaked the results a bit, etc.
There was a family of small issues, like using ALLOCSET_SMALL_SIZES
for the context creation. We could of course expand the sample
handler more in the future to check for pseudotype results, have a
validator, but that could happen later, if necessary.
--
Michael

Attachment Content-Type Size
0001-Add-PL-sample-to-src-test-modules.patch text/x-diff 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2020-08-14 05:32:17 Re: Inconsistent behavior of smart shutdown handling for queries with and without parallel workers
Previous Message Thomas Munro 2020-08-14 04:40:28 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions