-- -- acs__magic_object_id/1 -- create or replace function acs__magic_object_id( character varying ) returns int4 as $$ declare magic_object_id__name alias for $1; magic_object_id__object_id acs_objects.object_id%TYPE; begin select object_id into magic_object_id__object_id from acs_magic_objects where name = magic_object_id__name; return magic_object_id__object_id; end;$$ language plpgsql;