You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you notice the issue, it is that ANY is quoted, since the library thinks it is a keyword. Running this query nets you this error in postgres: [42883] ERROR: function any(jsonb[]) does not exist.
As an AST, the any is represented as a call node, and eventually ident gets called on it:
functionident(nm: string,forceDoubleQuote?: boolean){if(!forceDoubleQuote){// only add quotes if has upper cases, or if it is a keyword.constlow=nm.toLowerCase();if(low===nm&&!kwSet.has(low)&&/^[a-z][a-z0-9_]*$/.test(low)){returnnm;}}return'"'+nm+'"';}
kwSet includes any, so it gets quoted. The same issue would happen with SOME (an alias of ANY) and ALL.
After going over the codebase, I think it would be best to treat ANY, ALL and SOME as separate from keywords. They can still be considered keywords, but they should get their own visitor I think.
Another approach is to treat binary operators as things that can be modified with ANY or ALL. For instance:
Activity
mjburghoffer commentedon Jan 23, 2024
I think it is also worth updating this issue with the fact that surrounding an
ANYwith parenthesis is also not good.Valid:
Not valid:
mjburghoffer commentedon Jan 23, 2024
After going over the codebase, I think it would be best to treat
ANY,ALLandSOMEas separate from keywords. They can still be considered keywords, but they should get their own visitor I think.Another approach is to treat binary operators as things that can be modified with
ANYorALL. For instance:myOperatorwould render as something likeid @> ANY ($1)