Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id ABF8F9FB48D for ; Wed, 15 Aug 2007 16:24:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 51962-03-2 for ; Wed, 15 Aug 2007 16:24:00 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web31807.mail.mud.yahoo.com (web31807.mail.mud.yahoo.com [68.142.207.70]) by postgresql.org (Postfix) with SMTP id CD5289FB3D8 for ; Wed, 15 Aug 2007 16:23:59 -0300 (ADT) Received: (qmail 56238 invoked by uid 60001); 15 Aug 2007 19:23:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=jIOSOvyMJ6H8lx3aZ08y8LJ0plA2Mhp1V4NMz8Vz4aBCmQjCioITs7RlDKw1Bet/yjXovzgil8Z6T1nG25flKabGcnmE7m9NRAHICe6qflrK4gDSAw8EQ7E6cHumeaHP0B64VCmUyx07HbjunIOSwpxkfHA0NpCwjehCVq1GvAw=; X-YMail-OSG: l_UJMtwVM1l1SIdruFgGPsicv2TrvCHPMkjROGoeJDq2n3AC Received: from [12.180.237.138] by web31807.mail.mud.yahoo.com via HTTP; Wed, 15 Aug 2007 12:23:58 PDT Date: Wed, 15 Aug 2007 12:23:58 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Boolean without default declared To: Jon Collette , pgsql-sql@postgresql.org In-Reply-To: <46C349EA.5050201@etelos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <775216.56005.qm@web31807.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/130 X-Sequence-Number: 29068 --- Jon Collette 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.