Обсуждение: BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values
The following bug has been logged online:
Bug reference: 1582
Logged by: Eric McGough
Email address: emcgough@yahoo.com
PostgreSQL version: 8.0.1
Operating system: Solaris 8
Description: boolean DEFAULT TRUE results in FALSE for NULL values
Details:
-- This table and COPY command should result in all
-- three columns defaulting to TRUE based on NULL
-- inputs, but they all result in FALSE. Not sure why?
CREATE TABLE my_table (
field1 boolean DEFAULT TRUE,
field2 boolean DEFAULT TRUE,
field3 boolean DEFAULT TRUE
);
COPY my_table FROM STDIN WITH DELIMITER AS '|';
\N|\N|\N
\.
using http://www.sunfreeware.com complied postgres
postgresql-8.0.1-sol8-sparc-local
on SunOS cawncknms 5.8 Generic_117350-11 sun4u sparc SUNW,Ultra-Enterprise
"Eric McGough" <emcgough@yahoo.com> writes:
> -- This table and COPY command should result in all
> -- three columns defaulting to TRUE based on NULL
> -- inputs, but they all result in FALSE. Not sure why?
No, it's filling with NULL, which is what the input specifies.
regards, tom lane
On Tue, Apr 05, 2005 at 21:11:12 +0100, Eric McGough <emcgough@yahoo.com> wrote: > > COPY my_table FROM STDIN WITH DELIMITER AS '|'; > \N|\N|\N > \. COPY doesn't provide a way to use default values for just some rows. You can get the default for a column by leaving it out of an explicit column list. But that will apply for all rows.
I made a mistake. Postgres does put a NULL in the field (albiet I would still like to see postgres/COPY change the NULL to TRUE if DEFAULT is set to true), it appears pgAdmin III version 1.2.0 is the one displaying a boolean NULL as FALSE (as opposed to NULL). Sorry for not testing a little bit more before posting. Thanks to all of you who responded. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com