Skip site navigation (1) Skip section navigation (2)

Re: CAST and timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: KeithW(at)NarrowPathInc(dot)com
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: CAST and timestamp
Date: 2004-12-21 04:02:37
Message-ID: 2331.1103601757@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Keith Worthington <KeithW(at)NarrowPathInc(dot)com> writes:
> Tom Lane wrote:
>> Try casting the inputs to type "text" and then to timestamp or real.

> Are you saying that I should try something like
> CAST( CAST( quantity AS text ) AS float4) AS quantity

Right.  (In the cases where you were concatenating, do that inside the
first cast.)

BTW, Postgres hackers would tend to write the above as

	quantity::text::float4

which is not SQL-spec notation but sure saves a lot of typing.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Mike GDate: 2004-12-21 04:08:17
Subject: Re: CAST and timestamp
Previous:From: Keith WorthingtonDate: 2004-12-21 03:48:43
Subject: Re: CAST and timestamp

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group