From: Mauricio Fernandez <mfacontacto@ono.com>
To: pgsql-sql@postgresql.org
Subject: Re: PostgreSQL - ERROR: Cannot cast type character varying to integer
Date: Tue, 12 Jul 2005 14:49:46 +0200
Message-ID: <MEEKIHGNNCKMHBAHDPNNEEELCDAA.mfacontacto@ono.com> (raw)
In-Reply-To: <42D3AACF.98C5629B@rodos.fzk.de>
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: ch@rodos.fzk.de [mailto:ch@rodos.fzk.de]
Enviado el: martes, 12 de julio de 2005 13:35
Para: Mauricio Fernandez
CC: pgsql-sql@postgresql.org
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mfacontacto@ono.com
Subject: Re: PostgreSQL - ERROR: Cannot cast type character varying to integer
In-Reply-To: <MEEKIHGNNCKMHBAHDPNNEEELCDAA.mfacontacto@ono.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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