Обсуждение: Create Table Scripts

Поиск
Список
Период
Сортировка

Create Table Scripts

От
chuckk@ext.usu.edu
Дата:
You know what I think would be pretty cool?  If someone out there would
tell me that Postgresql can build "Create Table"  scripts by looking at
an existing table.  Then I wouldn't have to re-create my Create Table
scirpt  files I just incinerated....    Yeah... That would be cool if
someone told me it could do that..

sigh.....


Chuck


Re: Create Table Scripts

От
"Brett W. McCoy"
Дата:
On Sat, 6 Jan 2001, Brett W. McCoy wrote:

> On Sat, 6 Jan 2001 chuckk@ext.usu.edu wrote:
>
> > You know what I think would be pretty cool?  If someone out there would
> > tell me that Postgresql can build "Create Table"  scripts by looking at
> > an existing table.  Then I wouldn't have to re-create my Create Table
> > scirpt  files I just incinerated....    Yeah... That would be cool if
> > someone told me it could do that..
>
> pg_dump -s <database>
>
> will dump out scripts to build your database.  If you eliminate the -s, it
> will also dump the data as insert statements.

I'm sorry, that's not quite correct -- the -d option will dump your data
as insert statements, otherwise your data gets dumped directly and can be
copied back into the database as a COPY form stdin.

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Conscience is a mother-in-law whose visit never ends.
        -- H. L. Mencken


Re: Create Table Scripts

От
"Eric Nielsen"
Дата:
Well if you do a pg_dump databasename > somefile
your table specs, among other things, will be in somefile

eric
----- Original Message -----
From: <chuckk@ext.usu.edu>
To: <pgsql-novice@postgresql.org>
Sent: Saturday, January 06, 2001 9:24 AM
Subject: Create Table Scripts


> You know what I think would be pretty cool?  If someone out there would
> tell me that Postgresql can build "Create Table"  scripts by looking at
> an existing table.  Then I wouldn't have to re-create my Create Table
> scirpt  files I just incinerated....    Yeah... That would be cool if
> someone told me it could do that..
>
> sigh.....
>
>
> Chuck
>
>


Re: Create Table Scripts

От
"Brett W. McCoy"
Дата:
On Sat, 6 Jan 2001 chuckk@ext.usu.edu wrote:

> You know what I think would be pretty cool?  If someone out there would
> tell me that Postgresql can build "Create Table"  scripts by looking at
> an existing table.  Then I wouldn't have to re-create my Create Table
> scirpt  files I just incinerated....    Yeah... That would be cool if
> someone told me it could do that..

pg_dump -s <database>

will dump out scripts to build your database.  If you eliminate the -s, it
will also dump the data as insert statements.

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
The light at the end of the tunnel may be an oncoming dragon.


Re: Create Table Scripts

От
Chuck Kimber
Дата:
> > pg_dump -s <database>
> >
> > will dump out scripts to build your database.  If you eliminate the -s, it
> > will also dump the data as insert statements.
>
> I'm sorry, that's not quite correct -- the -d option will dump your data
> as insert statements, otherwise your data gets dumped directly and can be
> copied back into the database as a COPY form stdin.
>
> -- Brett

YOU DA MAN!!

pg_dump -s was perfect!

If I weren't a married man... I'd kiss you...

What the heck.

*smoooooch*

-Chuck