On Sat, 17 Jul 2021 at 05:24, Bharath Rupireddy <bharath.rupireddyforpostg...@gmail.com> wrote: > > I also think that if it is specified as CREATE FUNCTION ... STRICT > STRICT, CREATE FUNCTION ... CALLED ON NULL INPUT RETURNS NULL ON NULL > INPUT etc. isn't the syntaxer catching that error while parsing the > SQL text, similar to CREATE COLLATION mycoll1 FROM FROM "C";?
No, they're processed quite differently. The initial parsing of CREATE FUNCTION allows an arbitrary list of things like STRICT, CALLED ON NULL INPUT, etc., which it turns into a list of DefElem that is only checked later on. That's the most natural way to do it, since this is really just a list of options that can appear in any order, much like the version of CREATE COLLATION that allows options in parentheses, which is quite different from the version that takes a single FROM. Reading the relevant portions of gram.y is probably the easiest way to understand it. It's actually quite instructive to search for "makeDefElem" in gram.y, and see all the places that create a DefElem that doesn't match the user-entered syntax. There are quite a few of them, and there may be others elsewhere. Regards, Dean