Skip to content

Commit 262c1a4

Browse files
committed
Unbreak comments on composite type attributes.
Report and diagnosis by Peter Eisentraut.
1 parent 9df96f9 commit 262c1a4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/backend/catalog/objectaddress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ get_object_address_attribute(ObjectType objtype, List *objname,
473473
/* Extract relation name and open relation. */
474474
attname = strVal(lfirst(list_tail(objname)));
475475
relname = list_truncate(list_copy(objname), list_length(objname) - 1);
476-
relation = heap_openrv(makeRangeVarFromNameList(relname), lockmode);
476+
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
477477
reloid = RelationGetRelid(relation);
478478

479479
/* Look up attribute and construct return value. */

src/test/regress/expected/create_type.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ COMMENT ON TYPE bad IS 'bad comment';
9797
ERROR: type "bad" does not exist
9898
COMMENT ON TYPE default_test_row IS 'good comment';
9999
COMMENT ON TYPE default_test_row IS NULL;
100+
COMMENT ON COLUMN default_test_row.nope IS 'bad comment';
101+
ERROR: column "nope" of relation "default_test_row" does not exist
102+
COMMENT ON COLUMN default_test_row.f1 IS 'good comment';
103+
COMMENT ON COLUMN default_test_row.f1 IS NULL;
100104
-- Check shell type create for existing types
101105
CREATE TYPE text_w_default; -- should fail
102106
ERROR: type "text_w_default" already exists

src/test/regress/sql/create_type.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ SELECT * FROM get_default_test();
9595
COMMENT ON TYPE bad IS 'bad comment';
9696
COMMENT ON TYPE default_test_row IS 'good comment';
9797
COMMENT ON TYPE default_test_row IS NULL;
98+
COMMENT ON COLUMN default_test_row.nope IS 'bad comment';
99+
COMMENT ON COLUMN default_test_row.f1 IS 'good comment';
100+
COMMENT ON COLUMN default_test_row.f1 IS NULL;
98101

99102
-- Check shell type create for existing types
100103
CREATE TYPE text_w_default; -- should fail

0 commit comments

Comments
 (0)