Re: typecasting numeric(18,4) to varchar/text

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: typecasting numeric(18,4) to varchar/text
Date: 2004-05-04 14:37:45
Message-ID: 20040504143745.GA10467@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, May 04, 2004 at 09:35:31AM -0400, ashok(at)kalculate(dot)com wrote:
> create table a (a numeric(18,4));
> create table b (b varchar(25));
> insert into a values(12000.43);
> insert into b select (a.a)::varchar;

Which version is that? Here's my session:

andrewtest=# create table a (a numeric(18,4));
CREATE TABLE
andrewtest=# create table b (b varchar(25));
CREATE TABLE
andrewtest=# insert into a values(12000.43);
INSERT 17168 1
andrewtest=# insert into b select (a.a)::varchar;
INSERT 17169 1

That's on 7.4.2. You might want to try casting to text first.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message scott.marlowe 2004-05-04 14:58:25 Re: invalid input syntax for integer: ""
Previous Message Andrei Bintintan 2004-05-04 14:37:24 Re: Database structure