Re: Converting contrib SQL functions to new style

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Vik Fearing <vik(at)postgresfriends(dot)org>
Cc: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Converting contrib SQL functions to new style
Date: 2021-04-15 17:23:13
Message-ID: 20210415172313.GA9186@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Apr-15, Vik Fearing wrote:

> CREATE DOMAIN earth AS "$extension".cube.cube
> CONSTRAINT not_point check("$extension".cube.cube_is_point(value))
> CONSTRAINT not_3d check("$extension".cube.cube_dim(value <= 3)
> ...;

I find this syntax pretty weird -- here, the ".cube." part of the
identifier is acting as an argument of sorts for the preceding
$extension thingy. This looks very surprising.

Something similar to OPERATOR() syntax may be more palatable:

CREATE DOMAIN earth AS PG_EXTENSION_SCHEMA(cube).cube
CONSTRAINT not_point check(PG_EXTENSION_SCHEMA(cube).cube_is_point(value))
CONSTRAINT not_3d check(PG_EXTENSION_SCHEMA(cube).cube_dim(value <= 3)
...;

Here, the PG_EXTENSION_SCHEMA() construct expands into the schema of the
given extension. This looks more natural to me, since the extension
that acts as argument to PG_EXTENSION_SCHEMA() does look like an
argument.

I don't know if the parser would like this, though.

--
Álvaro Herrera Valdivia, Chile

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-04-15 17:26:52 Re: Forget close an open relation in ReorderBufferProcessTXN()
Previous Message Mark Dilger 2021-04-15 17:07:16 Re: pg_amcheck contrib application