 
   FOR i IN 1..10 LOOP
     -- TODO: crete a smart update function that only updates if data has changed, and always returns relevant data. Necessary to deal with object_* fields possibly changing.
-    SELECT INTO r_obj
-        *
-      FROM _object_reference.object o
-      WHERE (o.object_type, o.object_names, o.object_args) = (c_object_type, r.object_names, r.object_args)
-    ;
+    r_obj := _object_reference.object__get_loose(c_object_type, r.object_names, r.object_args);
     IF NOT r_obj IS NULL THEN
       RETURN r_obj.object_id;
     END IF;

  i smallint;
  sql text;
BEGIN
  SELECT INTO r * FROM pg_catalog.pg_identify_object_as_address(c_catalog, 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
        , object_oid
        , secondary
        , c_object_type

) RETURNS int LANGUAGE plpgsql AS $body$
DECLARE
  c_object_type CONSTANT cat_tools.object_type = object_type;
  c_address_classid CONSTANT regclass := cat_tools.object__address_classid(object_type);
  c_reg_type name := _object_reference.reg_type(c_address_classid); -- Verifies regtype is supported, if there is one
  c_oid_field CONSTANT name := coalesce(c_reg_type, 'object_oid');

  c_insert CONSTANT text := format(
