From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | John Browne <jkbrowne(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: DDL from psql console? |
Date: | 2005-04-25 15:58:18 |
Message-ID: | 200504251558.j3PFwIc18393@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> John Browne <jkbrowne(at)gmail(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | John Browne | 2005-04-25 16:00:00 | Re: DDL from psql console? |
Previous Message | Jeff Eckermann | 2005-04-25 15:58:05 | Re: Playing with PostgreSQL and Access VBA |