Tom Lane wrote:This looks quite similar to my proposal. I called it "function body is enclosed in keywords", while Bruce will enclose it in new quote strings. This is obviously very different for the lexer/parser, while identical for the user. Sounds good to me.
The discussion so far today seems to be entirely a rehash of arguments
already made (and in many cases already rebutted). Rather than wasting
list bandwidth with this, I think each camp ought to go off and do their
homework. Give us *details* of how your solution would work.
Another idea would be to enable another set of quoting characters, like:
CREATE FUNCTION xx ... <-- x = 'fred'; ... -->
and have the lexer understand those new quoting characters. We just use '' too much in function bodies to use that also for quoting the function text. Of course, '<--' would have no special meaning inside a quoted string, so we are only eliminating their use as custom operators, and I think that is reasonable.
Having heard all the other proposals, I think this will be the clearest.
The quoting strings seem a bit suspicious to me, I can imagine comments like this "converting abc --> def", which would certainly break the function definition (I scanned a part of my sources, I found two occurrences of "-->", one of them in SQL code...)
How about quoting strings that look like keywords, e.g. FUNCTIONBODY and ENDFUNCTIONBODY?
CREATE FUNCTION foo() RETURNS int4 AS FUNCTIONBODY DECLARE bar int4; BEGIN RETURN bar; END; ENDFUNCTIONBODY LANGUAGE 'plpgsql';
Regards, Andreas
Regards, Andreas
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster