Export the CREATE TABLE command in pure SQL

From: Damien Clochard <damien(at)dalibo(dot)info>
To: pgsql-gui-dev(at)lists(dot)postgresql(dot)org
Subject: Export the CREATE TABLE command in pure SQL
Date: 2019-03-17 08:49:50
Message-ID: 2bc470194b4837c1f733a4e05f569bc6@dalibo.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-gui-dev

hey guys,

The most effective and simplest way to export the creation command of a
table is to use `pg_dump --schema-only`

However for one my projects, I don't have access to pg_dump and I need
to extract the data with a SQL or pl/pgsql function. I already wrote a
naïve implementation that handles primary keys and temporary tables. But
I realize it's probably incomplete and I will have to maintain it for
every new PostgreSQL major version....

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 ?

Have nice day !

--
Damien Clochard

Responses

Browse pgsql-gui-dev by date

  From Date Subject
Next Message Christoph Berg 2019-03-18 15:10:17 Re: Export the CREATE TABLE command in pure SQL
Previous Message Shirley Wang 2018-03-26 15:54:54 Product Designer at Pivotal