Re: idea: multiple arguments to_regclass function
От | Pavel Stehule |
---|---|
Тема | Re: idea: multiple arguments to_regclass function |
Дата | |
Msg-id | CAFj8pRDWiM0coB4scmEn_qjt+xfTb9P5uRVY8hU6MSQQA-xRHg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: idea: multiple arguments to_regclass function (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
ne 16. 4. 2023 v 16:23 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
Pavel Stehule <pavel.stehule@gmail.com> writes:
> I missing some variants of to_regclass
> to_regclass(schemaname, objectname)
> to_regclass(catalogname, schemaname, objectname)
Can do that already:
to_regclass(quote_ident(schemaname) || '.' || quote_ident(objectname))
I'm not eager to build nine more to_reg* functions to do the equivalent
of that, and even less eager to build eighteen.
Yes, I can. But there is overhead with escaping and string concatenation. And it is a little bit sad, so immediately the parser has to do an inverse process.
Maybe we can introduce only three functions
anyelement get_object(catalogname name, schemaname name, objectname name, returntype anyelement)
anyelement get_object(schemaname name, objectname name, returntype anyelement)
anyelement get_object(objectname name, returntype anyelement)
so usage can be like
DECLATE _tab regclass;
BEGIN
_tab := get_object('public', 'mytab', _tab);
..
?
Regards
Pavel
regards, tom lane
В списке pgsql-hackers по дате отправления: