pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
AW: Commit 5a2fed911a broke parallel query
2+ messages / 2 participants
[nested] [flat]

* AW: Commit 5a2fed911a broke parallel query
@ 2025-01-02 09:33 Rank, Christian (LfL) <Christian.Rank@lfl.bayern.de>
  2025-01-02 15:53 ` Re: AW: Commit 5a2fed911a broke parallel query Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Rank, Christian (LfL) @ 2025-01-02 09:33 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>; +Cc: PostgreSQL TDBA (LDBV) <PostgreSQL_TDBA@ldbv.bayern.de>

Hello,

just a notice that this sounds like the symptom already described in
	https://www.postgresql.org/message-id/c7896c19adb646e889d5b2e40fdd17c1@ldbv.bayern.de

Regards,
	Christian

-----Ursprüngliche Nachricht-----
Von: Laurenz Albe <laurenz.albe@cybertec.at> 
Gesendet: Montag, 23. Dezember 2024 11:55
An: pgsql-bugs@lists.postgresql.org
Betreff: Commit 5a2fed911a broke parallel query

This is a script to reproduce the problem:

  CREATE ROLE fluff;
  CREATE ROLE duff LOGIN IN ROLE fluff;
  CREATE DATABASE scratch OWNER duff;
  REVOKE CONNECT, TEMP ON DATABASE scratch FROM PUBLIC;

  \c scratch duff
  CREATE TABLE large AS SELECT id FROM generate_series(1, 500000) AS id;
  GRANT SELECT ON large TO fluff;

  SET ROLE fluff;
  SELECT count(*) FROM large;

Since commit 5a2fed911a, this results in:

  ERROR:  permission denied for database "scratch"
  DETAIL:  User does not have CONNECT privilege.
  CONTEXT:  parallel worker

The following patch makes the problem disappear, but I am far
from certain that using the session user is always correct there:

inline patch 1: src/backend/utils/init/postinit.c (+1/-1 lines) download inline-1.patchdiff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index a024b1151d0..150ec3f52f8 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -360,7 +360,7 @@ CheckMyDatabase(const char *name, bool am_superuser, bool override_allow_connect * and save a few cycles.) */ if (!am_superuser && - object_aclcheck(DatabaseRelationId, MyDatabaseId, GetUserId(), + object_aclcheck(DatabaseRelationId, MyDatabaseId, GetSessionUserId(), ACL_CONNECT) != ACLCHECK_OK) ereport(FATAL, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
Yours, Laurenz Albe ^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: AW: Commit 5a2fed911a broke parallel query
  2025-01-02 09:33 AW: Commit 5a2fed911a broke parallel query Rank, Christian (LfL) <Christian.Rank@lfl.bayern.de>
@ 2025-01-02 15:53 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-01-02 15:53 UTC (permalink / raw)
  To: Rank, Christian (LfL) <Christian.Rank@lfl.bayern.de>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>; PostgreSQL TDBA (LDBV) <PostgreSQL_TDBA@ldbv.bayern.de>

"Rank, Christian (LfL)" <Christian.Rank@lfl.bayern.de> writes:
> just a notice that this sounds like the symptom already described in
> 	https://www.postgresql.org/message-id/c7896c19adb646e889d5b2e40fdd17c1@ldbv.bayern.de

Indeed.  My apologies for having not gotten back to you in that
thread.  There is a committed fix now:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=41a252c2ca68ba7239e73abd99fdbf288...

(caution: the fix is nontrivially different in each branch; that
one is for v16)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-01-02 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-02 09:33 AW: Commit 5a2fed911a broke parallel query Rank, Christian (LfL) <Christian.Rank@lfl.bayern.de>
2025-01-02 15:53 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox