Sample Header Ad - 728x90

limit user's SELECT query to a fixed number of rows

1 vote
0 answers
1034 views
i have read the following questions: https://dba.stackexchange.com/questions/233307/limit-postgres-results-for-a-user and also noted the recommendation of limiting a user's statement_timeout, however i would like something a little more consistent. noticed one poster on the question mentions that 'row level security' feature would allow someone to enforce this feature. i have read some tutorials that use row-level security to limit what the user can see by enforcing some column relationship, but i don't know how to extend this to a case of limiting rows since it does not impose any column value constraint. i also saw this about using FETCH_COUNT: https://stackoverflow.com/questions/30369100/how-to-handle-large-result-sets-with-psql as an _alternative_ (key word here): if row-level security does not allow us to limit the rows returned per-query for a user, it seems a combination of fetch_count and statement_timeout for a specific user may achieve my goal. is there a way to set the FETCH_COUNT for a user account without having them to specify it in their client/session? thanks in advance.
Asked by gagan (11 rep)
Jan 17, 2022, 01:21 AM