Re: operator is only a shell - Error

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rajesh S <rajesh(dot)s(at)fincuro(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: operator is only a shell - Error
Date: 2024-03-18 15:50:11
Message-ID: c8dcf741-2c11-4f61-a246-9452007541f5@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/18/24 00:05, Rajesh S wrote:
> Thank you for your response.  Actually, I was trying to address the
> following query.
>
> select LIEN_AC_NO from deposit_lien where deposit_no='0002114029832' and
> deposit_sub_no='1' and unlien_dt is null and unlien_remarks is null;
>
> In the above query "deposit_sub_no" column is "numeric" type and passing
> '1' (as varchar).  To address this I'd created the function and operator
> as I'd mentioned in the earlier mail.  Even the following query throws
> error after creating the function and operator.
>
> select * from deposit_lien where deposit_no='0002114029832';
>
> ERROR: operator is only a shell: character varying = numeric LINE 1:
> select * from deposit_lien where deposit_no='0002114029832' ^ SQL state:
> 42883 Character: 44
>
> In the above query "deposit_no" column is having "varchar" data type.
> But before creating the function and operator it was working fine.
> Tried dropping the same, even though the same error.  How to proceed now?

Not clear to me what the problem is you are trying to solve?

On a stock Postgres install:

select 1::numeric = '1';
?column?
----------
t

select '0002114029832'::varchar = '0002114029832';
?column?
----------
t

>
>
> Thanks,
>
> Rajesh S
>
> On 15-03-2024 19:10, Greg Sabino Mullane wrote:
>> On Fri, Mar 15, 2024 at 6:26 AM Rajesh S <rajesh(dot)s(at)fincuro(dot)com> wrote:
>>
>> I wanted to implement a new "=" (equal) operator with LEFTARG as
>> numeric and RIGHTARG as varchar.  But after creating the function
>> and operator, psql shows the error "operator is only a shell:
>> character varying = numeric
>>
>> Your operator has numeric on the left and varchar on the right. But
>> your query is doing numeric on the RIGHT. Probably want to make a
>> matching one to cover both cases.
>>
>> Cheers,
>> Greg
>>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2024-03-18 18:41:12 Re: Single-User Mode oid assignment
Previous Message Greg Sabino Mullane 2024-03-18 14:47:43 Re: operator is only a shell - Error