X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6180E3AA1A0 for ; Sat, 11 Dec 2004 02:17:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72801-01 for ; Sat, 11 Dec 2004 02:16:24 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id A329F3A69CE for ; Sat, 11 Dec 2004 00:48:23 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1D02135920; Fri, 10 Dec 2004 16:48:24 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1B60535917; Fri, 10 Dec 2004 16:48:24 -0800 (PST) Date: Fri, 10 Dec 2004 16:48:24 -0800 (PST) From: Stephan Szabo To: Wei Weng Cc: "'pgsql-sql@postgresql.org'" Subject: Re: Cast NULL into Timestamp? In-Reply-To: <41B9F808.2040909@kencast.com> Message-ID: <20041210164721.A87803@megazone.bigpanda.com> References: <41B9F808.2040909@kencast.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/54 X-Sequence-Number: 19674 On Fri, 10 Dec 2004, Wei Weng wrote: > I have a table > > create table temp > ( > tempdate timestamp, > tempname varchar(10) > ); > > And I tried to insert the following: > > insert into table temp (tempname, tempdate) > select distinct 'tempname', null from some_other_relevant_table; > > And I got an error that says "column "tempdate" is of type timestamp ... but > expression is of type text... will need to rewrite or cast the expression". > > I really need the distinct. Is there anyway to cast this NULL into a > timestamp or any other workarounds? CAST(NULL as timestamp) should work.