From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | Atul Kumar <akumar14871(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: unbale to list schema |
Date: | 2024-01-17 20:41:45 |
Message-ID: | wpe4bpabsh6tkg4yb55pxz6skylqakrrcowzhammbxjw3hya6n@wfa5rljvq2vn |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2024-01-17 19:46 +0100, Atul Kumar wrote:
> I am not able to find any solution to list all schemas in all databases at
> once, to check the structure of the whole cluster.
You have to connect to each database and run the necessary statements
per database.
> As I need to give a few privileges to a user to all databases, their
> schemas and schemas' objects (tables sequences etc.).
>
> Please let me know if there is any solution/ query that will serve the
> purpose.
What is your environment? You can do that with psql and shell.
For example, in Bash I use the following pattern: select the relevant
database names and loop over the psql output to connect to each
database to run the relevant statements (\dn in this case to list all
schemas).
psql postgres --no-psqlrc -A -t -c "select datname from pg_database where datname <> 'template0'" |
while IFS= read -r dbname
do
psql -d "$dbname" -c '\dn'
done
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2024-01-17 21:03:55 | Re: pg_basebackup Restore problem |
Previous Message | Johnathan Tiamoh | 2024-01-17 20:27:08 | Re: pg_basebackup Restore problem |