Re: Null vs. Empty String in Postgres 8.3.8 - Mailing list pgsql-general

From CaT
Subject Re: Null vs. Empty String in Postgres 8.3.8
Date
Msg-id 20100405032806.GZ2657@zip.com.au
Whole thread Raw
In response to Re: Null vs. Empty String in Postgres 8.3.8  ("Wang, Mary Y" <mary.y.wang@boeing.com>)
List pgsql-general
On Sun, Apr 04, 2010 at 08:03:13PM -0700, Wang, Mary Y wrote:
> I still don't get it.  I do want a zero for the subversion_flags to be stored in the table.  But it returned an error
becauseit didn't like subversion_flags='' in the UPDATE SQL statement.   
>
> subversion_flags | integer       | not null default 0

Thde default will not apply because you attempted to input a value.
Unless I'm mistaken the provision of any value (erroneous or otherwise)
obviates the activation of the default value. There is an exception
to this and that is using the DEFAULT keyword (ie subversion_flags=DEFAULT).

Otherwise the only way it activates is if you leave subversion_flags out
totally.

If you want input data mangling then a TRIGGER may be the way to go.

--
  "A search of his car uncovered pornography, a homemade sex aid, women's
  stockings and a Jack Russell terrier."
    - http://www.news.com.au/story/0%2C27574%2C24675808-421%2C00.html

pgsql-general by date:

Previous
From: Peter Hunsberger
Date:
Subject: Re: Null vs. Empty String in Postgres 8.3.8
Next
From: Sreelatha G
Date:
Subject: Re: Dynamic plpgsql help