Unbreak comments on composite type attributes.
authorRobert Haas <rhaas@postgresql.org>
Tue, 19 Oct 2010 11:21:58 +0000 (07:21 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 19 Oct 2010 11:21:58 +0000 (07:21 -0400)
Report and diagnosis by Peter Eisentraut.

src/backend/catalog/objectaddress.c
src/test/regress/expected/create_type.out
src/test/regress/sql/create_type.sql

index 93f5ac6beee9ade08f2ea7495f48c214daf81d40..77f0208ccd198270f09c9de249b4640f4fecb134 100644 (file)
@@ -473,7 +473,7 @@ get_object_address_attribute(ObjectType objtype, List *objname,
    /* Extract relation name and open relation. */
    attname = strVal(lfirst(list_tail(objname)));
    relname = list_truncate(list_copy(objname), list_length(objname) - 1);
-   relation = heap_openrv(makeRangeVarFromNameList(relname), lockmode);
+   relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
    reloid = RelationGetRelid(relation);
 
    /* Look up attribute and construct return value. */
index 1d3a22612d31d1d0de684cf92b3401906f1fa742..9d3a82e153a6a4df31ab4d42a8c7544dbfb382da 100644 (file)
@@ -97,6 +97,10 @@ COMMENT ON TYPE bad IS 'bad comment';
 ERROR:  type "bad" does not exist
 COMMENT ON TYPE default_test_row IS 'good comment';
 COMMENT ON TYPE default_test_row IS NULL;
+COMMENT ON COLUMN default_test_row.nope IS 'bad comment';
+ERROR:  column "nope" of relation "default_test_row" does not exist
+COMMENT ON COLUMN default_test_row.f1 IS 'good comment';
+COMMENT ON COLUMN default_test_row.f1 IS NULL;
 -- Check shell type create for existing types
 CREATE TYPE text_w_default;        -- should fail
 ERROR:  type "text_w_default" already exists
index b9cd7af1ab8755d4187921b09950e4a8f4521db5..c667313c7150f1005900f13bc43b4d2daf6867b1 100644 (file)
@@ -95,6 +95,9 @@ SELECT * FROM get_default_test();
 COMMENT ON TYPE bad IS 'bad comment';
 COMMENT ON TYPE default_test_row IS 'good comment';
 COMMENT ON TYPE default_test_row IS NULL;
+COMMENT ON COLUMN default_test_row.nope IS 'bad comment';
+COMMENT ON COLUMN default_test_row.f1 IS 'good comment';
+COMMENT ON COLUMN default_test_row.f1 IS NULL;
 
 -- Check shell type create for existing types
 CREATE TYPE text_w_default;        -- should fail