Hi long time we are think how to allow add some custom commands in psql. I had a following idea
1. psql can has special buffer for custom queries. This buffer can be filled by special command \gdefq. This command will have two parameters - name and number of arguments. some like select * from pg_class where relname = :'_first' \gdefcq m1 1 select * from pg_class where relnamespace = :_first::regnamespace and rename = :'_second' \gdefcq m1 2 the custom queries can be executed via doubled backslash like \\m1 pg_proc \\m1 pg_catalog pg_proc the runtime will count number of parameters and chose variant with selected name and same number of arguments. Next, it save parameters to variables like _first, _second. Last step is query execution. What do you think about this? Regards Pavel