   i smallint;
   sql text;
 BEGIN
-  SELECT INTO r * FROM pg_catalog.pg_identify_object_as_address(c_catalog, object_oid, secondary);
+  SELECT INTO r * FROM pg_catalog.pg_identify_object_as_address(c_address_classid, object_oid, secondary);
 
   IF r IS NULL THEN
     RAISE 'unable to find object'
       USING DETAIL = format(
         'pg_identify_object_as_address(%s, %s, %s) returned NULL for object type %L'
-        , c_catalog
+        , c_address_classid
         , object_oid
         , secondary
         , c_object_type

CREATE UNIQUE INDEX object__u_regprocedure ON _object_reference.object(regprocedure) WHERE regprocedure IS NOT NULL;
CREATE UNIQUE INDEX object__u_regtype ON _object_reference.object(regtype) WHERE regtype IS NOT NULL;

CREATE FUNCTION object_reference.object__getsert(
  object_type   cat_tools.object_type
  , object_oid oid

  , object_oid    oid
  , object_names text[]                  NOT NULL
  , object_args  text[]                  NOT NULL
  , CONSTRAINT object__u_object_names__object_args UNIQUE( object_type, object_names, object_args )
  , CONSTRAINT object__address_sanity
    -- pg_get_object_address will throw an error if anything is wrong, so the IS NOT NULL is mostly pointless
    CHECK( pg_catalog.pg_get_object_address(object_type::text, object_names, object_args) IS NOT NULL )
