pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCasting numeric to text
7+ messages / 4 participants
[nested] [flat]
* Casting numeric to text
@ 2001-04-06 11:08 Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 7+ messages in thread
From: Hans-Jürgen Schönig @ 2001-04-06 11:08 UTC (permalink / raw)
To: pgsql-sql
Is there any possibility to cast numeric to text in Postgres 7.0.3?
shop=# select cast(price as text) from products;
ERROR: Cannot cast type 'numeric' to 'text'
Hans
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
@ 2001-04-08 10:05 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Re: Casting numeric to text Cedar Cox <cedarc@visionforisrael.com>
0 siblings, 1 reply; 7+ messages in thread
From: Peter Eisentraut @ 2001-04-08 10:05 UTC (permalink / raw)
To: Hans-Jürgen Schönig <hs@cybertec.at>; +Cc: pgsql-sql
Hans-Jürgen Schönig writes:
> Is there any possibility to cast numeric to text in Postgres 7.0.3?
>
> shop=# select cast(price as text) from products;
> ERROR: Cannot cast type 'numeric' to 'text'
Use the to_char() function.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
@ 2001-04-08 23:20 ` Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 15:57 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 7+ messages in thread
From: Cedar Cox @ 2001-04-08 23:20 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: Hans-Jürgen Schönig <hs@cybertec.at>; pgsql-sql
On Sun, 8 Apr 2001, Peter Eisentraut wrote:
> Hans-Jürgen Schönig writes:
>
> > Is there any possibility to cast numeric to text in Postgres 7.0.3?
> >
> > shop=# select cast(price as text) from products;
> > ERROR: Cannot cast type 'numeric' to 'text'
>
> Use the to_char() function.
When would one want to use cast()? What is the difference between cast
and :: ? After a quick look in the documentation I couldn't find
anything..
-Cedar
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Re: Casting numeric to text Cedar Cox <cedarc@visionforisrael.com>
@ 2001-04-09 15:57 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-09 16:26 ` Re: Casting numeric to text Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Peter Eisentraut @ 2001-04-09 15:57 UTC (permalink / raw)
To: Cedar Cox <cedarc@visionforisrael.com>; +Cc: Hans-Jürgen Schönig <hs@cybertec.at>; pgsql-sql
Cedar Cox writes:
> When would one want to use cast()? What is the difference between cast
> and :: ? After a quick look in the documentation I couldn't find
> anything..
cast() is SQL, :: is traditional Postgres. :: may go away in the distant
future to make room for the SQL feature that is supposed to use ::. (It
escapes me at the moment what that was.)
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Re: Casting numeric to text Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 15:57 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
@ 2001-04-09 16:26 ` Ross J. Reedstrom <reedstrm@rice.edu>
2001-04-09 16:53 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 7+ messages in thread
From: Ross J. Reedstrom @ 2001-04-09 16:26 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: Cedar Cox <cedarc@visionforisrael.com>; Hans-Jürgen Schönig <hs@cybertec.at>; pgsql-sql
On Mon, Apr 09, 2001 at 05:57:45PM +0200, Peter Eisentraut wrote:
> Cedar Cox writes:
>
> > When would one want to use cast()? What is the difference between cast
> > and :: ? After a quick look in the documentation I couldn't find
> > anything..
>
> cast() is SQL, :: is traditional Postgres. :: may go away in the distant
> future to make room for the SQL feature that is supposed to use ::. (It
> escapes me at the moment what that was.)
FYI, I can't find an occurance of '::' that's not part of '::=' in either
SQL1992.txt or the ansi-iso-[sql]-1999.txt files I've got.
But Peter's answer's still correct: CAST( <value> AS <type> ) is SQL
standard, '::' is not.
Ross
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Re: Casting numeric to text Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 15:57 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-09 16:26 ` Re: Casting numeric to text Ross J. Reedstrom <reedstrm@rice.edu>
@ 2001-04-09 16:53 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-09 17:02 ` Re: Casting numeric to text Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Peter Eisentraut @ 2001-04-09 16:53 UTC (permalink / raw)
To: Ross J. Reedstrom <reedstrm@rice.edu>; +Cc: Cedar Cox <cedarc@visionforisrael.com>; Hans-Jürgen Schönig <hs@cybertec.at>; pgsql-sql
Ross J. Reedstrom writes:
> FYI, I can't find an occurance of '::' that's not part of '::=' in either
> SQL1992.txt or the ansi-iso-[sql]-1999.txt files I've got.
SQL 1999 6.12
<static method invocation> ::=
<user-defined type> <double colon> <method name> [ <SQL argument list> ]
That syntax even makes sense...
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Casting numeric to text
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Re: Casting numeric to text Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 15:57 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
2001-04-09 16:26 ` Re: Casting numeric to text Ross J. Reedstrom <reedstrm@rice.edu>
2001-04-09 16:53 ` Re: Casting numeric to text Peter Eisentraut <peter_e@gmx.net>
@ 2001-04-09 17:02 ` Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 0 replies; 7+ messages in thread
From: Ross J. Reedstrom @ 2001-04-09 17:02 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql
On Mon, Apr 09, 2001 at 06:53:13PM +0200, Peter Eisentraut wrote:
> Ross J. Reedstrom writes:
>
> > FYI, I can't find an occurance of '::' that's not part of '::=' in either
> > SQL1992.txt or the ansi-iso-[sql]-1999.txt files I've got.
>
> SQL 1999 6.12
>
> <static method invocation> ::=
> <user-defined type> <double colon> <method name> [ <SQL argument list> ]
>
Ah, right: My grep excluded the ::= cases, so I missed:
<double colon> ::= ::
> That syntax even makes sense...
No, how could it be? Someone must have failed to run the Babelizer on that part.
Ross
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2001-04-09 17:02 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-06 11:08 Casting numeric to text Hans-Jürgen Schönig <hs@cybertec.at>
2001-04-08 10:05 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-08 23:20 ` Cedar Cox <cedarc@visionforisrael.com>
2001-04-09 15:57 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-09 16:26 ` Ross J. Reedstrom <reedstrm@rice.edu>
2001-04-09 16:53 ` Peter Eisentraut <peter_e@gmx.net>
2001-04-09 17:02 ` Ross J. Reedstrom <reedstrm@rice.edu>
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