Re: How to set a Default Value - Mailing list pgsql-novice

From Michael Glaesemann
Subject Re: How to set a Default Value
Date
Msg-id E3A2EF99-29E0-4050-B9FD-3CD817BCD436@myrealbox.com
Whole thread Raw
In response to How to set a Default Value  (Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>)
Responses Re: How to set a Default Value
List pgsql-novice
On Jan 13, 2006, at 22:10 , Ângelo Marcos Rigo wrote:

> I have created a column item varchar(11) with default
> value = 0

How did you set the default to 0? Can we see your table definition
statement? Also, note that 0 is an integer: you probably want
'0' (with the single quotes).

> But when i do insert any record the value is set to
> null.

How are your inserting records? Can we see your insert statement?

> How can i always get the defualt value if any other
> value is not defined (sometimes it will have some
> identification characters)

If you want to guarantee that there will always be *some* value, make
sure you set the column NOT NULL as well.

If this doesn't help, please provide a simple, complete example that
shows the behavior you describe so we may help you further.

Michael Glaesemann
grzm myrealbox com




pgsql-novice by date:

Previous
From: Ângelo Marcos Rigo
Date:
Subject: How to set a Default Value
Next
From: Sean Davis
Date:
Subject: Re: How to set a Default Value