Re: Generating an ANSI compliant schema recreation script

Lists: pgsql-general
From: J French <hikenboots(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Generating an ANSI compliant schema recreation script
Date: 2005-10-29 22:22:49
Message-ID: 35b7725f0510291522s4ae95e9cs6612707fb1f01696@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I need to capture the schema on a postgres database and recreate it on
another ansi compliant platform. Is it possible to generate a file (perhaps
from pg_dump?) as a sequence of ansi compliant SQL commands which can be
used to recreate the structure?
Thanks in advance!


From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: J French <hikenboots(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Generating an ANSI compliant schema recreation script
Date: 2005-10-29 23:29:55
Message-ID: m2slujhpfw.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

J French <hikenboots(at)gmail(dot)com> writes:

> I need to capture the schema on a postgres database and recreate it on
> another ansi compliant platform. Is it possible to generate a file
> (perhaps from pg_dump?) as a sequence of ansi compliant SQL commands
> which can be used to recreate the structure?

If you had read the pg_dump manpage, you would have seen:

-s, --schema-only dump only the schema, no data

The schema dump will be close to ANSI-compatible, but you will
probably have to edit it a bit.

-Doug


From: J French <hikenboots(at)gmail(dot)com>
To: Douglas McNaught <doug(at)mcnaught(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Generating an ANSI compliant schema recreation script
Date: 2005-10-29 23:50:55
Message-ID: 35b7725f0510291650y1befa026vd01622a91e6f2379@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I did read the page. Been there done that, ran the script. My question was
if there was a canned script out there that I didn't have to clean up on the
fly. This will be an cron job for a convoluted development process. Thanks
though.

On 10/29/05, Douglas McNaught <doug(at)mcnaught(dot)org> wrote:
>
> J French <hikenboots(at)gmail(dot)com> writes:
>
> > I need to capture the schema on a postgres database and recreate it on
> > another ansi compliant platform. Is it possible to generate a file
> > (perhaps from pg_dump?) as a sequence of ansi compliant SQL commands
> > which can be used to recreate the structure?
>
> If you had read the pg_dump manpage, you would have seen:
>
> -s, --schema-only dump only the schema, no data
>
> The schema dump will be close to ANSI-compatible, but you will
> probably have to edit it a bit.
>
> -Doug
>


From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: J French <hikenboots(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Generating an ANSI compliant schema recreation script
Date: 2005-10-29 23:57:25
Message-ID: m2oe57ho62.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

J French <hikenboots(at)gmail(dot)com> writes:

> I did read the page. Been there done that, ran the script. My question
> was if there was a canned script out there that I didn't have to clean up
> on the fly. This will be an cron job for a convoluted development
> process. Thanks though.

Yeah, that would be a bit trickier than a one-off edit. :)

-Doug


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: J French <hikenboots(at)gmail(dot)com>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Generating an ANSI compliant schema recreation script
Date: 2005-10-30 00:45:57
Message-ID: 26426.1130633157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

J French <hikenboots(at)gmail(dot)com> writes:
> I did read the page. Been there done that, ran the script. My question was
> if there was a canned script out there that I didn't have to clean up on the
> fly. This will be an cron job for a convoluted development process.

If your schema isn't using any non-standard features, I would think that
the result of pg_dump would be pretty standard, with the exception of a
few SET commands at the front and the ALTER OWNER commands. (The latter
can be suppressed with --no-owner.) What exactly is giving you a
problem?

regards, tom lane


From: J French <hikenboots(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Generating an ANSI compliant schema recreation script
Date: 2005-10-30 00:54:01
Message-ID: 35b7725f0510291754v512ad017tb231138cd2d8e4ba@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

No problems. I am about to write a python script to cleanup the output of
pg_dump. Before I do I just wanted to verify that there wasn't an already
available script which I could feed directly into another ansi compliant
database without modification. No sense reinventing the wheel. The output of
pg_dump is pretty clean for this purpose already. just thought I'd ask
beforehand.

On 10/29/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> J French <hikenboots(at)gmail(dot)com> writes:
> > I did read the page. Been there done that, ran the script. My question
> was
> > if there was a canned script out there that I didn't have to clean up on
> the
> > fly. This will be an cron job for a convoluted development process.
>
> If your schema isn't using any non-standard features, I would think that
> the result of pg_dump would be pretty standard, with the exception of a
> few SET commands at the front and the ALTER OWNER commands. (The latter
> can be suppressed with --no-owner.) What exactly is giving you a
> problem?
>
> regards, tom lane
>