Sorry.. - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Sorry..
Date
Msg-id GNELIHDDFBOCMGBFGEFOAECDCDAA.chriskl@familyhealth.com.au
Whole thread Raw
Responses Re: Sorry..  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-sql by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Quick Question
Next
From: Tom Lane
Date:
Subject: Re: Sorry..