Re: Get object creation sql script in psql client

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Get object creation sql script in psql client
Date: 2009-01-21 11:50:27
Message-ID: gl7263$p40$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-01-20, Igor Katson <descentspb(at)gmail(dot)com> wrote:
> Is there a way to get i.e. table creation sql script from an existing
> table in psql (not postgresql, but psql client), like it is in pgAdmin?
>
> I.e. i point it to existing table 'foo', and it writes:
> CREATE TABLE foo (
> bar int
> );

pg_dump dbname --table=foo --schema-only

I realise this is not what exactly you asked for, nor does it give the
most efficient SQL for many tables.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-01-21 12:00:59 Re: import sql dump with psql - language creation throws error
Previous Message Herouth Maoz 2009-01-21 11:50:01 Re: Slow update