Thread

  1. Re: [PATCH] Remove make_temptable_name_n()

    Shinya Kato <shinya11.kato@gmail.com> — 2025-10-21T01:42:40Z

    Hi,
    
    On Thu, Oct 16, 2025 at 8:11 PM Aleksander Alekseev
    <aleksander@tigerdata.com> wrote:
    >
    > Hi Álvaro,
    >
    > Thanks for your feedback.
    >
    > > Hmm, but instead of keeping the comment about why this is bogus, why not
    > > just fix it and remove the comment?  You could do something like
    > >
    > > nsp = get_namespace_name( .. );
    > > diffname = psprintf("%s_%s_%d", nsp, RelationGetRelationName( .. ), 2);
    > > tempname = quote_qualified_identifier(nsp, RelationGetRelationName( ... ));
    > >
    > > and then that should be fairly okay, I think, keeping in mind that both
    > > the names involved are internally-generated short strings -- something
    > > like pg_temp_19.pg_temp_28356_2.
    >
    > Sounds good to me. Here is the updated patch v3.
    
    Thank you for the patch.
    
    The v1 revision removed make_temptable_name_n and added psprintf,
    which reduced the code size. However, the code size in v3 is almost
    unchanged, so it's unclear how beneficial this change actually is.
    
    Anyway, I have a minor comment about the patch.
    
    + char* nsp = get_namespace_name(RelationGetNamespace(tempRel));
    + char* temprelname = RelationGetRelationName(tempRel);
    + char* diffrelname = psprintf("%s_%d", temprelname, 2);
    
    In PostgreSQL code, "char *xxx" seems to be more commonly used than "char* xxx".
    
    -- 
    Best regards,
    Shinya Kato
    NTT OSS Center