Re: - operator overloading not giving expected result

From: Rajesh S <rajesh(dot)s(at)fincuro(dot)com>
To: Ravi Krishna <s_ravikrishna(at)aol(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: - operator overloading not giving expected result
Date: 2022-07-11 11:13:34
Message-ID: 627fb755-dc3a-9873-f54e-1e7e72096e2e@fincuro.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

Thank you for your valuable comments and suggestions.  As it was pointed
out we are using EDB Postgres and the language was mentioned as
'edbspl'.  We made to work by setting the search_path variable as follows:

set search_path="$user", public, pg_catalog

And also changed the Operator overloading function as below. This gave
us the expected results.  Thanks once again for all your comments. 
Consider this thread as closed.

CREATE OR REPLACE FUNCTION public.dt_minus_dt(dt1 DATE, dt2 DATE)
RETURNS INTEGER as
$$
    SELECT (to_char(dt1::date,'J'::varchar) -
to_char(dt2::date,'J'::varchar))::integer
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE COST 1;

CREATE OPERATOR public.- (
  PROCEDURE = dt_minus_dt,
  LEFTARG = DATE,
  RIGHTARG = DATE
);

Thanks,

Rajesh S

On 08-07-2022 08:05 pm, Ravi Krishna wrote:
> LANGUAGE 'edbspl'
>
> This is the root cause of your issue.
>
>
> You are not using PGSQL, but EDB version of it which is compatible with Oracle PL/SQL.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mladen Gogala 2022-07-11 12:31:49 Re: Get the table creation DDL
Previous Message Rob Sargent 2022-07-11 10:07:00 Re: PostgreSQL 14.4 ERROR: out of memory issues