Re: default value not working? - Mailing list pgsql-novice

From Tom Lane
Subject Re: default value not working?
Date
Msg-id 21485.989249961@sss.pgh.pa.us
Whole thread Raw
In response to default value not working?  (jason.servetar@ccgenesis.com)
List pgsql-novice
jason.servetar@ccgenesis.com writes:
> Ok, I ported my Oracle database and my developers started complaining that
> their defaults are not working.  Could someone tell me if I am doing
> something wrong and what the workaround is.

All the examples you give look perfectly fine to me.  Postgres does not
think that explicitly inserting a NULL means that the system should
substitute the default --- and the SQL standard agrees with us.
(Oracle is known to have rather broken handling of NULLs, so it wouldn't
surprise me a whole lot to hear that it gets this wrong ... but I don't
know for sure whether that's actually how it acts.)

Currently, to use a default value you have to omit the column entirely
from the column list in the INSERT command.  (SQL92 says you can also
write DEFAULT as one of the items in the VALUES list, but we don't
support that syntax yet.)

            regards, tom lane

pgsql-novice by date:

Previous
From: "Stephen M. Ford"
Date:
Subject: Re: Install of postgresql
Next
From:
Date:
Subject: re : default value not working?