mirror of
https://github.com/postgres/postgres.git
synced 2026-01-27 21:43:08 +03:00
psql: Refine lexing of BEGIN...END blocks in CREATE FUNCTION statements
Only track BEGIN...END blocks if they are in a CREATE [OR REPLACE]
{FUNCTION|PROCEDURE} statement. Ignore if in parentheses.
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://www.postgresql.org/message-id/cee01d26fe55bc086b3bcf10bfe4e8d450e2f608.camel@cybertec.at
This commit is contained in:
@@ -114,8 +114,14 @@ typedef struct PsqlScanStateData
|
||||
int paren_depth; /* depth of nesting in parentheses */
|
||||
int xcdepth; /* depth of nesting in slash-star comments */
|
||||
char *dolqstart; /* current $foo$ quote start string */
|
||||
|
||||
/*
|
||||
* State to track boundaries of BEGIN ... END blocks in function
|
||||
* definitions, so that semicolons do not send query too early.
|
||||
*/
|
||||
int identifier_count; /* identifiers since start of statement */
|
||||
int begin_depth; /* depth of begin/end routine body blocks */
|
||||
char identifiers[4]; /* records the first few identifiers */
|
||||
int begin_depth; /* depth of begin/end pairs */
|
||||
|
||||
/*
|
||||
* Callback functions provided by the program making use of the lexer,
|
||||
|
||||
Reference in New Issue
Block a user