保留标识符和SQL关键字

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

保留标识符

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

资源组名称admin_group,default_group和none都是保留的。 资源队列名称pg_default是保留的。

表空间名称pg_default和pg_global是保留的。

角色名称gpadmin和gpmon是保留的。 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
ABORTunreservedunreserved
ABSOLUTEunreservedunreserved
ACCESSunreservedunreserved
ACTIONunreservedunreserved
ACTIVEunreserved
ADDunreservedunreserved
ADMINunreservedunreserved
AFTERunreservedunreserved
AGGREGATEunreservedunreserved
ALLreservedreserved
ALSOunreservedunreserved
ALTERunreservedunreserved
ALWAYSunreservedunreserved
ANALYSEreservedreserved
ANALYZEreservedreserved
ANDreservedreserved
ANYreservedreserved
ARRAYreservedreserved
ASreservedreserved
ASCreservedreserved
ASSERTIONunreservedunreserved
ASSIGNMENTunreservedunreserved
ASYMMETRICreservedreserved
ATunreservedunreserved
ATTRIBUTEunreservedunreserved
AUTHORIZATIONreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
BACKWARDunreservedunreserved
BEFOREunreservedunreserved
BEGINunreservedunreserved
BETWEENunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
BIGINTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
BINARYreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
BITunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
BOOLEANunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
BOTHreservedreserved
BYunreservedunreserved
CACHEunreservedunreserved
CALLEDunreservedunreserved
CASCADEunreservedunreserved
CASCADEDunreservedunreserved
CASEreservedreserved
CASTreservedreserved
CATALOGunreservedunreserved
CHAINunreservedunreserved
CHARunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
CHARACTERunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
CHARACTERISTICSunreservedunreserved
CHECKreservedreserved
CHECKPOINTunreservedunreserved
CLASSunreservedunreserved
CLOSEunreservedunreserved
CLUSTERunreservedunreserved
COALESCEunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
COLLATEreservedreserved
COLLATIONreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
COLUMNreservedreserved
COMMENTunreservedunreserved
COMMENTSunreservedunreserved
COMMITunreservedunreserved
COMMITTEDunreservedunreserved
CONCURRENCYunreserved
CONCURRENTLYreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
CONFIGURATIONunreservedunreserved
CONNECTIONunreservedunreserved
CONSTRAINTreservedreserved
CONSTRAINTSunreservedunreserved
CONTAINSunreserved
CONTENTunreservedunreserved
CONTINUEunreservedunreserved
CONVERSIONunreservedunreserved
COPYunreservedunreserved
COSTunreservedunreserved
CPU_RATE_LIMITunreserved
CPUSETunreserved
CREATEreservedreserved
CREATEEXTTABLEunreserved
CROSSreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
CSVunreservedunreserved
CUBEunreserved (不能是函数或类型名称)
CURRENTunreservedunreserved
CURRENT_CATALOGreservedreserved
CURRENT_DATEreservedreserved
CURRENT_ROLEreservedreserved
CURRENT_SCHEMAreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
CURRENT_TIMEreservedreserved
CURRENT_TIMESTAMPreservedreserved
CURRENT_USERreservedreserved
CURSORunreservedunreserved
CYCLEunreservedunreserved
DATAunreservedunreserved
DATABASEunreservedunreserved
DAYunreservedunreserved
DEALLOCATEunreservedunreserved
DECunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
DECIMALunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
DECLAREunreservedunreserved
DECODEreserved
DEFAULTreservedreserved
DEFAULTSunreservedunreserved
DEFERRABLEreservedreserved
DEFERREDunreservedunreserved
DEFINERunreservedunreserved
DELETEunreservedunreserved
DELIMITERunreservedunreserved
DELIMITERSunreservedunreserved
DENYunreserved
DESCreservedreserved
DICTIONARYunreservedunreserved
DISABLEunreservedunreserved
DISCARDunreservedunreserved
DISTINCTreservedreserved
DISTRIBUTEDreserved
DOreservedreserved
DOCUMENTunreservedunreserved
DOMAINunreservedunreserved
DOUBLEunreservedunreserved
DROPunreservedunreserved
DXLunreserved
EACHunreservedunreserved
ELSEreservedreserved
ENABLEunreservedunreserved
ENCODINGunreservedunreserved
ENCRYPTEDunreservedunreserved
ENDreservedreserved
ENUMunreservedunreserved
ERRORSunreserved
ESCAPEunreservedunreserved
EVENTunreservedunreserved
EVERYunreserved
EXCEPTreservedreserved
EXCHANGEunreserved
EXCLUDEreservedunreserved
EXCLUDINGunreservedunreserved
EXCLUSIVEunreservedunreserved
EXECUTEunreservedunreserved
EXISTSunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
EXPANDunreserved
EXPLAINunreservedunreserved
EXTENSIONunreservedunreserved
EXTERNALunreservedunreserved
EXTRACTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
FALSEreservedreserved
FAMILYunreservedunreserved
FETCHreservedreserved
FIELDSunreserved
FILLunreserved
FILTERunreservedunreserved
FIRSTunreservedunreserved
FLOATunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
FOLLOWINGreservedunreserved
FORreservedreserved
FORCEunreservedunreserved
FOREIGNreservedreserved
FORMATunreserved
FORWARDunreservedunreserved
FREEZEreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
FROMreservedreserved
FULLreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
FULLSCANunreserved
FUNCTIONunreservedunreserved
FUNCTIONSunreservedunreserved
GLOBALunreservedunreserved
GRANTreservedreserved
GRANTEDunreservedunreserved
GREATESTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
GROUPreservedreserved
GROUP_IDunreserved (不能是函数或类型名称)
GROUPINGunreserved (不能是函数或类型名称)
HANDLERunreservedunreserved
HASHunreserved
HAVINGreservedreserved
HEADERunreservedunreserved
HOLDunreservedunreserved
HOSTunreserved
HOURunreservedunreserved
IDENTITYunreservedunreserved
IFunreservedunreserved
IGNOREunreserved
ILIKEreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
IMMEDIATEunreservedunreserved
IMMUTABLEunreservedunreserved
IMPLICITunreservedunreserved
INreservedreserved
INCLUDINGunreservedunreserved
INCLUSIVEunreserved
INCREMENTunreservedunreserved
INDEXunreservedunreserved
INDEXESunreservedunreserved
INHERITunreservedunreserved
INHERITSunreservedunreserved
INITIALLYreservedreserved
INLINEunreservedunreserved
INNERreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
INOUTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
INPUTunreservedunreserved
INSENSITIVEunreservedunreserved
INSERTunreservedunreserved
INSTEADunreservedunreserved
INTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
INTEGERunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
INTERSECTreservedreserved
INTERVALunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
INTOreservedreserved
INVOKERunreservedunreserved
ISreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
ISNULLreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
ISOLATIONunreservedunreserved
JOINreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
KEYunreservedunreserved
LABELunreservedunreserved
LANGUAGEunreservedunreserved
LARGEunreservedunreserved
LASTunreservedunreserved
LATERALreservedreserved
LC_COLLATEunreservedunreserved
LC_CTYPEunreservedunreserved
LEADINGreservedreserved
LEAKPROOFunreservedunreserved
LEASTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
LEFTreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
LEVELunreservedunreserved
LIKEreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
LIMITreservedreserved
LISTunreserved
LISTENunreservedunreserved
LOADunreservedunreserved
LOCALunreservedunreserved
LOCALTIMEreservedreserved
LOCALTIMESTAMPreservedreserved
LOCATIONunreservedunreserved
LOCKunreservedunreserved
LOGreserved (可以是函数或类型名称)
MAPPINGunreservedunreserved
MASTERunreserved
MATCHunreservedunreserved
MATERIALIZEDunreservedunreserved
MAXVALUEunreservedunreserved
MEDIANunreserved (不能是函数或类型名称)
MEMORY_LIMITunreserved
MEMORY_SHARED_QUOTAunreserved
MEMORY_SPILL_RATIOunreserved
MINUTEunreservedunreserved
MINVALUEunreservedunreserved
MISSINGunreserved
MODEunreservedunreserved
MODIFIESunreserved
MONTHunreservedunreserved
MOVEunreservedunreserved
NAMEunreservedunreserved
NAMESunreservedunreserved
NATIONALunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
NATURALreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
NCHARunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
NEWLINEunreserved
NEXTunreservedunreserved
NOunreservedunreserved
NOCREATEEXTTABLEunreserved
NONEunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
NOOVERCOMMITunreserved
NOTreservedreserved
NOTHINGunreservedunreserved
NOTIFYunreservedunreserved
NOTNULLreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
NOWAITunreservedunreserved
NULLreservedreserved
NULLIFunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
NULLSunreservedunreserved
NUMERICunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
OBJECTunreservedunreserved
OFunreservedunreserved
OFFunreservedunreserved
OFFSETreservedreserved
OIDSunreservedunreserved
ONreservedreserved
ONLYreservedreserved
OPERATORunreservedunreserved
OPTIONunreservedunreserved
OPTIONSunreservedunreserved
ORreservedreserved
ORDERreservedreserved
ORDEREDunreserved
ORDINALITYunreservedunreserved
OTHERSunreserved
OUTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
OUTERreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
OVERunreservedunreserved
OVERCOMMITunreserved
OVERLAPSreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
OVERLAYunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
OWNEDunreservedunreserved
OWNERunreservedunreserved
PARSERunreservedunreserved
PARTIALunreservedunreserved
PARTITIONreservedunreserved
PARTITIONSunreserved
PASSINGunreservedunreserved
PASSWORDunreservedunreserved
PERCENTunreserved
PLACINGreservedreserved
PLANSunreservedunreserved
POSITIONunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
PRECEDINGreservedunreserved
PRECISIONunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
PREPAREunreservedunreserved
PREPAREDunreservedunreserved
PRESERVEunreservedunreserved
PRIMARYreservedreserved
PRIORunreservedunreserved
PRIVILEGESunreservedunreserved
PROCEDURALunreservedunreserved
PROCEDUREunreservedunreserved
PROGRAMunreservedunreserved
PROTOCOLunreserved
QUEUEunreserved
QUOTEunreservedunreserved
RANDOMLYunreserved
RANGEunreservedunreserved
READunreservedunreserved
READABLEunreserved
READSunreserved
REALunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
REASSIGNunreservedunreserved
RECHECKunreservedunreserved
RECURSIVEunreservedunreserved
REFunreservedunreserved
REFERENCESreservedreserved
REFRESHunreservedunreserved
REINDEXunreservedunreserved
REJECTunreserved
RELATIVEunreservedunreserved
RELEASEunreservedunreserved
RENAMEunreservedunreserved
REPEATABLEunreservedunreserved
REPLACEunreservedunreserved
REPLICAunreservedunreserved
REPLICATEDunreserved
RESETunreservedunreserved
RESOURCEunreserved
RESTARTunreservedunreserved
RESTRICTunreservedunreserved
RETURNINGreservedreserved
RETURNSunreservedunreserved
REVOKEunreservedunreserved
RIGHTreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
ROLEunreservedunreserved
ROLLBACKunreservedunreserved
ROLLUPunreserved (不能是函数或类型名称)
ROOTPARTITIONunreserved
ROWunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
ROWSunreservedunreserved
RULEunreservedunreserved
SAVEPOINTunreservedunreserved
SCATTERreserved
SCHEMAunreservedunreserved
SCROLLunreservedunreserved
SEARCHunreservedunreserved
SECONDunreservedunreserved
SECURITYunreservedunreserved
SEGMENTunreserved
SEGMENTSunreserved
SELECTreservedreserved
SEQUENCEunreservedunreserved
SEQUENCESunreservedunreserved
SERIALIZABLEunreservedunreserved
SERVERunreservedunreserved
SESSIONunreservedunreserved
SESSION_USERreservedreserved
SETunreservedunreserved
SETOFunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
SETSunreserved (不能是函数或类型名称)
SHAREunreservedunreserved
SHOWunreservedunreserved
SIMILARreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
SIMPLEunreservedunreserved
SMALLINTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
SNAPSHOTunreservedunreserved
SOMEreservedreserved
SPLITunreserved
SQLunreserved
STABLEunreservedunreserved
STANDALONEunreservedunreserved
STARTunreservedunreserved
STATEMENTunreservedunreserved
STATISTICSunreservedunreserved
STDINunreservedunreserved
STDOUTunreservedunreserved
STORAGEunreservedunreserved
STRICTunreservedunreserved
STRIPunreservedunreserved
SUBPARTITIONunreserved
SUBSTRINGunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
SYMMETRICreservedreserved
SYSIDunreservedunreserved
SYSTEMunreservedunreserved
TABLEreservedreserved
TABLESunreservedunreserved
TABLESPACEunreservedunreserved
TEMPunreservedunreserved
TEMPLATEunreservedunreserved
TEMPORARYunreservedunreserved
TEXTunreservedunreserved
THENreservedreserved
THRESHOLDunreserved
TIESunreserved
TIMEunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
TIMESTAMPunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
TOreservedreserved
TRAILINGreservedreserved
TRANSACTIONunreservedunreserved
TREATunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
TRIGGERunreservedunreserved
TRIMunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
TRUEreservedreserved
TRUNCATEunreservedunreserved
TRUSTEDunreservedunreserved
TYPEunreservedunreserved
TYPESunreservedunreserved
UNBOUNDEDreservedunreserved
UNCOMMITTEDunreservedunreserved
UNENCRYPTEDunreservedunreserved
UNIONreservedreserved
UNIQUEreservedreserved
UNKNOWNunreservedunreserved
UNLISTENunreservedunreserved
UNLOGGEDunreservedunreserved
UNTILunreservedunreserved
UPDATEunreservedunreserved
USERreservedreserved
USINGreservedreserved
VACUUMunreservedunreserved
VALIDunreservedunreserved
VALIDATEunreservedunreserved
VALIDATIONunreserved
VALIDATORunreservedunreserved
VALUEunreservedunreserved
VALUESunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
VARCHARunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
VARIADICreservedreserved
VARYINGunreservedunreserved
VERBOSEreserved (可以是函数或类型名称)reserved (可以是函数或类型名称)
VERSIONunreservedunreserved
VIEWunreservedunreserved
VIEWSunreservedunreserved
VOLATILEunreservedunreserved
WEBunreserved
WHENreservedreserved
WHEREreservedreserved
WHITESPACEunreservedunreserved
WINDOWreservedreserved
WITHreservedreserved
WITHINunreservedunreserved
WITHOUTunreservedunreserved
WORKunreservedunreserved
WRAPPERunreservedunreserved
WRITABLEunreserved
WRITEunreservedunreserved
XMLunreservedunreserved
XMLATTRIBUTESunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLCONCATunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLELEMENTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLEXISTSunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLFORESTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLPARSEunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLPIunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLROOTunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
XMLSERIALIZEunreserved (不能是函数或类型名称)unreserved (不能是函数或类型名称)
YEARunreservedunreserved
YESunreservedunreserved
ZONEunreservedunreserved

Parent topic: Greenplum数据库参考指南