Обсуждение: Adding group role to a user
Someone here in their infinite wisdom decided that all our group names would contain a "-". Thus, all the groups look like "schema-ro" or "schema-rw", My problem is that neither a "grant <group-name> to <user>;" nor a "alter group <group-name> add user <user>" will work properly as the command interpreter doesn't like the group name having a "-" in it.
So, I'm looking for a work-around up to and including directly altering the pg_auth table. Any ideas?
--
Jay
ALTER GROUP "schema-rw" ADD USER someuser.
-- Korry
> Someone here in their infinite wisdom decided that all our group names
> would contain a "-". Thus, all the groups look like "schema-ro" or
> "schema-rw", My problem is that neither a "grant <group-name> to
> <user>;" nor a "alter group <group-name> add user <user>" will work
> properly as the command interpreter doesn't like the group name having
> a "-" in it.
>
> So, I'm looking for a work-around up to and including directly
> altering the pg_auth table. Any ideas?
> --
> Jay
I think that was only variant I hadn't tried. Looking through the history I had only used a single quote around the group name, not a double, but that did work.
Thanks,
Jay
On Wed, Sep 30, 2015 at 12:24 PM, Korry Douglas <korry.douglas@enterprisedb.com> wrote:
ALTER GROUP "schema-rw" ADD USER someuser.
-- KorrySomeone here in their infinite wisdom decided that all our group names would contain a "-". Thus, all the groups look like "schema-ro" or "schema-rw", My problem is that neither a "grant <group-name> to <user>;" nor a "alter group <group-name> add user <user>" will work properly as the command interpreter doesn't like the group name having a "-" in it.
So, I'm looking for a work-around up to and including directly altering the pg_auth table. Any ideas?
--
Jay
It would have been polite of me to include a reference, apologies.
Group names and user names (which are really role names) are considered to be identifiers. This page explains the quoting rules for identifiers in PostgreSQL: http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html
-- Korry
I think that was only variant I hadn't tried. Looking through the history I had only used a single quote around the group name, not a double, but that did work.Thanks,JayOn Wed, Sep 30, 2015 at 12:24 PM, Korry Douglas <korry.douglas@enterprisedb.com> wrote:
ALTER GROUP "schema-rw" ADD USER someuser.
-- KorrySomeone here in their infinite wisdom decided that all our group names would contain a "-". Thus, all the groups look like "schema-ro" or "schema-rw", My problem is that neither a "grant <group-name> to <user>;" nor a "alter group <group-name> add user <user>" will work properly as the command interpreter doesn't like the group name having a "-" in it.
So, I'm looking for a work-around up to and including directly altering the pg_auth table. Any ideas?
--
Jay