From: | Dominique Devienne <ddevienne(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Joseph Koshakow <koshy44(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: aclitem binary encoding |
Date: | 2023-07-24 12:44:24 |
Message-ID: | CAFCRh-9zGLQJEirA5W8i91Q4dFSi80nb-TosLu8hqCKM=G9cUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jul 21, 2023 at 4:58 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Joseph Koshakow <koshy44(at)gmail(dot)com> writes:
> > Is this an intentional decision to not support a binary encoding for
> > aclitem types? Or is it just a lack of a feature?
>
I'm also using binary input/output, and for ACLs, when not using the usual
ACL related functions,
I parse them myself, using code inspired from the official sources.
Something like below (for DBs in this case).
Assumes you can deal with text arrays in your code of course. I hope that
helps. --DD
select ..., coalesce(datacl, acldefault('d', datdba))::text[] as acls,
from pg_database
// See getid() from
https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/acl.c
std::string_view parseAclName(std::string_view sv, std::string& name) { ...
}
// See aclparse() from
https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/acl.c
// And also https://www.postgresql.org/docs/current/ddl-priv.html
std::string_view parseAclPrivs(std::string_view sv, AclFlags& privs,
AclFlags& grantable) { ... }
// Of the form: grantee=privs/grantor
// Where empty grantee means "public"
void parseAclItem(const std::string& s, AclItem& acl) { ... }
std::string_view sv(s);
...
sv = parseAclName(sv, acl.grantee_);
...
sv = parseAclPrivs(sv, acl.privs_, acl.grantable_);
...
sv = parseAclName(sv, acl.grantor_);
...
}
void parseAcls(const std::vector<std::string>& acls_in,
std::vector<AclItem>& acls_out) {
...
for (const std::string& acl : acls_in) {
parseAclItem(acl, acls_out.emplace_back());
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Sabri Taner Burak ALTINDAL | 2023-07-24 13:01:34 | Error 503 Backend fetch failed |
Previous Message | gzh | 2023-07-24 09:54:19 | Re: How to improve the performance of my SQL query? |