pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Need create table statements from metadata
3+ messages / 2 participants
[nested] [flat]

* Need create table statements from metadata
@ 2019-06-20 21:32  David Gauthier <davegauthierpg@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: David Gauthier @ 2019-06-20 21:32 UTC (permalink / raw)
  To: pgsql-general

psql (9.6.7, server 9.5.2) on linux.

I have 2 DBs, one for dev the other is live.  I want to recreate several
tables in the dev db using the same metadata found in the live db.  But I'm
too lazy to manually transcribe everything and that's prone to error anyway.

In the past, I would just run pg_dump and capture metadata only for
selected tables, then use that to (re)create that tables in the other DB.
But where I am now, they don't give me the privs to run pg_dump.

So I was wondering if there's a way to do this quickly and cleanly without
pg_dump.  Perhaps a stored procedure that pg_dump uses (or something like
that) ?

Thanks in Advance !

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Need create table statements from metadata
@ 2019-06-20 21:59  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: David Gauthier <davegauthierpg@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2019-06-20 21:59 UTC (permalink / raw)
  To: David Gauthier <davegauthierpg@gmail.com>; pgsql-general

On 6/20/19 2:32 PM, David Gauthier wrote:
> psql (9.6.7, server 9.5.2) on linux.
> 
> I have 2 DBs, one for dev the other is live.  I want to recreate several 
> tables in the dev db using the same metadata found in the live db.  But 
> I'm too lazy to manually transcribe everything and that's prone to error 
> anyway.
> 
> In the past, I would just run pg_dump and capture metadata only for 
> selected tables, then use that to (re)create that tables in the other 
> DB.  But where I am now, they don't give me the privs to run pg_dump.

When you say metadata are you talking about the DDL for an object?

Use FDW?:
https://www.postgresql.org/docs/9.6/postgres-fdw.html

> 
> So I was wondering if there's a way to do this quickly and cleanly 
> without pg_dump.  Perhaps a stored procedure that pg_dump uses (or 
> something like that) ?
> 
> Thanks in Advance !


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Need create table statements from metadata
@ 2019-06-20 22:25  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: David Gauthier <davegauthierpg@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2019-06-20 22:25 UTC (permalink / raw)
  To: David Gauthier <davegauthierpg@gmail.com>; pgsql-general

On 6/20/19 2:32 PM, David Gauthier wrote:
> psql (9.6.7, server 9.5.2) on linux.
> 
> I have 2 DBs, one for dev the other is live.  I want to recreate several 
> tables in the dev db using the same metadata found in the live db.  But 
> I'm too lazy to manually transcribe everything and that's prone to error 
> anyway.
> 
> In the past, I would just run pg_dump and capture metadata only for 
> selected tables, then use that to (re)create that tables in the other 
> DB.  But where I am now, they don't give me the privs to run pg_dump.
> 
> So I was wondering if there's a way to do this quickly and cleanly 
> without pg_dump.  Perhaps a stored procedure that pg_dump uses (or 
> something like that) ?

To add to my previous post you can use third party tools:

1) SQL Workbench/J
http://www.sql-workbench.eu/
http://www.sql-workbench.eu/TableSource_png.html

2) pgAdmin
https://www.pgadmin.org/
https://www.pgadmin.org/docs/pgadmin4/4.x/table_dialog.html

> 
> Thanks in Advance !


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-06-20 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 21:32 Need create table statements from metadata David Gauthier <davegauthierpg@gmail.com>
2019-06-20 21:59 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-06-20 22:25 ` Adrian Klaver <adrian.klaver@aklaver.com>

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