Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D2DB51337B69 for ; Tue, 10 May 2011 17:36:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 65939-06 for ; Tue, 10 May 2011 20:36:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from oldperseverance.encs.concordia.ca (oldperseverance.encs.concordia.ca [132.205.96.94]) by mail.postgresql.org (Postfix) with ESMTP id AD0441337B4E for ; Tue, 10 May 2011 17:36:46 -0300 (ADT) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by oldperseverance.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id p4AKajtJ006105; Tue, 10 May 2011 16:36:45 -0400 Message-ID: <4DC9A1DD.5070700@encs.concordia.ca> Date: Tue, 10 May 2011 16:36:45 -0400 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101125 Lightning/1.0b1 Thunderbird/3.0.11 MIME-Version: 1.0 To: John Fabiani CC: pgsql-sql@postgresql.org Subject: Re: Dates and NULL's` References: <201105100948.41392.johnf@jfcomputer.com> <201105101024.23612.johnf@jfcomputer.com> In-Reply-To: <201105101024.23612.johnf@jfcomputer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on oldperseverance.encs.concordia.ca at 2011/05/10 16:36:45 EDT X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/73 X-Sequence-Number: 35357 >>> Where mydate>= "2011/04/01"::date and mydate<= "2011/04/30"::date >>> With the above where will the NULL's be selected???? >> >> Here is what I get when I try: >> >> spi=> SELECT NULL::DATE>= '2011-04-01'::DATE AND NULL::DATE<= >> '2011-04-30'::DATE; >> ?column? >> ---------- >> >> (1 row) >> >> >> spi=> SELECT (NULL::DATE>= '2011-04-01'::DATE AND NULL::DATE<= >> '2011-04-30'::DATE) IS TRUE; >> ?column? >> ---------- >> f >> (1 row) >> >> >> spi=> SELECT (NULL::DATE>= '2011-04-01'::DATE AND NULL::DATE<= >> '2011-04-30'::DATE) IS FALSE; >> ?column? >> ---------- >> f >> (1 row) >> >> >> spi=> SELECT (NULL::DATE>= '2011-04-01'::DATE AND NULL::DATE<= >> '2011-04-30'::DATE) IS UNKNOWN; >> ?column? >> ---------- >> t >> (1 row) > Sorry Richard, I do not understand. > > It looks like you are saying the NULLS will be returned too As a summary: ============================================ (1) null:date COMPARE 'real date'::DATE Will always return NUll, so you will not get the record returned at all! (2) examples he provided: . (null:date COMPARE 'real date'::DATE) IS NULL; . (null:date COMPARE 'real date'::DATE) IS UNKNOWN; Null returns true. (3) null is true/false; returns false Emi