pganalyze / pg_query_go

Go library to parse and normalize SQL queries using the PostgreSQL query parser
BSD 3-Clause "New" or "Revised" License
663 stars 79 forks source link

The parser is unable to parse the constructor sentence with DISTRIBUTED BY #63

Closed WangJiu-czy closed 2 years ago

WangJiu-czy commented 2 years ago

Parse failure:

result, err := parser.Parse("CREATE TABLE SHELL.SESSION_TMP_YXKD_INF( STAT_MO     INTEGER,  CMCC_BRANCH_CD  CHAR(4),)WITH(appendonly=true,compresstype=zstd, compresslevel=5,orientation=column)  DISTRIBUTED BY(STAT_MO)")

GM8%_63)3UJDM5652G`CFCQ


Parsing the success:

result, err := parser.Parse("CREATE TABLE SHELL.SESSION_TMP_YXKD_INF( STAT_MO     INTEGER,  CMCC_BRANCH_CD  CHAR(4),)WITH(appendonly=true,compresstype=zstd, compresslevel=5,orientation=column) ")
lfittl commented 2 years ago

@1412849797 Thanks for reaching out - which variant of Postgres are you using? DISTRIBUTED BY is not standard Postgres syntax.

WangJiu-czy commented 2 years ago

云原生数据仓库AnalyticDB PostgreSQL版 https://help.aliyun.com/document_detail/35433.html?spm=a2c4g.11186623.6.647.3c4a3038bYmIr4#section-db3-vuh-j41