Skip to content

Commit 1dc6f55

Browse files
Merge pull request taozhi8833998#2108 from taozhi8833998/fix-create-table-as-pg
fix: create table as table defintion could be optional in pg
2 parents 3a9f18b + 71385a2 commit 1dc6f55

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pegjs/postgresql.pegjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ create_table_stmt
832832
KW_TABLE __
833833
ife:if_not_exists_stmt? __
834834
t:table_ref_list __
835-
c:create_table_definition __
835+
c:create_table_definition? __
836836
to:table_options? __
837837
ir: (KW_IGNORE / KW_REPLACE)? __
838838
as:KW_AS? __

test/postgres.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,13 @@ describe('Postgres', () => {
16381638
'START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY, NOT DEFERRABLE'
16391639
]
16401640
},
1641+
{
1642+
title: 'create table as',
1643+
sql: [
1644+
'create table test as select 1',
1645+
'CREATE TABLE "test" AS SELECT 1'
1646+
]
1647+
},
16411648
]
16421649
function neatlyNestTestedSQL(sqlList){
16431650
sqlList.forEach(sqlInfo => {

0 commit comments

Comments
 (0)