CREATE DOMAIN should also include an example of use with functions

From: postgresql(at)eric(dot)brechemier(dot)name
To: pgsql-docs(at)postgresql(dot)org
Subject: CREATE DOMAIN should also include an example of use with functions
Date: 2017-02-02 20:49:35
Message-ID: 20170202204935.1400.31181@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message postgresql 2017-02-02 20:54:09 Cross-references between DOMAIN and POLICY
Previous Message Peter Eisentraut 2017-02-02 20:00:29 Re: Encoding change actually works)