Re: SYSTEM_USER reserved word implementation

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Jacob Champion <jchampion(at)timescale(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SYSTEM_USER reserved word implementation
Date: 2022-09-26 13:29:39
Message-ID: e7972fb0-2a29-45d6-b036-52f96b93afe9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 9/8/22 3:17 AM, Michael Paquier wrote:
> On Wed, Sep 07, 2022 at 08:48:43AM -0700, Jacob Champion wrote:
>
>> We could pass the bare auth_method index, or update the documentation
>> for auth_method to state that it's guaranteed to be zero if authn_id is
>> NULL (and then enforce that).
>>
>>> case SVFOP_CURRENT_USER:
>>> case SVFOP_USER:
>>> case SVFOP_SESSION_USER:
>>> + case SVFOP_SYSTEM_USER:
>>> case SVFOP_CURRENT_CATALOG:
>>> case SVFOP_CURRENT_SCHEMA:
>>> svf->type = NAMEOID;
>>
>> Should this be moved to use TEXTOID instead?
>
> Yeah, it should. There is actually a second and much deeper issue
> here, in the shape of a collation problem. See the assertion failure
> in exprSetCollation(), because we expect SQLValueFunction nodes to
> return a name or a non-collatable type. However, for this case, we'd
> require a text to get rid of the 63-character limit, and that's
> a collatable type. This reminds me of the recent thread to work on
> getting rid of this limit for the name type..

Please find attached V4 taking care of Jacob's previous comments.

As far the assertion failure mentioned by Michael when moving the
SVFOP_SYSTEM_USER from NAMEOID to TEXTOID: V4 is assuming that it is
safe to force the collation to C_COLLATION_OID for SQLValueFunction
having a TEXT type, but I would be happy to also hear your thoughts
about it.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v4-0001-system_user-implementation.patch text/plain 16.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-09-26 13:36:35 Avoid memory leaks during base backups
Previous Message Drouvot, Bertrand 2022-09-26 13:28:16 Re: pg_stat_have_stats() returns true for dropped indexes (or for index creation transaction rolled back)