boolean default value

Started by Michael Schmidtover 20 years ago3 messagesgeneral
Jump to latest
#1Michael Schmidt
michaelmschmidt@msn.com

I've not been able to find anything on this in the groups or by Google. I have a table with several boolean columns, all not null and with either 'true' or 'false' as default values. I've been testing the system in pgAdmin III. When I insert a new record, all the boolean columns are set 'false', including the ones I have set the default value as 'true'. Has anyone else had this problem?

Michael Schmidt

#2Michael Fuhr
mike@fuhr.org
In reply to: Michael Schmidt (#1)
Re: boolean default value

On Sun, Aug 28, 2005 at 03:31:17PM -0600, Michael Schmidt wrote:

I've not been able to find anything on this in the groups or by
Google. I have a table with several boolean columns, all not null and
with either 'true' or 'false' as default values. I've been testing the
system in pgAdmin III. When I insert a new record, all the boolean
columns are set 'false', including the ones I have set the default value
as 'true'. Has anyone else had this problem?

Works fine here with psql in every version I tested (7.2.8, 7.3.10,
7.4.8, 8.0.3, 8.1beta1):

CREATE TABLE foo (
i integer NOT NULL,
bt boolean NOT NULL DEFAULT TRUE,
bf boolean NOT NULL DEFAULT FALSE
);

INSERT INTO foo (i) VALUES (1);

SELECT * FROM foo;
i | bt | bf
---+----+----
1 | t | f
(1 row)

Have you tried with psql instead of pgAdmin III? If you see the
problem with psql then please post a self-contained example (and
state what version of PostgreSQL you're using).

--
Michael Fuhr

#3Michael Schmidt
michaelmschmidt@msn.com
In reply to: Michael Schmidt (#1)
Re: boolean default value

Mr. Fuhr,
Thanks for your quick response. In fact, the problem doesn't occur in psql or in EMS PostgreSQL Manager. It appears unique to pgAdmin III. In the future, I'll check such things with psql before asking a (potentially dumb) question. Again, thanks!

Michael Schmidt