pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Get the table creation DDL
Date: Sun, 10 Jul 2022 14:50:27 -0400
Message-ID: <f4a21927-c777-0239-6417-8af47bc76141@gmail.com> (raw)
In-Reply-To: <CAOzAquKN2u1VGsG_R-JsRruexgZAg+uhRHX3UVxmUdij39NWDA@mail.gmail.com>
References: <CA+FnnTw=ryKmxE696KoQ515Z5q1eb5wNr=OnhJv57+CTc9kKzQ@mail.gmail.com>
	<CAOzAquJOSJVya6Ap5-qGTemQ2f_NuN_Qtg1wM0=COSKhodHYoQ@mail.gmail.com>
	<CA+FnnTwZVapcAFf=LsoW0ygLgVFf77rPxZjBCArqV7Q07NvY1g@mail.gmail.com>
	<CA+FnnTzT2-0OXL0abku5iRMz8nOPNWTb-WFnsMFBoJTDudHm_Q@mail.gmail.com>
	<CAOzAquKN2u1VGsG_R-JsRruexgZAg+uhRHX3UVxmUdij39NWDA@mail.gmail.com>

On 7/10/22 13:57, Michael Nolan wrote:
> I do not know those other tools, but there should be documentation for 
> them, as there is in the man page for how to process just one table 
> using pg_dump.   You can pipe the output of pg_dump directly to psql, 
> but I find that's seldom useful.
> --
> Mike Nolan

There is an extension which does precisely what you need:

https://github.com/MichaelDBA/pg_get_tabledef

In my opinion, that is a little inconsistency on the part of the 
maintainers part because there are functions pg_get_functiondef, 
pg_get_indexdef and pg_get_viewdef  but nothing for tables.

https://www.postgresql.org/docs/14/functions-info.html

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

view thread (24+ messages)  latest in thread

Message-ID: <f4a21927-c777-0239-6417-8af47bc76141@gmail.com>
Permalink:  ../f4a21927-c777-0239-6417-8af47bc76141@gmail.com/
Also on:    postgresql.org/message-id/f4a21927-c777-0239-6417-8af47bc76141@gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: gogala.mladen@gmail.com
  Subject: Re: Get the table creation DDL
  In-Reply-To: <f4a21927-c777-0239-6417-8af47bc76141@gmail.com>
  References: <CA+FnnTw=ryKmxE696KoQ515Z5q1eb5wNr=OnhJv57+CTc9kKzQ@mail.gmail.com> <CAOzAquJOSJVya6Ap5-qGTemQ2f_NuN_Qtg1wM0=COSKhodHYoQ@mail.gmail.com> <CA+FnnTwZVapcAFf=LsoW0ygLgVFf77rPxZjBCArqV7Q07NvY1g@mail.gmail.com> <CA+FnnTzT2-0OXL0abku5iRMz8nOPNWTb-WFnsMFBoJTDudHm_Q@mail.gmail.com> <CAOzAquKN2u1VGsG_R-JsRruexgZAg+uhRHX3UVxmUdij39NWDA@mail.gmail.com> <f4a21927-c777-0239-6417-8af47bc76141@gmail.com>

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

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