Re:

From: AI Rumman <rummandba(at)gmail(dot)com>
To: Carlos Henrique Reimer <carlos(dot)reimer(at)opendb(dot)com(dot)br>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2013-05-15 19:24:48
Message-ID: CAGoODpeibMzgRvszDD-GDH3Qm_8E3ry1tJYp4VoFvHA46tD5-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Create the functions:
CREATE FUNCTION pg_catalog.text(integer) RETURNS text STRICT IMMUTABLE
LANGUAGE SQL AS 'SELECT textin(int4out($1));';
CREATE CAST (integer AS text) WITH FUNCTION pg_catalog.text(integer) AS
IMPLICIT;
http://www.rummandba.com/2010/10/migrate-database-from-postgresql-81-to.html

It'll work.

On Wed, May 15, 2013 at 3:17 PM, Carlos Henrique Reimer <
carlos(dot)reimer(at)opendb(dot)com(dot)br> wrote:

> Hi,
>
> Currently, our application is still using PG 8.2 and we are trying to use
> 9.2 but there are some problems related with the implicit casts removed on
> 8.3.
>
> Example:
>
> 1) select 'teste'||1;
> 2) select trim(1);
>
> Select 1 & 2 does run fine on 8.2 but in 9.2 select 1 is ok and select 2
> got an error due the fact implicit cast were removed on PG 8.3:
>
> ERROR: function pg_catalog.btrim(integer) does not exist
> LINE 1: select trim(1);
> ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> ********** Error **********
>
> ERROR: function pg_catalog.btrim(integer) does not exist
> SQL state: 42883
> Hint: No function matches the given name and argument types. You might
> need to add explicit type casts.
> Character: 8
>
> Recreated the implicit cast for select 2:
>
> CREATE FUNCTION pg_catalog.text(integer) RETURNS text STRICT IMMUTABLE
> LANGUAGE SQL AS 'SELECT textin(int4out($1));';
> CREATE CAST (integer AS text) WITH FUNCTION pg_catalog.text(integer) AS
> IMPLICIT;
>
> Now select 2 works fine but select 1 gets an error:
>
> ERROR: operator is not unique: unknown || integer
> LINE 1: select 'teste'||1;
> ^
> HINT: Could not choose a best candidate operator. You might need to add
> explicit type casts.
>
> ********** Error **********
>
> ERROR: operator is not unique: unknown || integer
> SQL state: 42725
> Hint: Could not choose a best candidate operator. You might need to add
> explicit type casts.
> Character: 15
>
>
> Is there a way to make both selects work on PG 9.2 without explicit casts?
>
> Thank you in advace!
>
> --
> Reimer
> 47-3347-1724 47-9183-0547 msn: carlos(dot)reimer(at)opendb(dot)com(dot)br
>

In response to

  • at 2013-05-15 19:17:11 from Carlos Henrique Reimer

Responses

  • Re: at 2013-05-15 19:41:30 from Carlos Henrique Reimer

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Henrique Reimer 2013-05-15 19:41:30 Re:
Previous Message Carlos Henrique Reimer 2013-05-15 19:17:11