Re: [SQL] How to cast, if type has spaces in the name

2007-07-26 Thread Stephan Szabo
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).

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [SQL] How to cast, if type has spaces in the name

2007-07-26 Thread A. Kretschmer
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

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] How to cast, if type has spaces in the name

2007-07-26 Thread A. Kretschmer
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

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


[SQL] How to cast, if type has spaces in the name

2007-07-26 Thread Bryce Nesbitt
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.


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings