Re: Schema variables - new implementation for Postgres 15 (typo) - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: Schema variables - new implementation for Postgres 15 (typo)
Date
Msg-id 20230120203344.zdt3mumffrwy6hva@erthalion.local
Whole thread Raw
In response to Re: Schema variables - new implementation for Postgres 15 (typo)  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Schema variables - new implementation for Postgres 15 (typo)  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
I've accumulated another collection of various questions and comments. As a
side note I'm getting a good feeling about this patch, those part I've read so
far looks good to me.

* I've suddenly realized one could use pseudo types for variables, and
  it not always works. E.g.:

    =# create variable pseudo_array anyarray;
    =# select pseudo_array;
     pseudo_array
    --------------
     NULL

    =# let pseudo_array = ARRAY[1, 2, 3];
    ERROR:  42804: target session variable is of type anyarray but expression is of type integer[]
    LOCATION:  svariableStartupReceiver, svariableReceiver.c:79

    =# create variable pseudo_unknown unknown;
    =# select pseudo_unknown;
    ERROR:  XX000: failed to find conversion function from unknown to text
    LOCATION:  coerce_type, parse_coerce.c:542

  Is it supposed to be like this, or something is missing?

* I think it was already mentioned in the thread, there seems to be not a
  single usage of CHECK_FOR_INTERRUPTS in session_variable.c . But some number
  of loops over the sessionvars are implemented, are they always going to be
  small enough to not make any troubles?

* sync_sessionvars_all explains why is it necessary to copy xact_recheck_varids:

         When we check the variables, the system cache can be invalidated,
         and xact_recheck_varids can be enhanced.

  I'm not quite following what the "enhancement" part is about? Is
  xact_recheck_varids could be somehow updated concurrently with the loop?

* A small typo

    diff --git a/src/backend/commands/session_variable.c b/src/backend/commands/session_variable.c
    --- a/src/backend/commands/session_variable.c
    +++ b/src/backend/commands/session_variable.c
    @@ -485,7 +485,7 @@ sync_sessionvars_all(bool filter_lxid)

            /*
             * When we check the variables, the system cache can be invalidated,
    -        * and xac_recheck_varids can be enhanced. We want to iterate
    +        * and xact_recheck_varids can be enhanced. We want to iterate

NOTE: The commentaries above were made based on the previous patch version, but
it looks like those aspects were not changed.



pgsql-hackers by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Re: Doc: Rework contrib appendix -- informative titles, tweaked sentences
Next
From: Robert Haas
Date:
Subject: Re: almost-super-user problems that we haven't fixed yet