Re: Windows installation problem at post-install step

2024-07-22 Thread AC Gomez
We On Mon, Jul 22, 2024, 1:51 PM Ertan Küçükoglu wrote: > Adrian Klaver , 22 Tem 2024 Pzt, 20:37 > tarihinde şunu yazdı: > >> What is the command you use to restore the pg_dumpall file? >> > > within psql I run \i > > template1 should not be dropped in the pg_dumpall file. >> >> Is there output

[no subject]

2021-11-22 Thread AC Gomez
Postgres 9.6. We're attempting to delete some old users from a DB. Log into DB as masteruser. Run this block of commands (the_schema=public, and it's the only schema in this particular DB): REVOKE ALL PRIVILEGES ON DATABASE the_database FROM old_role; REVOKE USAGE ON SCHEMA the_schema FROM old_r

Re: Can the current session be notified and refreshed with a new credentials context?

2020-06-22 Thread AC Gomez
by one from the outside application, it also works. But what I understand you to say is that, one can start running a function in PG, change all security context from under it, and it will still work under the original login context, despite the changes. On Mon, Jun 22, 2020 at 6:28 PM Tom Lan

Re: Can the current session be notified and refreshed with a new credentials context?

2020-06-22 Thread AC Gomez
We do hold the original session open. The problem comes when we change the password while that session is open, now the session and the User Mappings are out of synch and we have failure. On Mon, Jun 22, 2020, 6:08 PM Tom Lane wrote: > AC Gomez writes: > > Suppose you have the

Can the current session be notified and refreshed with a new credentials context?

2020-06-22 Thread AC Gomez
Suppose you have the following scenario: 1: Call some function with a certain user and password 2: From inside that function, have several calls using DBLink 3: At some point during the running of that function a password rotation(a separate process) comes along and updates the session user passwo

Re: Best way to use trigger to email a report ?

2020-05-09 Thread AC Gomez
We're posting a flag to a table. The table has an "event" field. When we post the value "email" into that field, a sweeper app that runs on a schedule looks for this flag, then takes the value in the message field and sends that out as an email. On Sat, May 9, 2020, 12:31 PM Tim Clarke wrote:

New Role drop with Grant/Revokes stop working after subsequent runs

2020-05-06 Thread AC Gomez
Hi, On PostgreSQL 9.6. We have developed some code that creates a new role to be used as the main role for DB usage. This code will be called on a predetermined frequency to act a role/pwd rotation mechanism. Each time the code is run we feed it the prior role that was created (the Db owner bein

Database lock on command: GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA, while looping though schemas

2020-04-12 Thread AC Gomez
In PostgreSQL 9.5: I have created a function that does the following: USER CREATE: 'CREATE USER user_x WITH PASSWORD 'abc' CREATEDB CREATEROLE;' WITH GRANT: 'GRANT master_user TO user_x;' GRANT CONNECT ON DATABASE my_db TO user_x LOOP THROUGH ALL USER SCHEMAS: OUTER LOOP: GRANT USAGE ON SC

Looping though schemas to grant access will work in PUBLIC loop iteration but fails on next iteration of user schema at: GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA

2020-04-11 Thread AC Gomez
In PostgreSQL 9.5: I have created a function that does the following: USER CREATE: 'CREATE USER user_x WITH PASSWORD 'abc' CREATEDB CREATEROLE;' WITH GRANT: 'GRANT master_user TO user_x;' GRANT CONNECT ON DATABASE my_db TO user_x LOOP THROUGH ALL USER SCHEMAS: OUTER LOOP: GRANT USAGE ON SC

Re: what happens when you issue ALTER SERVER in a hot environment?

2020-04-07 Thread AC Gomez
Thank you for clarifying. Don't you think this is pertinent information that should be in the ALTER SERVER doc page? On Tue, Apr 7, 2020, 2:59 AM Laurenz Albe wrote: > On Tue, 2020-04-07 at 00:53 -0400, Tom Lane wrote: > > "David G. Johnston" writes: > > > O

what happens when you issue ALTER SERVER in a hot environment?

2020-04-06 Thread AC Gomez
If you issue an ALTER SERVER command and there are active connections with that server in use or new ones are coming in, what happens? Docs on this command say nothing regarding active processing using the server context and changes to it. So I assume it's just handled. For example if you alter us

Re: extract property value from set of json arrays

2020-04-06 Thread AC Gomez
figured it out: select unnest(array_agg(e.db ->> 'e')) as j from tbl_t t cross join lateral jsonb_array_elements((t.jdata->>'b')::jsonb) as c(e) On Mon, Apr 6, 2020 at 10:51 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, Apr 6

extract property value from set of json arrays

2020-04-06 Thread AC Gomez
I have the following in a postgresql table row 1: {"a": 1, "b": "[{"c": "123", "d":"456", "e": "789"}, {"c": "222", "d":"111", "e": "000"} ]"} row 2: {"a": 2, "b": "[{"c": "XXX", "d":"YYY", "e": "ZZZ"}, {"c": "666", "d":"444", "e": "333"} ]"} How do I pullout all "b":"e" values and end up with

Re: Backing out of privilege grants rabbit hole

2020-04-03 Thread AC Gomez
yeah I'm on 9.5, but thanks for the info. On Fri, Apr 3, 2020 at 1:24 PM Adrian Klaver wrote: > On 4/3/20 10:18 AM, Adrian Klaver wrote: > > On 4/2/20 9:59 PM, AC Gomez wrote: > >> Granted. But we are where we are, so I'm assuming this is going to be > >>

Re: Backing out of privilege grants rabbit hole

2020-04-02 Thread AC Gomez
permissions of the group roles. Then you don't > need to revoke the permissions just because an individiual > has left. > > cheers, > raf > > AC Gomez wrote: > > > Thanks for the quick response. The problem is, in most cases the owner is > > not the grantee.

Re: Backing out of privilege grants rabbit hole

2020-04-02 Thread AC Gomez
" kind of thing? On Thu, Apr 2, 2020, 11:37 PM Guyren Howe wrote: > https://www.postgresql.org/docs/12/sql-drop-owned.html > > On Apr 2, 2020, at 20:34 , AC Gomez wrote: > > Do I understand correctly that if a role was assigned countless object > privileges and you want to del

Backing out of privilege grants rabbit hole

2020-04-02 Thread AC Gomez
Do I understand correctly that if a role was assigned countless object privileges and you want to delete that role you have to sift through a myriad of privilege grants in what amounts to a time consuming trial and error exercise until you've got them all? Or is there a single command that with ju

permission denied for schema

2020-04-01 Thread AC Gomez
I'm trying to write a function that eventually will rotate users. Currently I have the code below which works and creates a new user using the prior user which ultimately has the same rights as the master user, ie, can do everything. select mysch.dblink('dbname=mydb user=themasteruser password=abc

Keeping Admin-Owner user but creating new user with effective Admin-Owner access rights?

2020-03-17 Thread AC Gomez
We have the following scenario... We've inherited a situation where we have a master admin user that's used across the board for all processes. We need to undo that one process at a time. So, for each process we thought of creating two secondary users, among which we will rotate a password. Howe

encrypt/decrypt between javascript and postgresql.

2020-03-11 Thread AC Gomez
I'm trying to encrypt/decrypt between javascript and postgresql. I'm using this: https://gist.github.com/vlucas/2bd40f62d20c1d49237a109d491974eb algorithm to encrypt my text, and then in PostgreSQL I use PGCRYPTO.decrypt_iv to decrypt the text. I pass in 'ThisISMySign' to the Encrypt function. E