On Fri, Jul 25, 2025 at 9:23 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
>
> Dilip Kumar <dilipbal...@gmail.com> writes:
> > OTOH, we can have a common function and pass object type as parameter
> > i.e. select pg_get_ddl('table', 'mytable'), with this the same
> > function can be extended for different object types.
>
> And you'll work regclass/regtype/etc into that how?  AFAICS the
> only way would involve fundamentally redundant typing:
>
>         select pg_get_ddl('table', 'mytable'::regclass);
>
> How is that better?

I got your point that now we need redundant typing for the objects
which already have reg* types, I think the advantage of this is we
don't need to have different functions names if we support multiple
object types like pg_get_table_ddl, pg_get_function_ddl,
pg_get_role_ddl, instead we can just do that with pg_get_ddl('table',
'mytable'); pg_get_ddl('function', 'mytable'); pg_get_ddl('role',
'myrole'); etc.

-- 
Regards,
Dilip Kumar
Google


Reply via email to