Array type and default values - Mailing list pgsql-general

From Medi Montaseri
Subject Array type and default values
Date
Msg-id 3E8CA286.7070508@intransa.com
Whole thread Raw
List pgsql-general
Can someone show me how to specify default values for array types..

For example...

create table grades
(
    name varchar(20),
    grades int[] default '{0}'
);

Is this how I should do this....?
Does this mean the first element of the array gets the default value on
insertion ?

How can I put some constaints for the max values of each element of the
array,
can/should I say,

grades int[] default '{0}' check ( grades[0] < 20 and grades[1] < 35 and
etc etc )

Thanks


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql password when FreeBSD boots -- what's usual?
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: Single Byte values