Search Postgresql Archives

Re: Web users as database users?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I used to use a different approach:

1. Create auth() pl/python procedure as follows:

create or replace
function auth(auser_id integer) returns void as $$
    GD['user_id'] = auser_id
$$ language plpythonu;

This procedure is supposed to be called after a sucesseful authorisation (in a database or on application side).

2. Create get_current_user() procedure:

create or replace
function get_current_user() returns integer as $$
    return GD.get('user_id')
$$ language plpythonu stable security definer;

Now you can get current user id from every SQL query or stored procedure. It works fast because Python shared array GD is always present in memory.

On 11. Mar 2020, at 15:46, Michael Lewis <mlewis@xxxxxxxxxxx> wrote:

On Fri, Sep 20, 2019 at 8:19 AM Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
There is a restriction on how many distinct GRANTs you can
issue against any one object --- performance will get bad if the ACL
list gets too large.


Any ballpark numbers here? Are we talking 50 or 8000?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux