Add Users to Group via PSQL


(Jared Needell) #1

I’m working on a PowerShell script to link Discourse groups with AD security groups and my PSQL query gets this error when I try to insert


(Jared Needell) #2

Also attempting via API and I thinking I might be doing it wrong

http://pastebin.com/k3KPFgD6

I get a 403 Forbidden when I this


(Rafael dos Santos Silva) #3

PSQL:

GRANT USAGE, SELECT ON SEQUENCE group_users_id_seq TO mydbuser;

On the PHP:

api_key=key is your api key really “key”.


(Jared Needell) #4

No I scrubbed it out


(Jared Needell) #5
postgres=# GRANT USAGE, SELECT ON SEQUENCE group_users_id_seq TO user;
ERROR:  relation "group_users_id_seq" does not exist

(Jared Needell) #6

I got it to work if I looked up the last ID and manually incremented to the next ID.

Since this is in a script, I can just add the lookup before I execute the INSERT command