Thread: default value

default value

From
"Nathalie Boulos"
Date:
Hi,

i have a problem with the default value:

When i insert a value into a field in the table directly, all the other
fields take their default values normaly, but the problem is if i insert
into the rule and not into the table, all the fields who has default values
do not take them. those fields remains empty.

So the default value does not work if i insert into a rule ???

I would greatly appreciate any feedback

Regards

Nathalie

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus


Re: default value

From
Tom Lane
Date:
"Nathalie Boulos" <nathalieboulos@hotmail.com> writes:
> When i insert a value into a field in the table directly, all the other
> fields take their default values normaly, but the problem is if i insert
> into the rule and not into the table, all the fields who has default values
> do not take them. those fields remains empty.
> So the default value does not work if i insert into a rule ???

A rule has its own defaults --- set them with ALTER TABLE rule SET DEFAULT.

(IIRC this works since about 7.2; it won't work on old Postgresen.)

            regards, tom lane