@@ -102,8 +102,8 @@ static void transformColumnDefinition(CreateStmtContext *cxt,
102102 ColumnDef * column );
103103static void transformTableConstraint (CreateStmtContext * cxt ,
104104 Constraint * constraint );
105- static void transformInhRelation (CreateStmtContext * cxt ,
106- InhRelation * inhrelation );
105+ static void transformTableLikeClause (CreateStmtContext * cxt ,
106+ TableLikeClause * table_like_clause );
107107static void transformOfType (CreateStmtContext * cxt ,
108108 TypeName * ofTypename );
109109static char * chooseIndexName (const RangeVar * relation , IndexStmt * index_stmt );
@@ -238,8 +238,8 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
238238 transformTableConstraint (& cxt , (Constraint * ) element );
239239 break ;
240240
241- case T_InhRelation :
242- transformInhRelation (& cxt , (InhRelation * ) element );
241+ case T_TableLikeClause :
242+ transformTableLikeClause (& cxt , (TableLikeClause * ) element );
243243 break ;
244244
245245 default :
@@ -625,14 +625,14 @@ transformTableConstraint(CreateStmtContext *cxt, Constraint *constraint)
625625}
626626
627627/*
628- * transformInhRelation
628+ * transformTableLikeClause
629629 *
630- * Change the LIKE <subtable > portion of a CREATE TABLE statement into
630+ * Change the LIKE <srctable > portion of a CREATE TABLE statement into
631631 * column definitions which recreate the user defined column portions of
632- * <subtable >.
632+ * <srctable >.
633633 */
634634static void
635- transformInhRelation (CreateStmtContext * cxt , InhRelation * inhRelation )
635+ transformTableLikeClause (CreateStmtContext * cxt , TableLikeClause * table_like_clause )
636636{
637637 AttrNumber parent_attno ;
638638 Relation relation ;
@@ -641,17 +641,17 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
641641 AclResult aclresult ;
642642 char * comment ;
643643
644- relation = parserOpenTable (cxt -> pstate , inhRelation -> relation ,
644+ relation = parserOpenTable (cxt -> pstate , table_like_clause -> relation ,
645645 AccessShareLock );
646646
647647 if (relation -> rd_rel -> relkind != RELKIND_RELATION )
648648 ereport (ERROR ,
649649 (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 )));
652652
653653 /*
654- * Check for SELECT privilages
654+ * Check for SELECT privileges
655655 */
656656 aclresult = pg_class_aclcheck (RelationGetRelid (relation ), GetUserId (),
657657 ACL_SELECT );
@@ -708,7 +708,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
708708 * Copy default, if present and the default has been requested
709709 */
710710 if (attribute -> atthasdef &&
711- (inhRelation -> options & CREATE_TABLE_LIKE_DEFAULTS ))
711+ (table_like_clause -> options & CREATE_TABLE_LIKE_DEFAULTS ))
712712 {
713713 Node * this_default = NULL ;
714714 AttrDefault * attrdef ;
@@ -736,13 +736,13 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
736736 }
737737
738738 /* Likewise, copy storage if requested */
739- if (inhRelation -> options & CREATE_TABLE_LIKE_STORAGE )
739+ if (table_like_clause -> options & CREATE_TABLE_LIKE_STORAGE )
740740 def -> storage = attribute -> attstorage ;
741741 else
742742 def -> storage = 0 ;
743743
744744 /* Likewise, copy comment if requested */
745- if ((inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS ) &&
745+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS ) &&
746746 (comment = GetComment (attribute -> attrelid ,
747747 RelationRelationId ,
748748 attribute -> attnum )) != NULL )
@@ -764,7 +764,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
764764 * Copy CHECK constraints if requested, being careful to adjust attribute
765765 * numbers
766766 */
767- if ((inhRelation -> options & CREATE_TABLE_LIKE_CONSTRAINTS ) &&
767+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_CONSTRAINTS ) &&
768768 tupleDesc -> constr )
769769 {
770770 AttrNumber * attmap = varattnos_map_schema (tupleDesc , cxt -> columns );
@@ -787,7 +787,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
787787 cxt -> ckconstraints = lappend (cxt -> ckconstraints , n );
788788
789789 /* Copy comment on constraint */
790- if ((inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS ) &&
790+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS ) &&
791791 (comment = GetComment (get_constraint_oid (RelationGetRelid (relation ),
792792 n -> conname , false),
793793 ConstraintRelationId ,
@@ -810,7 +810,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
810810 /*
811811 * Likewise, copy indexes if requested
812812 */
813- if ((inhRelation -> options & CREATE_TABLE_LIKE_INDEXES ) &&
813+ if ((table_like_clause -> options & CREATE_TABLE_LIKE_INDEXES ) &&
814814 relation -> rd_rel -> relhasindex )
815815 {
816816 AttrNumber * attmap = varattnos_map_schema (tupleDesc , cxt -> columns );
@@ -831,7 +831,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
831831 index_stmt = generateClonedIndexStmt (cxt , parent_index , attmap );
832832
833833 /* Copy comment on index */
834- if (inhRelation -> options & CREATE_TABLE_LIKE_COMMENTS )
834+ if (table_like_clause -> options & CREATE_TABLE_LIKE_COMMENTS )
835835 {
836836 comment = GetComment (parent_index_oid , RelationRelationId , 0 );
837837
0 commit comments