mo-sql-parsing icon indicating copy to clipboard operation
mo-sql-parsing copied to clipboard

Postgres allows adding new operators

Open klahnakoski opened this issue 5 months ago • 0 comments

As per https://github.com/klahnakoski/mo-sql-parsing/issues/248:

These are operators so the problem is actually more generic, since it is possible to define new operators: https://www.postgresql.org/docs/current/sql-createoperator.html

For instance this works on PostgreSQL 16:

CREATE FUNCTION DELETEME(INT, INT) RETURNS BOOLEAN AS $$ SELECT TRUE $$ LANGUAGE SQL; CREATE OPERATOR =///+-= (LEFTARG = int, RIGHTARG = int, FUNCTION = deleteme); SELECT 42 WHERE 1=///+-=2;

It returns 42 as expected.

klahnakoski avatar Sep 08 '24 15:09 klahnakoski