Re: Looking for a "show create table " equivalent

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Looking for a "show create table " equivalent
Дата
Msg-id 4E1F7E5B.1060101@postnewspapers.com.au
обсуждение исходный текст
Ответ на Re: Looking for a "show create table " equivalent  (Jasen Betts <jasen@xnet.co.nz>)
Список pgsql-sql
On 14/07/2011 6:22 PM, Jasen Betts wrote:
> On 2011-07-12, B.Rathmann<B.Rathmann@ping.de>  wrote:
>> Hello,
>>
>> I've been trying to find out how to find out which sql was run to create
>> a certain table.
>
> That's like trying to find what change was used to create $1.83

Yep, and just like that question, sometimes any valid answer is fine. 
You might not care if it's $1 + .5 + .2 + .02 + .01 or 183 * 0.01, so 
long as the result is the same.

This is turning out to be a reasonably common question, where people 
want to be able to use functionality of pg_dump from _within_ the 
database system.

If the INFORMATION_SCHEMA isn't sufficient for the OP's purposes or is 
too clumsy for re-creating DDL from, there's another option. It's ugly, 
but you can add a plpythonu or plperlu server-side function that calls 
the server's copy of pg_dump and spits the resulting text back to the 
client.

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088     Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/


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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: Looking for a "show create table " equivalent
Следующее
От: Thomas Kellerer
Дата:
Сообщение: to_char() accepting invalid dates?