SQL query that can be used to generate the same output shown in the SQL tab within pgadmin?

Поиск
Список
Период
Сортировка
От Ni Ne
Тема SQL query that can be used to generate the same output shown in the SQL tab within pgadmin?
Дата
Msg-id CY4PR19MB11606306FF6EC3FA9465CEABB5529@CY4PR19MB1160.namprd19.prod.outlook.com
обсуждение исходный текст
Ответы Re: SQL query that can be used to generate the same output shown in the SQL tab within pgadmin?  (Dave Page <dpage@pgadmin.org>)
Re: SQL query that can be used to generate the same output shown in the SQL tab within pgadmin?  (Frank Gard <frank@familie-gard.de>)
Список pgadmin-support
My question is not specifically about how to use pgadmin, I hope that's okay.

When are you in pgadmin you can select an object from the tree on the left-pane, like a View. While that object is selected, if you click the SQL button in the main-pane toolbar, you can see all SQL commands that were used to create/modify that object. So for a view it will show you the SQL commands used to create that view and its SQL code, the comment/description if you added one, any grant statements, etc.

My question is, is there an SQL query I can use to generate that same output myself? I am writing a script that will backup my view definitions and such, and if I could grab the entirety of that output that is shown in the SQL tab it would be perfect. I am not trying to leverage pgadmin specifically for this. My plan was to use psycopg2 to send the query directly to my db server and fetch the results, and stash that output into a file.

I found this query that can be used to generate most of that output. Running against a view named myview it would be:

SELECT * FROM pg_views WHERE viewname='myview';

Some problems with that output is that it doesn't generate the full SQL commands that would be needed to re-create that object in its entirety, and doesn't contain the comment.

Thanks!

В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: Difficulty in installing postgre14 " stack builder" using PG4 admin notes
Следующее
От: Ian Zimmerman
Дата:
Сообщение: postgres tunnelling article