Re: boolean default value

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Michael Schmidt <MichaelMSchmidt(at)msn(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: boolean default value
Date: 2005-08-28 21:51:45
Message-ID: 20050828215145.GA42102@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Schmidt 2005-08-28 22:27:03 Re: boolean default value
Previous Message Michael Schmidt 2005-08-28 21:31:17 boolean default value