From 6a0c84a7360ae94af84dd744f18cbd703f5a7e47 Mon Sep 17 00:00:00 2001 From: Steven Niu Date: Mon, 16 Jun 2025 16:47:02 +0800 Subject: Improve the comment of heap_create_with_catalog() Combine the old comment and new comment. Add decription for relrewrite parameter. --- src/backend/catalog/heap.c | 63 ++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index fbaed5359ad..4b90f4aef35 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -406,36 +406,6 @@ heap_create(const char *relname, return rel; } -/* ---------------------------------------------------------------- - * heap_create_with_catalog - Create a cataloged relation - * - * this is done in multiple steps: - * - * 1) CheckAttributeNamesTypes() is used to make certain the tuple - * descriptor contains a valid set of attribute names and types - * - * 2) pg_class is opened and get_relname_relid() - * performs a scan to ensure that no relation with the - * same name already exists. - * - * 3) heap_create() is called to create the new relation on disk. - * - * 4) TypeCreate() is called to define a new type corresponding - * to the new relation. - * - * 5) AddNewRelationTuple() is called to register the - * relation in pg_class. - * - * 6) AddNewAttributeTuples() is called to register the - * new relation's schema in pg_attribute. - * - * 7) StoreConstraints() is called - vadim 08/22/97 - * - * 8) the relations are closed and the new relation's oid - * is returned. - * - * ---------------------------------------------------------------- - */ /* -------------------------------- * CheckAttributeNamesTypes @@ -1074,10 +1044,36 @@ AddNewRelationType(const char *typeName, InvalidOid); /* rowtypes never have a collation */ } -/* -------------------------------- - * heap_create_with_catalog +/* ---------------------------------------------------------------- + * heap_create_with_catalog + * + * Description: + * Create a cataloged relation. + * + * this is done in multiple steps: + * + * 1) CheckAttributeNamesTypes() is used to make certain the tuple + * descriptor contains a valid set of attribute names and types + * + * 2) pg_class is opened and get_relname_relid() + * performs a scan to ensure that no relation with the + * same name already exists. + * + * 3) heap_create() is called to create the new relation on disk. + * + * 4) TypeCreate() is called to define a new type corresponding + * to the new relation. + * + * 5) AddNewRelationTuple() is called to register the + * relation in pg_class. + * + * 6) AddNewAttributeTuples() is called to register the + * new relation's schema in pg_attribute. + * + * 7) StoreConstraints() is called - vadim 08/22/97 * - * creates a new cataloged relation. see comments above. + * 8) the relations are closed and the new relation's oid + * is returned. * * Arguments: * relname: name to give to new rel @@ -1100,6 +1096,7 @@ AddNewRelationType(const char *typeName, * if false, relacl is always set NULL * allow_system_table_mods: true to allow creation in system namespaces * is_internal: is this a system-generated catalog? + * relrewrite: link to original relation during a table rewrite. * * Output parameters: * typaddress: if not null, gets the object address of the new pg_type entry -- 2.43.0