How To Get The OID Of A Function In PostgreSQL
Get the OID of a PostgreSQL function with regproc, regprocedure, to_regproc() and to_regprocedure()
Buy Me a Coffee☕
An OID(Object identifier) is a unique number (primary key) given to the database objects like functions, procedures, triggers, event triggers, tables, views, etc. *The doc explains an OID.
*In this post, I introduce many examples with a function but you can also use these examples with a procedure.
For example, you create my_func() function as shown below:
CREATE FUNCTION my_func(v1 INT, v2 INT) RETURNS INT
AS $$
BEGIN
RETURN v1 + v2;
END;
$$ LANGUAGE plpgsql;
Now, you can get the OID of my_func() with regproc type, regprocedure type, to_regproc()...