> Hi > > pá 4. 10. 2024 v 15:16 odesílatel Tatsuo Ishii <is...@postgresql.org> > napsal: > >> Sorry if this has been discussed before. >> >> I wonder why SET ROLE command does not produce a parameter status >> message noticing the new current_user. Note that SET >> SESSION_AUTHORIZATION command produces a parameter status message for >> the new session_authorization value. >> > > This feature was proposed more times > > https://www.postgresql.org/message-id/flat/cafj8prbfu-wzzqhnrwrhn67n0ug8a9-0-9boo69pptchibd...@mail.gmail.com > https://www.postgresql.org/message-id/CAFCRh-_VwScttZi4R8grSd-b%3D7qguAnSzXp_%2BjbdpUkp%3DTfxPQ%40mail.gmail.com
Thank you for the link. I have quickly read through the discussions. If my understanding is correct, most of the conversions were spent for how to make psql handle current role nicely. However in my case I just need backend to produce a new parameter status message when SET ROLE command is executed. Attached one-line patch makes it possible that (it is essentially the same as your initial patch in the thread). This way, older clients including psql is not disturbed because unknown parameter status messages would be ignored. Of course it would be possible to change psql (and possibly psql) so that it stores the new parameter message and use it for nice prompt etc. One of the concerns is, upon connection time we need to handle one more parameter status message. To test possible performance degradation, I ran quick pgbench test with -C option (establish connection on each transaction). (Actual command line was: -S -C -c 1 -T 30) Without patch on master: average connection time = 1.547 ms average connection time = 1.659 ms average connection time = 1.657 ms average: 1.621 ms With patch on master: average connection time = 1.656 ms average connection time = 1.546 ms average connection time = 1.677 ms average: 1.626 ms With patch it was 1.626 - 1.621 = 0.05 ms (0.3%) slower. So my proposal is, to change backend first, then to change psql/libpq if necessary. Best reagards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 686309db58..5780d90a35 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -4367,7 +4367,7 @@ struct config_string ConfigureNamesString[] = {"role", PGC_USERSET, UNGROUPED, gettext_noop("Sets the current role."), NULL, - GUC_IS_NAME | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST + GUC_IS_NAME | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST | GUC_REPORT }, &role_string, "none",