Skip to content

Commit

Permalink
Merge pull request #2108 from taozhi8833998/fix-create-table-as-pg
Browse files Browse the repository at this point in the history
fix: create table as table defintion could be optional in pg
  • Loading branch information
taozhi8833998 authored Sep 10, 2024
2 parents 3a9f18b + 71385a2 commit 1dc6f55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ create_table_stmt
KW_TABLE __
ife:if_not_exists_stmt? __
t:table_ref_list __
c:create_table_definition __
c:create_table_definition? __
to:table_options? __
ir: (KW_IGNORE / KW_REPLACE)? __
as:KW_AS? __
Expand Down
7 changes: 7 additions & 0 deletions test/postgres.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,13 @@ describe('Postgres', () => {
'START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY, NOT DEFERRABLE'
]
},
{
title: 'create table as',
sql: [
'create table test as select 1',
'CREATE TABLE "test" AS SELECT 1'
]
},
]
function neatlyNestTestedSQL(sqlList){
sqlList.forEach(sqlInfo => {
Expand Down

0 comments on commit 1dc6f55

Please sign in to comment.