Re: idea: multiple arguments to_regclass function

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: idea: multiple arguments to_regclass function
Date: 2023-04-16 15:55:43
Message-ID: CAFj8pRDWiM0coB4scmEn_qjt+xfTb9P5uRVY8hU6MSQQA-xRHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ne 16. 4. 2023 v 16:23 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-04-16 16:16:25 Re: Direct I/O
Previous Message Andrew Dunstan 2023-04-16 15:29:47 Re: Direct I/O