@@ -3401,11 +3401,25 @@ CreateAsStmt:
3401
3401
ctas->into =$4 ;
3402
3402
ctas->relkind = OBJECT_TABLE;
3403
3403
ctas->is_select_into =false ;
3404
+ ctas->if_not_exists =false ;
3404
3405
/* cram additional flags into the IntoClause*/
3405
3406
$4 ->rel->relpersistence =$2 ;
3406
3407
$4 ->skipData = !($7 );
3407
3408
$$ = (Node *) ctas;
3408
3409
}
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
+ }
3409
3423
;
3410
3424
3411
3425
create_as_target :
@@ -3444,11 +3458,25 @@ CreateMatViewStmt:
3444
3458
ctas->into =$5 ;
3445
3459
ctas->relkind = OBJECT_MATVIEW;
3446
3460
ctas->is_select_into =false ;
3461
+ ctas->if_not_exists =false ;
3447
3462
/* cram additional flags into the IntoClause*/
3448
3463
$5 ->rel->relpersistence =$2 ;
3449
3464
$5 ->skipData = !($8 );
3450
3465
$$ = (Node *) ctas;
3451
3466
}
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
+ }
3452
3480
;
3453
3481
3454
3482
create_mv_target :