On Jun 2, 2016, at 12:29 PM, Thom Brown wrote:

On 2 June 2016 at 10:13, konstantin knizhnik <k.knizh...@postgrespro.ru> wrote:

Yes, it doesn't work:

# CREATE DOMAIN teenager AS int CHECK (VALUE BETWEEN 13 AND 19);
CREATE DOMAIN

# SELECT 14::teenager;
 teenager
----------
       14
(1 row)

# SELECT 20::teenager;
ERROR:  value for domain teenager violates check constraint "teenager_check"

# SELECT '{14,20}'::teenager[];
 teenager
----------
 {14,20}
(1 row)

That last one should fail.


Yes, I see.
This approach was wrong.
Attached please find patch for DefineDomain function.

Attachment: domain.patch
Description: Binary data





Thom

Reply via email to