Mark Harrison
Mark Harrison

Reputation: 304654

How can I programmatically generate the list of canonical Postgresql keywords?

How can I obtain the list of Postgres keywords? Failing a programmatic solution, where can I look inside the Postgres project to get this list?

Context: for use in a code generation tool.

Upvotes: 0

Views: 62

Answers (1)

Guillaume Outters
Guillaume Outters

Reputation: 1609

In the source of PostgreSQL,
you will see that doc/src/sgml/generate-keywords-table.pl combines the contents of:

You can even run it directly from the source tree:

perl ./doc/src/sgml/generate-keywords-table.pl doc/src/sgml |
    sed -e '/<token>/!d' -e 's/ *<[^>]*>//g' -e 's/&zwsp;//g'

Upvotes: 0

Related Questions