Search code examples
sqlpostgresqlpgadmin

postgreSql/pgAdmin find where custom type is used in functions


I'm updating my custom postgresql type and I need to find where in functions is my type used/returned. How do I do that? Thank you.

type:

-- Type: public.dblchk_picked_qty

-- DROP TYPE public.dblchk_picked_qty;

CREATE TYPE public.dblchk_picked_qty AS
   ("number" text,
    eancode text,
    packageean text,
    name text,
    pickingunit text,
    basicunitsinbox numeric,
    containerid integer,
    ownersordernumber text,
    customerref text);
ALTER TYPE public.dblchk_picked_qty
  OWNER TO nordnet;

Solution

  • Ok, I've worked it out,

    get type oid:

    SELECT reltype
    FROM pg_class  
    WHERE relname = 'dblchk_picked_qty'
    

    find return type in fuctions by type id:

    SELECT proname
    FROM pg_proc 
    WHERE prorettype = 17543