pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to cast, if type has spaces in the name
4+ messages / 3 participants
[nested] [flat]
* How to cast, if type has spaces in the name
@ 2007-07-26 07:33 Bryce Nesbitt <bryce1@obviously.com>
2007-07-26 07:39 ` Re: How to cast, if type has spaces in the name A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-26 07:42 ` Re: How to cast, if type has spaces in the name A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-26 15:00 ` Re: How to cast, if type has spaces in the name Stephan Szabo <sszabo@megazone.bigpanda.com>
0 siblings, 3 replies; 4+ messages in thread
From: Bryce Nesbitt @ 2007-07-26 07:33 UTC (permalink / raw)
To: pgsql-sql
How do I specify a cast, if the type name has spaces? foo::integer is
easy,
but foo::'timestamp without time zone' is more murky.
In my case I have a table, and a view. For no apparent reason the table
has
timestamp without time zone, but I need timestamp with time zone.
I'm using "select column at time zone 'PST8PDT'" to solve this problem.
But wonder
about the general case of typecasting when the type name is not a single
symbol.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to cast, if type has spaces in the name
2007-07-26 07:33 How to cast, if type has spaces in the name Bryce Nesbitt <bryce1@obviously.com>
@ 2007-07-26 07:39 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2 siblings, 0 replies; 4+ messages in thread
From: A. Kretschmer @ 2007-07-26 07:39 UTC (permalink / raw)
To: pgsql-sql
am Thu, dem 26.07.2007, um 0:33:09 -0700 mailte Bryce Nesbitt folgendes:
> How do I specify a cast, if the type name has spaces? foo::integer is
> easy,
> but foo::'timestamp without time zone' is more murky.
Use timestamp instead ;-)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to cast, if type has spaces in the name
2007-07-26 07:33 How to cast, if type has spaces in the name Bryce Nesbitt <bryce1@obviously.com>
@ 2007-07-26 07:42 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2 siblings, 0 replies; 4+ messages in thread
From: A. Kretschmer @ 2007-07-26 07:42 UTC (permalink / raw)
To: pgsql-sql
am Thu, dem 26.07.2007, um 0:33:09 -0700 mailte Bryce Nesbitt folgendes:
> How do I specify a cast, if the type name has spaces? foo::integer is
> easy,
> but foo::'timestamp without time zone' is more murky.
Hehe, it works without the ', see:
test=# select '2007-01-01'::timestamp without time zone;
timestamp
---------------------
2007-01-01 00:00:00
(1 row)
test=*# select '2007-01-01'::timestamp with time zone;
timestamptz
------------------------
2007-01-01 00:00:00+01
(1 row)
ndreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to cast, if type has spaces in the name
2007-07-26 07:33 How to cast, if type has spaces in the name Bryce Nesbitt <bryce1@obviously.com>
@ 2007-07-26 15:00 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2 siblings, 0 replies; 4+ messages in thread
From: Stephan Szabo @ 2007-07-26 15:00 UTC (permalink / raw)
To: Bryce Nesbitt <bryce1@obviously.com>; +Cc: pgsql-sql
On Thu, 26 Jul 2007, Bryce Nesbitt wrote:
> How do I specify a cast, if the type name has spaces? foo::integer is
> easy,
> but foo::'timestamp without time zone' is more murky.
foo::timestamp without time zone should work (no quotes). Another
alternative if you don't like the way that looks is to use the SQL cast
syntax, CAST(foo AS timestamp without time zone).
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-07-26 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 07:33 How to cast, if type has spaces in the name Bryce Nesbitt <bryce1@obviously.com>
2007-07-26 07:39 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-26 07:42 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-07-26 15:00 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
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