@@ -3401,11 +3401,25 @@ CreateAsStmt:
34013401 ctas->into = $4 ;
34023402 ctas->relkind = OBJECT_TABLE;
34033403 ctas->is_select_into = false ;
3404+ ctas->if_not_exists = false ;
34043405 /* cram additional flags into the IntoClause */
34053406 $4 ->rel->relpersistence = $2 ;
34063407 $4 ->skipData = !($7 );
34073408 $$ = (Node *) ctas;
34083409 }
3410+ | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS SelectStmt opt_with_data
3411+ {
3412+ CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt);
3413+ ctas->query = $9 ;
3414+ ctas->into = $7 ;
3415+ ctas->relkind = OBJECT_TABLE;
3416+ ctas->is_select_into = false ;
3417+ ctas->if_not_exists = true ;
3418+ /* cram additional flags into the IntoClause */
3419+ $7 ->rel->relpersistence = $2 ;
3420+ $7 ->skipData = !($10 );
3421+ $$ = (Node *) ctas;
3422+ }
34093423 ;
34103424
34113425create_as_target :
@@ -3444,11 +3458,25 @@ CreateMatViewStmt:
34443458 ctas->into = $5 ;
34453459 ctas->relkind = OBJECT_MATVIEW;
34463460 ctas->is_select_into = false ;
3461+ ctas->if_not_exists = false ;
34473462 /* cram additional flags into the IntoClause */
34483463 $5 ->rel->relpersistence = $2 ;
34493464 $5 ->skipData = !($8 );
34503465 $$ = (Node *) ctas;
34513466 }
3467+ | CREATE OptNoLog MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
3468+ {
3469+ CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt);
3470+ ctas->query = $10 ;
3471+ ctas->into = $8 ;
3472+ ctas->relkind = OBJECT_MATVIEW;
3473+ ctas->is_select_into = false ;
3474+ ctas->if_not_exists = true ;
3475+ /* cram additional flags into the IntoClause */
3476+ $8 ->rel->relpersistence = $2 ;
3477+ $8 ->skipData = !($11 );
3478+ $$ = (Node *) ctas;
3479+ }
34523480 ;
34533481
34543482create_mv_target :
0 commit comments