From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Vik Fearing <vik@postgresfriends.org>
Cc: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: Converting contrib SQL functions to new style
Date: Thu, 15 Apr 2021 13:23:13 -0400
Message-ID: <20210415172313.GA9186@alvherre.pgsql> (raw)
In-Reply-To: <5c2edf80-d1e3-cb9a-e5a8-41f3ad59515a@postgresfriends.org>
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
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: alvherre@alvh.no-ip.org, vik@postgresfriends.org, mark.dilger@enterprisedb.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org, peter.eisentraut@enterprisedb.com, robertmhaas@gmail.com
Subject: Re: Converting contrib SQL functions to new style
In-Reply-To: <20210415172313.GA9186@alvherre.pgsql>
* 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