forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit39bd3fd
committed
Modernize plpgsql's handling of parse locations, making it look a lot more
like the core parser's code. In particular, track locations at the characterrather than line level during parsing, allowing many more parse-time errorconditions to be reported with precise error pointers rather than just"near line N".Also, exploit the fact that we no longer need to substitute $N for variablereferences by making extracted SQL queries and expressions be exact copiesof subranges of the function text, rather than having random whitespacechanges within them. This makes it possible to directly map parse errorpositions from the core parser onto positions in the function text, whichlets us report them without the previous kluge of showing the intermediateinternal-query form. (Later it might be good to do that for coreparse-analysis errors too, but this patch is just touching plpgsql'slexer/parser, not what happens at runtime.)In passing, make plpgsql's lexer use palloc not malloc.These changes make plpgsql's parse-time error reports noticeably nicer(as illustrated by the regression test changes), and will also simplifythe planned removal of plpgsql's separate lexer by reducing the impedancemismatch between what it does and what the core lexer does.1 parentfb60af4 commit39bd3fd