@@ -102,8 +102,8 @@ static void transformColumnDefinition(CreateStmtContext *cxt,
102
102
ColumnDef * column );
103
103
static void transformTableConstraint (CreateStmtContext * cxt ,
104
104
Constraint * constraint );
105
- static void transformInhRelation (CreateStmtContext * cxt ,
106
- InhRelation * inhrelation );
105
+ static void transformTableLikeClause (CreateStmtContext * cxt ,
106
+ TableLikeClause * table_like_clause );
107
107
static void transformOfType (CreateStmtContext * cxt ,
108
108
TypeName * ofTypename );
109
109
static char * chooseIndexName (const RangeVar * relation ,IndexStmt * index_stmt );
@@ -238,8 +238,8 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
238
238
transformTableConstraint (& cxt , (Constraint * )element );
239
239
break ;
240
240
241
- case T_InhRelation :
242
- transformInhRelation (& cxt , (InhRelation * )element );
241
+ case T_TableLikeClause :
242
+ transformTableLikeClause (& cxt , (TableLikeClause * )element );
243
243
break ;
244
244
245
245
default :
@@ -625,14 +625,14 @@ transformTableConstraint(CreateStmtContext *cxt, Constraint *constraint)
625
625
}
626
626
627
627
/*
628
- *transformInhRelation
628
+ *transformTableLikeClause
629
629
*
630
- * Change the LIKE <subtable > portion of a CREATE TABLE statement into
630
+ * Change the LIKE <srctable > portion of a CREATE TABLE statement into
631
631
* column definitions which recreate the user defined column portions of
632
- * <subtable >.
632
+ * <srctable >.
633
633
*/
634
634
static void
635
- transformInhRelation (CreateStmtContext * cxt ,InhRelation * inhRelation )
635
+ transformTableLikeClause (CreateStmtContext * cxt ,TableLikeClause * table_like_clause )
636
636
{
637
637
AttrNumber parent_attno ;
638
638
Relation relation ;
@@ -641,17 +641,17 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
641
641
AclResult aclresult ;
642
642
char * comment ;
643
643
644
- relation = parserOpenTable (cxt -> pstate ,inhRelation -> relation ,
644
+ relation = parserOpenTable (cxt -> pstate ,table_like_clause -> relation ,
645
645
AccessShareLock );
646
646
647
647
if (relation -> rd_rel -> relkind != RELKIND_RELATION )
648
648
ereport (ERROR ,
649
649
(errcode (ERRCODE_WRONG_OBJECT_TYPE ),
650
- errmsg ("inherited relation \"%s\" is not a table" ,
651
- inhRelation -> relation -> relname )));
650
+ errmsg ("LIKE source relation \"%s\" is not a table" ,
651
+ table_like_clause -> relation -> relname )));
652
652
653
653
/*
654
- * Check for SELECTprivilages
654
+ * Check for SELECTprivileges
655
655
*/
656
656
aclresult = pg_class_aclcheck (RelationGetRelid (relation ),GetUserId (),
657
657
ACL_SELECT );
@@ -708,7 +708,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
708
708
* Copy default, if present and the default has been requested
709
709
*/
710
710
if (attribute -> atthasdef &&
711
- (inhRelation -> options & CREATE_TABLE_LIKE_DEFAULTS ))
711
+ (table_like_clause -> options & CREATE_TABLE_LIKE_DEFAULTS ))
712
712
{
713
713
Node * this_default = NULL ;
714
714
AttrDefault * attrdef ;
@@ -736,13 +736,13 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
736
736
}
737
737
738
738
/* Likewise, copy storage if requested */
739
- if (inhRelation -> options & CREATE_TABLE_LIKE_STORAGE )
739
+ if (table_like_clause -> options & CREATE_TABLE_LIKE_STORAGE )
740
740
def -> storage = attribute -> attstorage ;
741
741
else
742
742
def -> storage = 0 ;
743
743
744
744
/* Likewise, copy comment if requested */
745
- if ((inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS )&&
745
+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS )&&
746
746
(comment = GetComment (attribute -> attrelid ,
747
747
RelationRelationId ,
748
748
attribute -> attnum ))!= NULL )
@@ -764,7 +764,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
764
764
* Copy CHECK constraints if requested, being careful to adjust attribute
765
765
* numbers
766
766
*/
767
- if ((inhRelation -> options & CREATE_TABLE_LIKE_CONSTRAINTS )&&
767
+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_CONSTRAINTS )&&
768
768
tupleDesc -> constr )
769
769
{
770
770
AttrNumber * attmap = varattnos_map_schema (tupleDesc ,cxt -> columns );
@@ -787,7 +787,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
787
787
cxt -> ckconstraints = lappend (cxt -> ckconstraints ,n );
788
788
789
789
/* Copy comment on constraint */
790
- if ((inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS )&&
790
+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS )&&
791
791
(comment = GetComment (get_constraint_oid (RelationGetRelid (relation ),
792
792
n -> conname , false),
793
793
ConstraintRelationId ,
@@ -810,7 +810,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
810
810
/*
811
811
* Likewise, copy indexes if requested
812
812
*/
813
- if ((inhRelation -> options & CREATE_TABLE_LIKE_INDEXES )&&
813
+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_INDEXES )&&
814
814
relation -> rd_rel -> relhasindex )
815
815
{
816
816
AttrNumber * attmap = varattnos_map_schema (tupleDesc ,cxt -> columns );
@@ -831,7 +831,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
831
831
index_stmt = generateClonedIndexStmt (cxt ,parent_index ,attmap );
832
832
833
833
/* Copy comment on index */
834
- if (inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS )
834
+ if (table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS )
835
835
{
836
836
comment = GetComment (parent_index_oid ,RelationRelationId ,0 );
837
837