BUG #16018: pg_sequence_last_value() doesn't give results for owners
От | PG Bug reporting form |
---|---|
Тема | BUG #16018: pg_sequence_last_value() doesn't give results for owners |
Дата | |
Msg-id | 16018-e617465560d648c5@postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #16018: pg_sequence_last_value() doesn't give results for owners
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 16018 Logged by: Robert Treat Email address: rob@xzilla.net PostgreSQL version: 11.5 Operating system: osx Description: I think there is a bug of sorts with pg_sequence_last_value(), in that the security checks prevent a superuser (or owner) from seeing the last_value of a sequence by way of this function. That seems like a use case that should be supported (and since it isn't, it causes problems for a lot of other use cases). As an example: postgres@54321:pagila=# create sequence x; CREATE SEQUENCE postgres@54321:pagila=# select pg_sequence_last_value('x'::regclass); pg_sequence_last_value ------------------------ (1 row) postgres@54321:pagila=# select * from x; last_value | log_cnt | is_called ------------+---------+----------- 1 | 0 | f (1 row) postgres@54321:pagila=# select * from pg_sequences where sequencename = 'x'; -[ RECORD 1 ]-+-------------------- schemaname | public sequencename | x sequenceowner | postgres data_type | bigint start_value | 1 min_value | 1 max_value | 9223372036854775807 increment_by | 1 cycle | f cache_size | 1 last_value | Related, has_sequence_privilege() seems to indicate that this should all work: postgres@54321:pagila=# select has_sequence_privilege('x'::regclass, 'SELECT,USAGE'::text); has_sequence_privilege ------------------------ t (1 row) The backend code for pg_sequence_last_value is checking this: if (pg_class_aclcheck(relid, GetUserId(), ACL_SELECT | ACL_USAGE) != ACLCHECK_OK) Robert Treat https://xzilla.net
В списке pgsql-bugs по дате отправления: