Table B-1 lists all tokens that are key words in the SQL standard and in PostgreSQL 7.1.3. Background information can be found in Section 1.1.1.
SQL distinguishes between reserved and non-reserved key words. Reserved key words are the only real key words; they are never allowed as identifiers. Non-reserved key words only have a special meaning in particular contexts and can be used as identifiers in other contexts. Most non-reserved key words are actually the names of built-in tables and functions specified by SQL and the concept of non-reserved key words essentially only exists to declare that some predefined meaning is attached to a word in some contexts.
In the PostgreSQL parser life is a bit more complicated. There are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. (The latter is usually the case for functions specified by SQL.) Most SQL reserved key words are not completely reserved in PostgreSQL, but can be used as column label (as in SELECT 55 AS CHECK, even though CHECK is a reserved key word).
In Table B-1 in the column for PostgreSQL we classify as "non-reserved" those key words that are explicitly known to the parser but are allowed in most or all contexts where an identifier is expected. Labeled "reserved" are those tokens that are only allowed as "AS" column label names (and perhaps in very few other contexts). The token AS is the only exception: it cannot even be used as a column label. As a general rule, if you get spurious parser errors for commands that contain any of the listed key words as an identifier you should try to quote the identifier to see if the problem goes away.
It is important to understand before studying Table B-1 that the fact that a key word is not reserved in PostgreSQL does not mean that the feature related to the word is not implemented. Conversely, the presence of a key word does not indicate the existence of a feature.
Table B-1. SQL Key Words
| Key Word | PostgreSQL | SQL 99 | SQL 92 |
|---|---|---|---|
| ABORT | reserved | ||
| ABS | non-reserved | ||
| ABSOLUTE | non-reserved | reserved | reserved |
| ACCESS | non-reserved | ||
| ACTION | non-reserved | reserved | reserved |
| ADA | non-reserved | non-reserved | |
| ADD | non-reserved | reserved | reserved |
| ADMIN | reserved | ||
| AFTER | non-reserved | reserved | |
| AGGREGATE | non-reserved | reserved | |
| ALIAS | reserved | ||
| ALL | reserved | reserved | reserved |
| ALLOCATE | reserved | reserved | |
| ALTER | non-reserved | reserved | reserved |
| ANALYSE | reserved | ||
| ANALYZE | reserved | ||
| AND | reserved | reserved | reserved |
| ANY | reserved | reserved | reserved |
| ARE | reserved | reserved | |
| ARRAY | reserved | ||
| AS | reserved | reserved | reserved |
| ASC | reserved | reserved | reserved |
| ASENSITIVE | non-reserved | ||
| ASSERTION | reserved | reserved | |
| ASSIGNMENT | non-reserved | ||
| ASYMMETRIC | non-reserved | ||
| AT | non-reserved | reserved | reserved |
| ATOMIC | non-reserved | ||
| AUTHORIZATION | reserved | reserved | |
| AVG | non-reserved | reserved | |
| BACKWARD | non-reserved | ||
| BEFORE | non-reserved | reserved | |
| BEGIN | non-reserved | reserved | reserved |
| BETWEEN | reserved | non-reserved | reserved |
| BINARY | reserved | reserved | |
| BIT | reserved |