Re: Converting contrib SQL functions to new style

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Converting contrib SQL functions to new style
Дата
Msg-id 20210415172313.GA9186@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Converting contrib SQL functions to new style  (Vik Fearing <vik@postgresfriends.org>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: pg_amcheck contrib application
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Forget close an open relation in ReorderBufferProcessTXN()