pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Jon Collette <jon@etelos.com>
To: pgsql-sql@postgresql.org
Subject: Re: Boolean without default declared
Date: Wed, 15 Aug 2007 12:23:58 -0700 (PDT)
Message-ID: <775216.56005.qm@web31807.mail.mud.yahoo.com> (raw)
In-Reply-To: <46C349EA.5050201@etelos.com>


--- Jon Collette <jon@etelos.com> wrote:

> If a column with a boolean datatype doesn't have a default value.  What 
> type of value is set if nothing is inserted into that column?  Here is 
> my test table and the queries I have tried.  I can't seem to be able to 
> select the rows where happy has no value.
> 
> *select * from users where happy = '';*
> ERROR:  invalid input syntax for type boolean: ""

Databases have three value logic in it expressions.

is the expression true,
is the expression false,
is the expreassion unknown i.e. null.

SELECT * FROM users WHERE happy IS NULL;

UPDATE users SET happy = false WHERE happy IS NULL;

ALTER TABLE USER ALTER COLUMN happy SET NOT NULL;

Regards,
Richard Broersma Jr.



view thread (4+ messages)  latest in thread

Message-ID: <775216.56005.qm@web31807.mail.mud.yahoo.com>
Permalink:  ../775216.56005.qm@web31807.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/775216.56005.qm@web31807.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rabroersma@yahoo.com, jon@etelos.com
  Subject: Re: Boolean without default declared
  In-Reply-To: <775216.56005.qm@web31807.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox