Website hosting service by Active-Venture.com
  

 Back to Index

Appendix B. SQL Key Words

Table B-1 lists all tokens that are key words in the SQL standard and in PostgreSQL 7.3. Background information can be found in Section 1.1.1.

SQL distinguishes between reserved and non-reserved key words. According to the standard, 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. 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.) Even reserved key words are not completely reserved in PostgreSQL, but can be used as column labels (for example, 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. Some key words that are otherwise non-reserved cannot be used as function or data type names and are marked accordingly. (Most of these words represent built-in functions or data types with special syntax. The function or type is still available but it cannot be redefined by the user.) Labeled "reserved" are those tokens that are only allowed as "AS" column label names (and perhaps in very few other contexts). Some reserved key words are allowable as names for functions; this is also shown in the table.

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 non-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 non-reserved reserved reserved
ASSIGNMENT non-reserved non-reserved  
ASYMMETRIC   non-reserved  
AT non-reserved reserved reserved
ATOMIC   non-reserved  
AUTHORIZATION reserved (can be function) reserved reserved
AVG   non-reserved reserved
BACKWARD non-reserved    
BEFORE non-reserved reserved  
BEGIN non-reserved reserved reserved
BETWEEN reserved (can be function) non-reserved reserved
BIGINT non-reserved (cannot be function or type)    
BINARY reserved (can be function) reserved  
BIT non-reserved (cannot be function or type) reserved reserved
BITVAR   non-reserved  
BIT_LENGTH   non-reserved reserved
BLOB   reserved  
BOOLEAN non-reserved (cannot be function or type) reserved  
BOTH reserved reserved reserved
BREADTH   reserved  
BY non-reserved reserved reserved
C   non-reserved non-reserved
CACHE non-reserved    
CALL   reserved  
CALLED non-reserved non-reserved  
CARDINALITY   non-reserved  
CASCADE non-reserved reserved reserved
CASCADED   reserved reserved
CASE reserved reserved reserved
CAST reserved reserved reserved
CATALOG   reserved reserved
CATALOG_NAME   non-reserved non-reserved
CHAIN non-reserved non-reserved  
CHAR non-reserved (cannot be function or type) reserved reserved
CHARACTER non-reserved (cannot be function or type) reserved reserved
CHARACTERISTICS non-reserved    

 

 

© 2002-2003 Active-Venture.com Affordable web hosting

 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://www.postgresql.org/docs/

 

Cheap web hosting 
with comprehensive free services

Domain name registration -
Register domain name and
domain transfer from $7.95/year only