Re: pure parsers and reentrant scanners

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-16T07:39:06Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Return yyparse() result not via global variable

  2. Remove flex version checks

  3. Drop warning-free support for Flex 2.5.35

  4. plpgsql: pure parser and reentrant scanner

  5. flex code modernization: Replace YY_EXTRA_TYPE define with flex option

  6. guc: reentrant scanner

  7. jsonpath scanner: reentrant scanner

  8. syncrep parser: pure parser and reentrant scanner

  9. replication parser: pure parser and reentrant scanner

  10. bootstrap: pure parser and reentrant scanner

  11. Small whitespace improvement

  12. Prevent redeclaration of typedef yyscan_t

  13. seg: pure parser and reentrant scanner

  14. cube: pure parser and reentrant scanner

Attachments

On 02.12.24 10:46, Peter Eisentraut wrote:
> This patch series changes several parsers in the backend and contrib 
> modules to use bison pure parsers and flex reentrant scanners. This is 
> ultimately toward thread-safety, but I think it's also just nicer in 
> general, and it might also fix a few possible small memory leaks.

I did a bit more work on this, so here is an updated patch set.

> Not done yet:
> * src/backend/utils/misc/guc-file.l
> * src/pl/plpgsql/src/pl_gram.y

I converted both of these scanners to reentrant, but I haven't done the 
plpgsql parser yet.

> Not relevant for backend thread-safety:
> * src/backend/bootstrap/
> 
> It might make sense to eventually covert that one as well, just so that 
> the APIs are kept similar. But that could be for later.

I have done this one.

I'll leave it at this for now and wait for some reviews.