RE: 'WARNING: you don't own a lock of type ExclusiveLock' is printed during the GRANT command on PostgreSQL16.5

From: "Aya Iwata (Fujitsu)" <iwata(dot)aya(at)fujitsu(dot)com>
To: 'Noah Misch' <noah(at)leadboat(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: 'WARNING: you don't own a lock of type ExclusiveLock' is printed during the GRANT command on PostgreSQL16.5
Date: 2024-11-25 05:54:50
Message-ID: OS7PR01MB119646C422A69AC5017A68BDBEA2E2@OS7PR01MB11964.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

>Did you ever see the WARNING with a DATABASE command, or just with a
>TABLESPACE command?

We tried this, but there is no WARNING on GRANT xxx ON DATABASE command.

But I did notice a warning while REVOKE xxx ON TABLESPACE.

$ psql -x -p 5432 -d postgres -c "REVOKE CREATE ON TABLESPACE test_tbl_spc FROM nmluser1;"
WARNING: you don't own a lock of type ExclusiveLock
REVOKE

So both GRANT and REVOKE command on TABLESPACE seems to throw an WARNING.

Best Regards,
Aya Iwata
Fujitsu

> -----Original Message-----
> From: Noah Misch <noah(at)leadboat(dot)com>
> Sent: Thursday, November 21, 2024 10:11 AM
> To: Iwata, Aya/岩田 彩 <iwata(dot)aya(at)fujitsu(dot)com>
> Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
> Subject: Re: 'WARNING: you don't own a lock of type ExclusiveLock' is printed
> during the GRANT command on PostgreSQL16.5
>
> On Tue, Nov 19, 2024 at 10:27:42PM -0800, Noah Misch wrote:
> > On Wed, Nov 20, 2024 at 05:11:07AM +0000, Aya Iwata (Fujitsu) wrote:
> > > During our tests on November release,
> > > we discovered a "WARNING: you don't own a lock of type ExclusiveLock"
> that occurred at a strange time in GRANT command.
>
> > > This is only possible when psql executes each command individually.
> > > $ psql -d postgres -c "CREATE USER nmluser1;"
> > > CREATE ROLE
> > > $ psql -d postgres -c "CREATE TABLESPACE test_tblspace LOCATION
> '/xxx /xxx/pgsql16.5/tbs';"
> > > CREATE TABLESPACE
> > > $ psql -d postgres -c "CREATE DATABASE enc_testdb;"
> > > CREATE DATABASE
> > > $ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE postgres
> TO nmluser1;"
> > > GRANT
> > > $ psql -d postgres -c "GRANT ALL PRIVILEGES ON DATABASE
> enc_testdb TO nmluser1;"
> > > GRANT
> > > $ psql -d postgres -c "GRANT CREATE ON TABLESPACE test_tblspace TO
> nmluser1;"
> > > WARNING:  you don't own a lock of type ExclusiveLock
> > > GRANT
>
> Did you ever see the WARNING with a DATABASE command, or just with a
> TABLESPACE command?
>
> > Thanks for the report. This seems reasonably likely to come from a defect in
> > commit 51ff46d. I will look into it.
>
> Yes, that commit had us reading cc_relisshared before that field got
> initialized. I can reproduce the WARNING in v16+, with GRANT TABLESPACE.
> Before a cache's initialization cc_relisshared==false, so
> SearchSysCacheLocked1() used the wrong locktag. The attached patch is
> about
> right. At a minimum, I still need to work on the details in its log message.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2024-11-25 10:01:54 Re: Build failure with GCC 15 (defaults to -std=gnu23)
Previous Message Noah Misch 2024-11-25 03:42:51 Re: Today's Postgres Releases break login roles