From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | Thomas Kellerer <spam_eater(at)gmx(dot)net>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: to_timestamp alternatives |
Date: | 2016-01-06 02:22:21 |
Message-ID: | 568C7A5D.1050605@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1/1/16 4:11 AM, Thomas Kellerer wrote:
> You only need to provide the text value to be casted (no format mask).
> Use only a single expression without those unnecessary parentheses:
>
> SELECT gmt_date||' '||lpad(gmt_time,8,'0')::timestamp
>
> You don't need the lpad() either:
>
> SELECT gmt_date||' '||gmt_time::timestamp
I suspect you need to wrap that in (). Even if the parser does the right
thing there, it'd certainly make the intent a lot clearer.
SELECT (gmt_date || ' ' || gmt_time)::timestamp
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2016-01-06 02:26:44 | Re: COPY FROM STDIN |
Previous Message | Jim Nasby | 2016-01-06 02:20:34 | Re: Getting the function definition from oid in before firing the function |