pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carolyn Lu Wong <carolyn@kss.net.au>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: SQL question
Date: Mon, 17 Jul 2000 12:07:25 +1000
Message-ID: <39726A5C.B6B45856@kss.net.au> (raw)

I have table with the following definition:

	create table table1(
		account_no	int4,
		start_date_tme	datetime
		....
	);

The table may contain null values for start_date_time.

When I run the following SQL query, it fails:

	select * from table1
	where start_date_time::date >= '01/01/2000'::date 
	and start_date_time::date <= '01/01/2001'::date;

I get error message 'Unable to convert null datetime to date.

It's fine if I run the same SQL query with added condition as follows:

	select * from table1
>	where account_no = 1
	and start_date_time::date >= '01/01/2000'::date 
	and start_date_time::date <= '01/01/2001'::date;

Is this a bug? Or there's an logical explaination for this?



view thread (19+ messages)  latest in thread

Message-ID: <39726A5C.B6B45856@kss.net.au>
Permalink:  ../39726A5C.B6B45856@kss.net.au/
Also on:    postgresql.org/message-id/39726A5C.B6B45856@kss.net.au

 · 

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: carolyn@kss.net.au
  Subject: Re: SQL question
  In-Reply-To: <39726A5C.B6B45856@kss.net.au>

* 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