Re: Get object creation sql script in psql client

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Get object creation sql script in psql client
Date: 2009-01-20 11:47:36
Message-ID: 20090120114736.GD30270@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Igor Katson :
> 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
> );

wait for 8.4:
http://developer.postgresql.org/pgdocs/postgres/functions-info.html
- pg_get_functiondef(func_oid)
- pg_get_indexdef(index_oid)
- pg_get_ruledef(rule_oid)
- pg_get_triggerdef(trigger_oid)
- pg_get_viewdef(view_name)

Unfortunately, i can't see such a function for tabledef.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-20 12:18:39 Re: Autovacuum daemon terminated by signal 11
Previous Message Igor Katson 2009-01-20 11:28:41 Re: How can I look at a recursive table dependency tree?