Skip site navigation (1) Skip section navigation (2)

Re: default value not working?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jason(dot)servetar(at)ccgenesis(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: default value not working?
Date: 2001-05-07 15:39:21
Message-ID: 21485.989249961@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
jason(dot)servetar(at)ccgenesis(dot)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

In response to

pgsql-novice by date

Next:From: Michael R. JinksDate: 2001-05-07 16:38:40
Subject: Re: Install of postgresql
Previous:From: pejacDate: 2001-05-07 15:36:57
Subject: re : default value not working?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group