sqlpostgresqlcode-generation

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.


Solution

  • 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'