CREATE DOMAIN should also include an example of use with functions

Started by Nonameabout 9 years ago3 messagesdocs
Jump to latest
#1Noname
postgresql@eric.brechemier.name

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/sql-createdomain.html
Description:

The documentation of CREATE DOMAIN currently describes how optional
constraints can be useful for the fields of a table. There is no mention of
functions in this page.

I have recently found two use cases for domains with functions:

1. validation of the format of user inputs (mobile phone number, email
address, etc.) before any further processing in the function.

2. provide CURRENT_USER to a SECURITY DEFINER function (more details here:
http://stackoverflow.com/a/42011279/207968)

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Noname (#1)
Re: CREATE DOMAIN should also include an example of use with functions

On 2/2/17 15:49, postgresql@eric.brechemier.name wrote:

Page: https://www.postgresql.org/docs/9.6/static/sql-createdomain.html
Description:

The documentation of CREATE DOMAIN currently describes how optional
constraints can be useful for the fields of a table. There is no mention of
functions in this page.

There is an example using operators, which is pretty much the same thing.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Noname (#1)
Re: CREATE DOMAIN should also include an example of use with functions

On 4/5/17 06:09, Eric Bréchemier wrote:

Hi Peter,

I find no mention of operators on this page:

"This example creates the us_postal_code data type and then uses the
type in a table definition."
https://www.postgresql.org/docs/9.6/static/sql-createdomain.html#AEN79068

It uses the ~ operator in the domain definition in the example.

Perhaps you should send in an example of your own to explain what you mean.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs