Detailed explanation of adding keywords in PostgreSQL syntax, detailed explanation of postgresql
Add keywords in PostgreSQL syntax
When PostgreSQL's background process Postgres receives the query statement, it first passes it to the query analysis module for lexical, syntax, and semantic analysis.
Add keywords in the parser Syntax Parsing module.
Introduction to several core files
Source File |
Description |
Gram. y |
Define the syntax structure. After bison is compiled, generate gram. y and gram. h. |
Scan. l |
Define the lexical structure. After flex is compiled, scan. c is generated. |
Kwlist. h |
Keyword list, which needs to be sorted in order |
Check_keywords.pl |
In linux, it will be called for keyword check (Order, legitimacy, etc) |
Add keywords in syntax
- In gram. y, % token <keyword> is added with the keyword PARTITIONS.
- Add the keyword PARTITIONS to the reserved_keyword segment of the gram. y file.
- Kwlist. h file, add statement: PG_KEYWORD ("partitions", PARTITIONS, UNRESERVED_KEYWORD)
The above is the keyword added in the PostgreSQL syntax. If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article and hope to help you. Thank you for your support for this site!