MySQL兼容-create table as

This commit is contained in:
qianxue21
2023-02-20 14:00:58 +08:00
parent cb69338a83
commit 404cd52cd1
14 changed files with 519 additions and 6 deletions

View File

@ -127,6 +127,7 @@ extern const uint32 INSERT_RIGHT_REF_VERSION_NUM;
extern const uint32 CREATE_INDEX_IF_NOT_EXISTS_VERSION_NUM;
extern const uint32 SLOW_SQL_VERSION_NUM;
extern const uint32 INDEX_HINT_VERSION_NUM;
extern const uint32 CREATE_TABLE_AS_VERSION_NUM;
extern void register_backend_version(uint32 backend_version);
extern bool contain_backend_version(uint32 version_number);

View File

@ -68,6 +68,13 @@ typedef enum OptCompress {
COMPRESS_HIGH,
} OptCompress;
/* How to handle rows that duplicate unique key values */
typedef enum OnDuplicateAction {
DUPLICATE_ERROR = 0,
DUPLICATE_IGNORE,
DUPLICATE_REPLACE
} OnDuplicate;
/*
* RangeVar - range variable, used in FROM clauses
*
@ -126,6 +133,9 @@ typedef struct IntoClause {
struct DistributeBy* distributeby; /* distribution to use, or NULL */
struct PGXCSubCluster* subcluster; /* subcluster node members */
#endif
List* tableElts; /* column definitions(list of ColumnDef) */
Node *autoIncStart; /* DefElem for AUTO_INCREMENT = value*/
OnDuplicateAction onduplicate; /* how to handle rows that duplicate unique key values */
} IntoClause;
/* ----------------------------------------------------------------

View File

@ -289,6 +289,7 @@ PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD)
PG_KEYWORD("identified", IDENTIFIED, UNRESERVED_KEYWORD)
PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD)
PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD)
PG_KEYWORD("ignore", IGNORE, UNRESERVED_KEYWORD)
PG_KEYWORD("ignore_extra_data", IGNORE_EXTRA_DATA, UNRESERVED_KEYWORD)
PG_KEYWORD("ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD)
PG_KEYWORD("immediate", IMMEDIATE, UNRESERVED_KEYWORD)