pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Bug: Outputs a golang format nil without warning or failure when procedure is owned by other role

Open marcintustin opened this issue 1 year ago • 2 comments

Here is some output from pgschema (latest release) (line numbers etc are generated by bat):

───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: schemas/public/procedures/etl_refresh_supply_chain_direction_suppliers_graph.sql
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ --
   2   │ -- Name: etl_refresh_supply_chain_direction_suppliers_graph; Type: PROCEDURE; Schema: -; Owner: -
   3   │ --
   4   │ 
   5   │ CREATE OR REPLACE PROCEDURE etl_refresh_supply_chain_direction_suppliers_graph()
   6 ~ │ LANGUAGE plpgsql
   7 ~ │ AS $$%!s(<nil>)$$;

It would be ideal if in debug mode pgschema could output something useful and/or error out (or warn?) when it encounters a body that's coming up nil.

This is happening specifically for procedures that are owned by roles that my user doesn't have. There's no problem with me accessing the text of those procedures in psql even when not owned by a role I have access to. If I change the owner to a role I do have access to, pgschema is able to dump the text just fine.

marcintustin avatar Sep 19 '25 17:09 marcintustin

Thank you for doing this! I think that being unable to read the body of the function in these cases is also an error, because I can read them just fine with psql. Would you like me to file a separate bug for that?

marcintustin avatar Sep 22 '25 13:09 marcintustin

Please do and provide some details. I will take a look shortly

tianzhou avatar Sep 22 '25 14:09 tianzhou