'WARNING: you don't own a lock of type ExclusiveLock' is printed during the GRANT command on PostgreSQL16.5 - Mailing list pgsql-bugs

From Aya Iwata (Fujitsu)
Subject 'WARNING: you don't own a lock of type ExclusiveLock' is printed during the GRANT command on PostgreSQL16.5
Date
Msg-id OS7PR01MB11964507B5548245A7EE54E70EA212@OS7PR01MB11964.jpnprd01.prod.outlook.com
Whole thread Raw
Responses Re: 'WARNING: you don't own a lock of type ExclusiveLock' is printed during the GRANT command on PostgreSQL16.5
List pgsql-bugs
Hi developers,

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.

[Details]
Version: 
16.5

OS: 
Linux

Build options:
--prefix=/xxx/xxx/xxx' '--with-ssl=openssl' '--without-icu

Build and install command:
make all
make install

Reproduction procedure:

1. Set binaries bin and lib path
2. Initiate the server using initdb command
3. create folder for tablespace
4. start the server usaing pg_ctl command
5. execute the following commands:

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


[Investigated]
- This WARNING did not occur when tested with FEP16.4 using the same "Reproduction procedure:"
- This WARNING did not occur when running CREATE ROLE through GRANT in a single session connected to psql.
- Also, it did not happen when running 'psql -f' with an .sql file
- We have run similar tests in the November releases of v12 through v17, but this is not reported by the tester in
thosereleases.
 
-- Therefore, we have not tried this "Reproduction procedure:" on versions other than 16.5 and 16.4.
- This WARNING message appears in several places, and after modifying the source code to know which elog it is,
seemed to come from ReleaseSysCache() in ExecGrant_common()

Regards,
Aya Iwata
Fujitsu

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
Next
From: PG Bug reporting form
Date:
Subject: BUG #18716: I wanted to upload/restore tar file data, While uploading file facing error, image attached.