Re: Can I use a constraint to make sure all array elements are positive? - Mailing list pgsql-sql

From Vik Fearing
Subject Re: Can I use a constraint to make sure all array elements are positive?
Date
Msg-id 532A1553.1050008@dalibo.com
Whole thread Raw
In response to Can I use a constraint to make sure all array elements are positive?  (AlexK <alkuzo@gmail.com>)
List pgsql-sql
On 03/19/2014 10:59 PM, AlexK wrote:
> One of the columns in my table is FLOAT[] NOT NULL. Can I use a constraint to
> make sure all array elements are positive?

You can make a function that checks an array, and then use that in a
CHECK constraint.

Also, note that  select array[null]::float[] is null;  returns false. 
That may not be what you want.

-- 
Vik




pgsql-sql by date:

Previous
From: AlexK
Date:
Subject: Can I use a constraint to make sure all array elements are positive?
Next
From: Sergey Konoplev
Date:
Subject: Re: Can I use a constraint to make sure all array elements are positive?