dbTalk Databases Forums  

[BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eric McGough
 
Posts: n/a

Default [BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values - 04-10-2005 , 02:23 PM







The following bug has been logged online:

Bug reference: 1582
Logged by: Eric McGough
Email address: emcgough (AT) yahoo (DOT) 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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values - 04-10-2005 , 03:09 PM






"Eric McGough" <emcgough (AT) yahoo (DOT) com> writes:
Quote:
-- 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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #3  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: [BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values - 04-10-2005 , 09:07 PM



On Tue, Apr 05, 2005 at 21:11:12 +0100,
Eric McGough <emcgough (AT) yahoo (DOT) com> wrote:
Quote:
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.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #4  
Old   
Eric McGough
 
Posts: n/a

Default Re: [BUGS] BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values - 04-11-2005 , 01:08 PM



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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.