BUG #19948: Unqualified prefix <= operator is rejected despite being first in search_path

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: imchifan(at)mail(dot)com
Subject: BUG #19948: Unqualified prefix <= operator is rejected despite being first in search_path
Date: 2026-11-25 17:26:07
Message-ID: 19948-d4e824bbcd8c4fee@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19948
Logged by: Faye
Email address: imchifan(at)mail(dot)com
PostgreSQL version: 19.0
Operating system: Linux/amd64
Description:

Hi,

A user-defined prefix operator named <= can be created and invoked with
qualified OPERATOR(...) syntax, but the equivalent unqualified expression is
rejected with SQLSTATE 42601 even when its schema is first in search_path.

The following can be run as a superuser with psql -X -f repro.sql:

BEGIN;

CREATE SCHEMA ops;

CREATE FUNCTION ops.unary_le(integer)
RETURNS boolean
LANGUAGE sql
IMMUTABLE STRICT
AS 'SELECT $1 <= 10';

CREATE OPERATOR ops.<= (
FUNCTION = ops.unary_le,
RIGHTARG = integer
);

SET LOCAL search_path = ops, pg_catalog;

SELECT OPERATOR(ops.<=) 5 AS qualified_prefix_works;

DO $test$
BEGIN
BEGIN
EXECUTE 'SELECT <= 5';
RAISE EXCEPTION 'unqualified prefix <= unexpectedly parsed';
EXCEPTION
WHEN SQLSTATE '42601' THEN
RAISE NOTICE 'unqualified prefix <= rejected with SQLSTATE 42601';
END;
END
$test$;

ROLLBACK;

The relevant output is:

qualified_prefix_works
------------------------
t
(1 row)

NOTICE: unqualified prefix <= rejected with SQLSTATE 42601

The successful qualified invocation shows that the prefix operator is valid
and visible. PostgreSQL's documentation permits prefix operators and lists
<= among valid operator spellings, so the unqualified prefix expression
should parse and resolve through search_path as other user-defined prefix
operators do.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kacper Kuras 2026-11-25 17:27:21 Re: BUG #18754: Logical replication cannot restart if client sent a copyDone
Previous Message PG Bug reporting form 2026-11-25 17:22:24 BUG #19947: Rules see parent generated expression instead of routed partition's expression