Thread: Array type and default values

Array type and default values

From
Medi Montaseri
Date:
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