Re: Forbid to DROP temp tables of other sessions

Steven Niu <niushiji@gmail.com>

From: Steven Niu <niushiji@gmail.com>
To: Daniil Davydov <3danissimo@gmail.com>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "Andrey M. Borodin" <x4mmm@yandex-team.ru>, Andres Freund <andres@anarazel.de>, Thomas Munro <thomas.munro@gmail.com>, Rafia Sabih <rafia.pghackers@gmail.com>, Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2025-03-17T10:32:53Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_basebackup: Add missing PQclear in error path


在 2025/3/17 18:13, Daniil Davydov 写道:
> Hi,
> 
> On Mon, Mar 17, 2025 at 4:48 PM Steven Niu <niushiji@gmail.com> wrote:
>>
>> 1. namespace.c, if relation->schemaname is pg_temp but myTempNamespace
>> isn't set, the error information might be misleading. Consider checking
>> OidIsValid(myTempNamespace) first.
> Could you please clarify exactly which place in the code we are
> talking about? I think we handle this case in the
> LookupExplicitNamespace call (with all appropriate error information).
> 

I mean RangeVarGetRelidExtended(), you deleted the following code:

if (!OidIsValid(myTempNamespace))
            relId = InvalidOid; /* this probably can't happen? */


>>
>> 2."you have not any temporary relations" --> "you have no any temporary
>> relations"
> I am not an English speaker, but it seems that "have not" would be
> more correct. Someone has to judge us :)
> 
>>
>> 3. Regarding to the code "strncmp(nspname, "pg_temp", 7)", is it ok when
>> the nspname contains something like "pg_temp_1234"? I think we should
>> use strcmp instead of strncmp for exact matching.
> Great catch! I'll fix it. Please, see v3 patch.
> 
> --
> Best regards,
> Daniil Davydov