Feature request: pg_get_tabledef(text)

Поиск
Список
Период
Сортировка
От Hans Schou
Тема Feature request: pg_get_tabledef(text)
Дата
Msg-id CAApBw37LEQoFcDSWFmK_Xh=OfUVPeCqOxXn-sHBYYCbtsequLg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Feature request: pg_get_tabledef(text)
Re: Feature request: pg_get_tabledef(text)
Re: Feature request: pg_get_tabledef(text)
Список pgsql-general
Hi

Similar to pg_get_viewdef() and pg_get_functiondef() it would be useful with a pg_get_tabledef() to get a full description of how a table is defined.

Currently the table definition can be extracted with the command:

  pg_dump -d foo --schema-only --table=bar | egrep '^[^-]'

The psql command '\d bar' gives some of the same information but it is not in a format where it can be used to create a table.

Extra:
With the pg_get_tabledef() function in place it is very close to be possible to implement pg_dump() within the system. So instead of running:
  pg_dump -d foo
one could just run:
  psql -d foo -c 'SELECT pg_dump()'

The function could also be called from within a programming language like Java/PHP.

pg_dump has a lot of options where some of them could be parameters to the pg_dump() function. If using a cloud or other webservice this will be an easy way to make an extra backup.

--
𝕳𝖆𝖓𝖘 𝕾𝖈𝖍𝖔𝖚
☏ ➁➁ ➅➃ ➇⓪ ➁⓪

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Removing oids with pg_repack
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Feature request: pg_get_tabledef(text)