Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist

From: gzh <gzhcoder(at)126(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Erik Wienhold" <ewie(at)ewie(dot)name>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: psql:t_mstr.sql:994: ERROR: function to_char(numeric) does not exist
Date: 2023-04-25 11:34:56
Message-ID: 5027d9b9.7aad.187b831fb18.Coremail.gzhcoder@126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>The solution is the same whether you upgrade or not: you need
>to adjust your search_path to include the "oracle" schema,
>or else explicitly qualify references to orafce functions.Thank you very much for your help.

To use the to_date functions of Orafce 3.0.1, we created the following to_date function in the public schema of the old database.

-----
CREATE OR REPLACE FUNCTION to_date(str text) RETURNS date AS $$ SELECT $1::date; $$ LANGUAGE sql IMMUTABLE STRICT; COMMENT ON FUNCTION public.to_date(text) IS 'Convert string to date';
-----

To avoid using a to_date function with the same name and parameter in the pg_catalog schema first, the search_path of the old database is set as follows:

"$user", public, pg_catalog

Make sure that public is searched before pg_catalog.
After the database is upgraded, in order to solve the changes in Oracle 3.24, we have added oracle schema to the search_path, as shown below:

"$user", public, oracle, pg_catalog

The following error occurred when I ran my application.

42P13:ERROR:42P13: return type mismatch in function declared to return pg_catalog.date

When I put the oracle schema at the end of the search_path, the problem was solved.
The search_path settings without problems are as follows:

"$user", public, pg_catalog, oracle

Why does it report an error when i put oracle between public and pg_catalog?

At 2023-04-20 01:18:15, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>gzh <gzhcoder(at)126(dot)com> writes:
>> Thank you for your prompt reply.
>> Is there another solution if the database is not upgraded to 12.14?
>
>The solution is the same whether you upgrade or not: you need
>to adjust your search_path to include the "oracle" schema,
>or else explicitly qualify references to orafce functions.
>
> regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2023-04-25 12:41:45 DBD::Pg (version 3.16.3) returns EMPTY char columns as 'undef'
Previous Message Erik Wienhold 2023-04-25 11:29:23 Re: murmur3 hash binary data migration from Oracle to PostgreSQL