Hello hackers,

Can you please explain, is this a bug or intended behaviour?

Running as non-privileged user:

postgres=> SELECT datid, datname FROM pg_stat_database FOR UPDATE;
ERROR: permission denied for view pg_stat_database (SQLState: 42501)

But:

postgres=> CREATE VIEW pgsd AS SELECT * FROM pg_stat_database; SELECT datid, datname FROM pgsd FOR UPDATE;
CREATE VIEW
 datid |  datname
-------+-----------
 13021 | postgres
     1 | template1
 13020 | template0
(3 rows)


(And lock is really held by the second SELECT.)

Best regards,

------
Alexander Lakhin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Reply via email to