public inbox for [email protected]  
help / color / mirror / Atom feed
From: Damien Clochard <[email protected]>
To: Christoph Berg <[email protected]>
Cc: [email protected]
Subject: Re: Export the CREATE TABLE command in pure SQL
Date: Mon, 18 Mar 2019 18:37:34 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

Le 18.03.2019 16:10, Christoph Berg a écrit :
> Re: Damien Clochard 2019-03-17 
> <[email protected]>
>> How do you guys deal with this ? It seems that a lot of GUI tools are 
>> able
>> to "export the table structure".... Is there an extension somewhere to 
>> do
>> that ? Is it possible to write i in pure SQL ? If yes, there anybody 
>> here
>> interested in joining forces to build a shared export function ?
> 
> IMHO the cleanest way would be to move all of that into the server.
> There are already functions like pg_getindexdef() which pg_dump can
> (could?) use. But of course that won't fix the problem for existing PG
> versions.
> 

Hi Christoph !

This was also my first thought. MySQL has a nice "SHOW CREATE TABLE" 
command and it seems to me that putting this code on the server would be 
a benefit for any GUI tools that tries to export tables structure and 
probably also for schema versionning tools.

https://dev.mysql.com/doc/refman/8.0/en/show-create-table.html

I looked at the pg_dump code and tried to build a C extension that would 
include the dumputils.h header file. But pg_dump is a client-side tool, 
so parts of this code would have to be moved to the server-side. I don't 
have the time and knowledge to propose a patch like that by myself. But 
if someone is interested, I can help...


> For a medium-term solution, a plpgsql extension (or the client-side
> equivalent) seems like the best way.
> 

Agreed.

Thanks for your answer

-- 
Damien Clochard




view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Export the CREATE TABLE command in pure SQL
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox