@@ -102,8 +102,8 @@ static void transformColumnDefinition(CreateStmtContext *cxt,
102102ColumnDef * column );
103103static void transformTableConstraint (CreateStmtContext * cxt ,
104104Constraint * 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 ,
108108TypeName * ofTypename );
109109static char * chooseIndexName (const RangeVar * relation ,IndexStmt * index_stmt );
@@ -238,8 +238,8 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
238238transformTableConstraint (& cxt , (Constraint * )element );
239239break ;
240240
241- case T_InhRelation :
242- transformInhRelation (& cxt , (InhRelation * )element );
241+ case T_TableLikeClause :
242+ transformTableLikeClause (& cxt , (TableLikeClause * )element );
243243break ;
244244
245245default :
@@ -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{
637637AttrNumber parent_attno ;
638638Relation relation ;
@@ -641,17 +641,17 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
641641AclResult aclresult ;
642642char * comment ;
643643
644- relation = parserOpenTable (cxt -> pstate ,inhRelation -> relation ,
644+ relation = parserOpenTable (cxt -> pstate ,table_like_clause -> relation ,
645645AccessShareLock );
646646
647647if (relation -> rd_rel -> relkind != RELKIND_RELATION )
648648ereport (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 SELECTprivilages
654+ * Check for SELECTprivileges
655655 */
656656aclresult = pg_class_aclcheck (RelationGetRelid (relation ),GetUserId (),
657657ACL_SELECT );
@@ -708,7 +708,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
708708 * Copy default, if present and the default has been requested
709709 */
710710if (attribute -> atthasdef &&
711- (inhRelation -> options & CREATE_TABLE_LIKE_DEFAULTS ))
711+ (table_like_clause -> options & CREATE_TABLE_LIKE_DEFAULTS ))
712712{
713713Node * this_default = NULL ;
714714AttrDefault * 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 )
740740def -> storage = attribute -> attstorage ;
741741else
742742def -> 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 ,
747747RelationRelationId ,
748748attribute -> 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 )&&
768768tupleDesc -> constr )
769769{
770770AttrNumber * attmap = varattnos_map_schema (tupleDesc ,cxt -> columns );
@@ -787,7 +787,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
787787cxt -> 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 ),
792792n -> conname , false),
793793ConstraintRelationId ,
@@ -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 )&&
814814relation -> rd_rel -> relhasindex )
815815{
816816AttrNumber * attmap = varattnos_map_schema (tupleDesc ,cxt -> columns );
@@ -831,7 +831,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
831831index_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{
836836comment = GetComment (parent_index_oid ,RelationRelationId ,0 );
837837