mo-sql-parsing
mo-sql-parsing copied to clipboard
Postgres allows adding new operators
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.