保留标识符和SQL关键字

保留标识符和SQL关键字

本主题描述了Greenplum数据库保留标识符和对象名称,以及Greenplum数据库和PostgreSQL命令解析器识别的SQL关键字。

保留标识符

在Greenplum数据库系统中,以gp_pg_开头的名称是保留的,不应用作用户创建的对象的名称,例如表,视图和函数。

资源组名称admin_groupdefault_groupnone都是保留的。 资源队列名称pg_default是保留的。

表空间名称pg_defaultpg_global是保留的。

角色名称gpadmingpmon是保留的。 gpadmin是默认的Greenplum数据库超级用户角色。 gpmon角色拥有gpperfmon数据库 。

在数据文件中,分隔字段(列)和行的字符具有特殊含义。 如果它们出现在数据中,则必须将它们转义,以便Greenplum数据库将它们视为数据而不是分隔符。 反斜杠字符(\)是默认的转义字符。 有关详细信息,请参见转义

有关SQL标识符,常量,运算符和表达式的更多信息,请参阅PostgreSQL文档中的SQL语法

SQL关键词

Table 1列出了所有token, 这些token是Greenplum数据库6和PostgreSQL 9.4中的关键词。

ANSI SQL区分保留和未保留的关键字。 根据标准,保留关键词是唯一真正的关键词; 永远不允许他们作为标识符。 未保留的关键词在特定上下文中仅具有特殊含义,并且可以在其他上下文中用作标识符。 大多数未保留的关键字实际上是SQL指定的内置表和函数的名称。 无保留关键词的概念基本上只存在于声明在某些上下文中某些预定义含义附加到单词上。

在Greenplum数据库和PostgreSQL解析器中,有几种不同类别的token, 从永远不能用作标识符的token到与普通标识符相比在解析器中完全没有特殊状态的token。 (后者通常是SQL指定的函数的情况。)即使保留的关键字也没有完全保留, 但可以用作列标签(例如,SELECT 55 AS CHECK,即使CHECK是保留关键字)。

Table 1将那些解析器明确知道但允许作为列或表名称的关键字归类为"unreserved"。 一些未经保留的关键字不能用作函数或数据类型名称,并相应标记。 (这些单词中的大部分代表具有特殊语法的内置函数或数据类型。函数或类型仍然可用,但用户无法重新定义。) 标记为“reserved”的关键字不允许作为列或表名。 一些保留的关键字可以作为函数或数据类型的名称; 这也显示在表中。 如果没有这么标记,则保留的关键字仅允许作为“AS”列标签名称。

如果您为包含任何列出的关键字作为标识符的命令获得虚假解析器错误,您应该尝试引用标识符以查看问题是否消失。

在研究表之前,请注意关键字未保留的事实并不意味着未实现与该字相关的特性。 相反,关键词的存在并不表示特性存在。

Table 1. SQL Key Words
关键字 Greenplum数据库 PostgreSQL 9.4
ABORT unreserved unreserved
ABSOLUTE unreserved unreserved
ACCESS unreserved unreserved
ACTION unreserved unreserved
ACTIVE unreserved
ADD unreserved unreserved
ADMIN unreserved unreserved
AFTER unreserved unreserved
AGGREGATE unreserved unreserved
ALL reserved reserved
ALSO unreserved unreserved
ALTER unreserved unreserved
ALWAYS unreserved unreserved
ANALYSE reserved reserved
ANALYZE reserved reserved
AND reserved reserved
ANY reserved reserved
ARRAY reserved reserved
AS reserved reserved
ASC reserved reserved
ASSERTION unreserved unreserved
ASSIGNMENT unreserved unreserved
ASYMMETRIC reserved reserved
AT unreserved unreserved
ATTRIBUTE unreserved unreserved
AUTHORIZATION reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
BACKWARD unreserved unreserved
BEFORE unreserved unreserved
BEGIN unreserved unreserved
BETWEEN unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
BIGINT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
BINARY reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
BIT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
BOOLEAN unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
BOTH reserved reserved
BY unreserved unreserved
CACHE unreserved unreserved
CALLED unreserved unreserved
CASCADE unreserved unreserved
CASCADED unreserved unreserved
CASE reserved reserved
CAST reserved reserved
CATALOG unreserved unreserved
CHAIN unreserved unreserved
CHAR unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
CHARACTER unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
CHARACTERISTICS unreserved unreserved
CHECK reserved reserved
CHECKPOINT unreserved unreserved
CLASS unreserved unreserved
CLOSE unreserved unreserved
CLUSTER unreserved unreserved
COALESCE unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
COLLATE reserved reserved
COLLATION reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
COLUMN reserved reserved
COMMENT unreserved unreserved
COMMENTS unreserved unreserved
COMMIT unreserved unreserved
COMMITTED unreserved unreserved
CONCURRENCY unreserved
CONCURRENTLY reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
CONFIGURATION unreserved unreserved
CONNECTION unreserved unreserved
CONSTRAINT reserved reserved
CONSTRAINTS unreserved unreserved
CONTAINS unreserved
CONTENT unreserved unreserved
CONTINUE unreserved unreserved
CONVERSION unreserved unreserved
COPY unreserved unreserved
COST unreserved unreserved
CPU_RATE_LIMIT unreserved
CPUSET unreserved
CREATE reserved reserved
CREATEEXTTABLE unreserved
CROSS reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
CSV unreserved unreserved
CUBE unreserved (不能是函数或类型名称)
CURRENT unreserved unreserved
CURRENT_CATALOG reserved reserved
CURRENT_DATE reserved reserved
CURRENT_ROLE reserved reserved
CURRENT_SCHEMA reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
CURRENT_TIME reserved reserved
CURRENT_TIMESTAMP reserved reserved
CURRENT_USER reserved reserved
CURSOR unreserved unreserved
CYCLE unreserved unreserved
DATA unreserved unreserved
DATABASE unreserved unreserved
DAY unreserved unreserved
DEALLOCATE unreserved unreserved
DEC unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
DECIMAL unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
DECLARE unreserved unreserved
DECODE reserved
DEFAULT reserved reserved
DEFAULTS unreserved unreserved
DEFERRABLE reserved reserved
DEFERRED unreserved unreserved
DEFINER unreserved unreserved
DELETE unreserved unreserved
DELIMITER unreserved unreserved
DELIMITERS unreserved unreserved
DENY unreserved
DESC reserved reserved
DICTIONARY unreserved unreserved
DISABLE unreserved unreserved
DISCARD unreserved unreserved
DISTINCT reserved reserved
DISTRIBUTED reserved
DO reserved reserved
DOCUMENT unreserved unreserved
DOMAIN unreserved unreserved
DOUBLE unreserved unreserved
DROP unreserved unreserved
DXL unreserved
EACH unreserved unreserved
ELSE reserved reserved
ENABLE unreserved unreserved
ENCODING unreserved unreserved
ENCRYPTED unreserved unreserved
END reserved reserved
ENUM unreserved unreserved
ERRORS unreserved
ESCAPE unreserved unreserved
EVENT unreserved unreserved
EVERY unreserved
EXCEPT reserved reserved
EXCHANGE unreserved
EXCLUDE reserved unreserved
EXCLUDING unreserved unreserved
EXCLUSIVE unreserved unreserved
EXECUTE unreserved unreserved
EXISTS unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
EXPAND unreserved
EXPLAIN unreserved unreserved
EXTENSION unreserved unreserved
EXTERNAL unreserved unreserved
EXTRACT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
FALSE reserved reserved
FAMILY unreserved unreserved
FETCH reserved reserved
FIELDS unreserved
FILL unreserved
FILTER unreserved unreserved
FIRST unreserved unreserved
FLOAT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
FOLLOWING reserved unreserved
FOR reserved reserved
FORCE unreserved unreserved
FOREIGN reserved reserved
FORMAT unreserved
FORWARD unreserved unreserved
FREEZE reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
FROM reserved reserved
FULL reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
FULLSCAN unreserved
FUNCTION unreserved unreserved
FUNCTIONS unreserved unreserved
GLOBAL unreserved unreserved
GRANT reserved reserved
GRANTED unreserved unreserved
GREATEST unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
GROUP reserved reserved
GROUP_ID unreserved (不能是函数或类型名称)
GROUPING unreserved (不能是函数或类型名称)
HANDLER unreserved unreserved
HASH unreserved
HAVING reserved reserved
HEADER unreserved unreserved
HOLD unreserved unreserved
HOST unreserved
HOUR unreserved unreserved
IDENTITY unreserved unreserved
IF unreserved unreserved
IGNORE unreserved
ILIKE reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
IMMEDIATE unreserved unreserved
IMMUTABLE unreserved unreserved
IMPLICIT unreserved unreserved
IN reserved reserved
INCLUDING unreserved unreserved
INCLUSIVE unreserved
INCREMENT unreserved unreserved
INDEX unreserved unreserved
INDEXES unreserved unreserved
INHERIT unreserved unreserved
INHERITS unreserved unreserved
INITIALLY reserved reserved
INLINE unreserved unreserved
INNER reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
INOUT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
INPUT unreserved unreserved
INSENSITIVE unreserved unreserved
INSERT unreserved unreserved
INSTEAD unreserved unreserved
INT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
INTEGER unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
INTERSECT reserved reserved
INTERVAL unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
INTO reserved reserved
INVOKER unreserved unreserved
IS reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
ISNULL reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
ISOLATION unreserved unreserved
JOIN reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
KEY unreserved unreserved
LABEL unreserved unreserved
LANGUAGE unreserved unreserved
LARGE unreserved unreserved
LAST unreserved unreserved
LATERAL reserved reserved
LC_COLLATE unreserved unreserved
LC_CTYPE unreserved unreserved
LEADING reserved reserved
LEAKPROOF unreserved unreserved
LEAST unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
LEFT reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
LEVEL unreserved unreserved
LIKE reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
LIMIT reserved reserved
LIST unreserved
LISTEN unreserved unreserved
LOAD unreserved unreserved
LOCAL unreserved unreserved
LOCALTIME reserved reserved
LOCALTIMESTAMP reserved reserved
LOCATION unreserved unreserved
LOCK unreserved unreserved
LOG reserved (可以是函数或类型名称)
MAPPING unreserved unreserved
MASTER unreserved
MATCH unreserved unreserved
MATERIALIZED unreserved unreserved
MAXVALUE unreserved unreserved
MEDIAN unreserved (不能是函数或类型名称)
MEMORY_LIMIT unreserved
MEMORY_SHARED_QUOTA unreserved
MEMORY_SPILL_RATIO unreserved
MINUTE unreserved unreserved
MINVALUE unreserved unreserved
MISSING unreserved
MODE unreserved unreserved
MODIFIES unreserved
MONTH unreserved unreserved
MOVE unreserved unreserved
NAME unreserved unreserved
NAMES unreserved unreserved
NATIONAL unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
NATURAL reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
NCHAR unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
NEWLINE unreserved
NEXT unreserved unreserved
NO unreserved unreserved
NOCREATEEXTTABLE unreserved
NONE unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
NOOVERCOMMIT unreserved
NOT reserved reserved
NOTHING unreserved unreserved
NOTIFY unreserved unreserved
NOTNULL reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
NOWAIT unreserved unreserved
NULL reserved reserved
NULLIF unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
NULLS unreserved unreserved
NUMERIC unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
OBJECT unreserved unreserved
OF unreserved unreserved
OFF unreserved unreserved
OFFSET reserved reserved
OIDS unreserved unreserved
ON reserved reserved
ONLY reserved reserved
OPERATOR unreserved unreserved
OPTION unreserved unreserved
OPTIONS unreserved unreserved
OR reserved reserved
ORDER reserved reserved
ORDERED unreserved
ORDINALITY unreserved unreserved
OTHERS unreserved
OUT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
OUTER reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
OVER unreserved unreserved
OVERCOMMIT unreserved
OVERLAPS reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
OVERLAY unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
OWNED unreserved unreserved
OWNER unreserved unreserved
PARSER unreserved unreserved
PARTIAL unreserved unreserved
PARTITION reserved unreserved
PARTITIONS unreserved
PASSING unreserved unreserved
PASSWORD unreserved unreserved
PERCENT unreserved
PLACING reserved reserved
PLANS unreserved unreserved
POSITION unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
PRECEDING reserved unreserved
PRECISION unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
PREPARE unreserved unreserved
PREPARED unreserved unreserved
PRESERVE unreserved unreserved
PRIMARY reserved reserved
PRIOR unreserved unreserved
PRIVILEGES unreserved unreserved
PROCEDURAL unreserved unreserved
PROCEDURE unreserved unreserved
PROGRAM unreserved unreserved
PROTOCOL unreserved
QUEUE unreserved
QUOTE unreserved unreserved
RANDOMLY unreserved
RANGE unreserved unreserved
READ unreserved unreserved
READABLE unreserved
READS unreserved
REAL unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
REASSIGN unreserved unreserved
RECHECK unreserved unreserved
RECURSIVE unreserved unreserved
REF unreserved unreserved
REFERENCES reserved reserved
REFRESH unreserved unreserved
REINDEX unreserved unreserved
REJECT unreserved
RELATIVE unreserved unreserved
RELEASE unreserved unreserved
RENAME unreserved unreserved
REPEATABLE unreserved unreserved
REPLACE unreserved unreserved
REPLICA unreserved unreserved
REPLICATED unreserved
RESET unreserved unreserved
RESOURCE unreserved
RESTART unreserved unreserved
RESTRICT unreserved unreserved
RETURNING reserved reserved
RETURNS unreserved unreserved
REVOKE unreserved unreserved
RIGHT reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
ROLE unreserved unreserved
ROLLBACK unreserved unreserved
ROLLUP unreserved (不能是函数或类型名称)
ROOTPARTITION unreserved
ROW unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
ROWS unreserved unreserved
RULE unreserved unreserved
SAVEPOINT unreserved unreserved
SCATTER reserved
SCHEMA unreserved unreserved
SCROLL unreserved unreserved
SEARCH unreserved unreserved
SECOND unreserved unreserved
SECURITY unreserved unreserved
SEGMENT unreserved
SEGMENTS unreserved
SELECT reserved reserved
SEQUENCE unreserved unreserved
SEQUENCES unreserved unreserved
SERIALIZABLE unreserved unreserved
SERVER unreserved unreserved
SESSION unreserved unreserved
SESSION_USER reserved reserved
SET unreserved unreserved
SETOF unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
SETS unreserved (不能是函数或类型名称)
SHARE unreserved unreserved
SHOW unreserved unreserved
SIMILAR reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
SIMPLE unreserved unreserved
SMALLINT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
SNAPSHOT unreserved unreserved
SOME reserved reserved
SPLIT unreserved
SQL unreserved
STABLE unreserved unreserved
STANDALONE unreserved unreserved
START unreserved unreserved
STATEMENT unreserved unreserved
STATISTICS unreserved unreserved
STDIN unreserved unreserved
STDOUT unreserved unreserved
STORAGE unreserved unreserved
STRICT unreserved unreserved
STRIP unreserved unreserved
SUBPARTITION unreserved
SUBSTRING unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
SYMMETRIC reserved reserved
SYSID unreserved unreserved
SYSTEM unreserved unreserved
TABLE reserved reserved
TABLES unreserved unreserved
TABLESPACE unreserved unreserved
TEMP unreserved unreserved
TEMPLATE unreserved unreserved
TEMPORARY unreserved unreserved
TEXT unreserved unreserved
THEN reserved reserved
THRESHOLD unreserved
TIES unreserved
TIME unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
TIMESTAMP unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
TO reserved reserved
TRAILING reserved reserved
TRANSACTION unreserved unreserved
TREAT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
TRIGGER unreserved unreserved
TRIM unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
TRUE reserved reserved
TRUNCATE unreserved unreserved
TRUSTED unreserved unreserved
TYPE unreserved unreserved
TYPES unreserved unreserved
UNBOUNDED reserved unreserved
UNCOMMITTED unreserved unreserved
UNENCRYPTED unreserved unreserved
UNION reserved reserved
UNIQUE reserved reserved
UNKNOWN unreserved unreserved
UNLISTEN unreserved unreserved
UNLOGGED unreserved unreserved
UNTIL unreserved unreserved
UPDATE unreserved unreserved
USER reserved reserved
USING reserved reserved
VACUUM unreserved unreserved
VALID unreserved unreserved
VALIDATE unreserved unreserved
VALIDATION unreserved
VALIDATOR unreserved unreserved
VALUE unreserved unreserved
VALUES unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
VARCHAR unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
VARIADIC reserved reserved
VARYING unreserved unreserved
VERBOSE reserved (可以是函数或类型名称) reserved (可以是函数或类型名称)
VERSION unreserved unreserved
VIEW unreserved unreserved
VIEWS unreserved unreserved
VOLATILE unreserved unreserved
WEB unreserved
WHEN reserved reserved
WHERE reserved reserved
WHITESPACE unreserved unreserved
WINDOW reserved reserved
WITH reserved reserved
WITHIN unreserved unreserved
WITHOUT unreserved unreserved
WORK unreserved unreserved
WRAPPER unreserved unreserved
WRITABLE unreserved
WRITE unreserved unreserved
XML unreserved unreserved
XMLATTRIBUTES unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLCONCAT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLELEMENT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLEXISTS unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLFOREST unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLPARSE unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLPI unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLROOT unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
XMLSERIALIZE unreserved (不能是函数或类型名称) unreserved (不能是函数或类型名称)
YEAR unreserved unreserved
YES unreserved unreserved
ZONE unreserved unreserved