pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CREATE DOMAIN should also include an example of use with functions
3+ messages / 2 participants
[nested] [flat]

* CREATE DOMAIN should also include an example of use with functions
@ 2017-02-02 20:49  postgresql@eric.brechemier.name
  0 siblings, 1 reply; 3+ messages in thread

From: postgresql@eric.brechemier.name @ 2017-02-02 20:49 UTC (permalink / raw)
  To: pgsql-docs

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: CREATE DOMAIN should also include an example of use with functions
@ 2017-04-05 04:23  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: postgresql@eric.brechemier.name
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Eisentraut @ 2017-04-05 04:23 UTC (permalink / raw)
  To: postgresql@eric.brechemier.name; pgsql-docs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: CREATE DOMAIN should also include an example of use with functions
@ 2017-04-05 17:26  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2017-04-05 17:26 UTC (permalink / raw)
  To: Eric Bréchemier <postgresql@eric.brechemier.name>; +Cc: pgsql-docs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-04-05 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02 20:49 CREATE DOMAIN should also include an example of use with functions postgresql@eric.brechemier.name
2017-04-05 04:23 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-04-05 17:26   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

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