Sorry..

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Sorry..
Date: 2002-07-15 03:17:30
Message-ID: GNELIHDDFBOCMGBFGEFOAECDCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ignore previous half-completed email.

How do you get this to work in 7.2.1?

I'm creating a view of a table, but I'm trying to do something like
this:

create table t (
id integer not null,
amount numeric(7,2)
);

create view v as
select id as v_id,
'paid amount: ' || amount as v_comment
from t
;

You get this:

ERROR: Unable to identify an operator '||' for types 'unknown' and
'numeric'
You will have to retype this query using an explicit cast

None of these work:

CAST(amount AS text)
CAST(amount AS varchar)
CAST(amount AS char)
and this:
CAST(amount AS real) works, but if amount is 12.00, then you just get '12' -
which is not cool.

Any ideas?

Chris

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-07-15 03:27:41 Re: Sorry..
Previous Message Christopher Kings-Lynne 2002-07-15 03:15:08 Quick Question