thanks for the answer. i get it too as
sum(int4(unidades::text))
Maybe somebody will need this answer too, so i want to add some info I get
from other list:
We can know wich CAST we have in our DB with this view:
create view showcasts as
select t.typname as source, t1.typname as target, p.proname as function,
(select case when c.castcontext = 'e'
then 'Must use Explicit Cast'
else ( select case when c.castcontext = 'i'
then 'Implicit cast for expressions and assignments'
else 'Implicit cast only for assignments'
end)
end ) as casttype
from pg_cast c, pg_type t, pg_type t1, pg_proc p
where c.castsource = t.oid and
c.casttarget = t1.oid and
c.castfunc = p.oid;
I hope this can be helpfull.
again thanks to all.
-----Mensaje original-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Enviado el: martes, 12 de julio de 2005 13:35
Para: Mauricio Fernandez
CC: [email protected]
Asunto: Re: [SQL] PostgreSQL - ERROR: Cannot cast type character varying to
integer
Under PostgreSQL 7.3 it was necessary
to use an intermediate cast to text
when converting from varchar to int4.
sum( unidades::text::int4 ) should do.
Regards, Christoph
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq