Re: Autocast script of peter e in PostgreSQL 8.3

From: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Autocast script of peter e in PostgreSQL 8.3
Date: 2008-05-06 13:37:57
Message-ID: fvpmvi$gqp$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout schrieb:
> On Tue, May 06, 2008 at 02:09:30PM +0200, Daniel Schuchardt wrote:
>
>> *SCDS=# SELECT 1||'~'||1;
>> ERROR: operator is not unique: integer || unknown at character 9
>> HINT: Could not choose a best candidate operator. You might need to add
>> explicit type casts.
>> LINE 1: SELECT 1||'~'||1;
>>
>
> Check the archives. I think Tom pointed out that while it readds all
> the casts, some other changes were made for the '||' operator and you
> need to delete those. IIRC you need to manipuate the catalog tables
> directly for that.
>
> Have a nice day,
>

Hey Matijn,

it simply does not work. Every created CAST will crash with the '||'
operator.

Thnx for your comments,

Daniel.

DEMO1=# SELECT 1||'~'||1;
?column?
----------
1~1
(1 row)
DEMO1=# CREATE FUNCTION pg_catalog.text(integer) RETURNS text STRICT
IMMUTABLE LANGUAGE SQL AS 'SELECT textin(int4out($1));';
CREATE FUNCTION
DEMO1=# CREATE CAST (integer AS text) WITH FUNCTION
pg_catalog.text(integer) ASIMPLICIT;
CREATE CAST
DEMO1=# SELECT 1||'~'||1;
ERROR: operator is not unique: integer || unknown at character 9
HINT: Could not choose a best candidate operator. You might need to add
explicit type casts.
LINE 1: SELECT 1||'~'||1;

DEMO1=# SELECT 1.1||'~'||1.1;
?column?
----------
1.1~1.1
(1 row)
DEMO1=# CREATE FUNCTION pg_catalog.text(numeric) RETURNS text STRICT
IMMUTABLE LANGUAGE SQL AS 'SELECT textin(numeric_out($1));';
CREATE FUNCTION
DEMO1=# CREATE CAST (numeric AS text) WITH FUNCTION
pg_catalog.text(numeric) AS IMPLICIT;
CREATE CAST
DEMO1=# SELECT 1.1||'~'||1.1;
ERROR: operator is not unique: numeric || unknown at character 11
HINT: Could not choose a best candidate operator. You might need to add
explicit type casts.
LINE 1: SELECT 1.1||'~'||1.1;

DEMO1=# SELECT current_date||'~'||current_date;
?column?
-----------------------
2008-05-06~2008-05-06
(1 row)
DEMO1=# CREATE FUNCTION pg_catalog.text(date) RETURNS text STRICT
IMMUTABLE LANG
UAGE SQL AS 'SELECT textin(date_out($1));';
CREATE FUNCTION
DEMO1=# CREATE CAST (date AS text) WITH FUNCTION pg_catalog.text(date)
AS IMPLICIT;
CREATE CAST
DEMO1=# SELECT current_date||'~'||current_date;
ERROR: operator is not unique: date || unknown at character 20
HINT: Could not choose a best candidate operator. You might need to add
explicit type casts.
LINE 1: SELECT current_date||'~'||current_date;
^

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-05-06 14:59:58 Re: Autocast script of peter e in PostgreSQL 8.3
Previous Message Ivan Sergio Borgonovo 2008-05-06 13:07:11 storing long live parameters