pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Wei Weng <wweng@kencast.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Cast NULL into Timestamp?
Date: Fri, 10 Dec 2004 16:48:24 -0800 (PST)
Message-ID: <20041210164721.A87803@megazone.bigpanda.com> (raw)
In-Reply-To: <41B9F808.2040909@kencast.com>
References: <41B9F808.2040909@kencast.com>

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.



view thread (5+ messages)  latest in thread

Message-ID: <20041210164721.A87803@megazone.bigpanda.com>
Permalink:  ../20041210164721.A87803@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20041210164721.A87803@megazone.bigpanda.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: sszabo@megazone.bigpanda.com, wweng@kencast.com
  Subject: Re: Cast NULL into Timestamp?
  In-Reply-To: <20041210164721.A87803@megazone.bigpanda.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