Re: DDL from psql console?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: DDL from psql console?
Дата
Msg-id 200504251558.j3PFwIc18393@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: DDL from psql console?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> John Browne <jkbrowne@gmail.com> writes:
> > I was curious if there was a way to get the DDL for a particular table
> > from the psql client console?
>
> No.  Try
>     pg_dump -s -t tablename dbname

Oh, from psql:  :-)  (We really should have an easier way of show all
information from psql)

    test=> CREATE TABLE test (x SERIAL);
    NOTICE:  CREATE TABLE will create implicit sequence "test_x_seq" for
    serial column "test.x"
    CREATE TABLE
    test=> \! pg_dump -s -t test test
    --
    -- PostgreSQL database dump
    --

    SET client_encoding = 'SQL_ASCII';
    SET check_function_bodies = false;
    SET client_min_messages = warning;

    SET search_path = public, pg_catalog;

    SET default_tablespace = '';

    SET default_with_oids = false;

    --
    -- Name: test; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
    --

    CREATE TABLE test (
        x serial NOT NULL
    );


    ALTER TABLE public.test OWNER TO postgres;

    --
    -- PostgreSQL database dump complete
    --

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ben Trewern"
Дата:
Сообщение: Re: Delphi personal (was Playing with PostgreSQL and Access VBA)
Следующее
От: John Browne
Дата:
Сообщение: Re: DDL from psql console?