pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vsevolod (Simon) Ilyushchenko <simonf@cshl.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Foreign key pg_dump issue and serial column type
Date: Wed, 29 Jun 2005 21:15:46 -0400
Message-ID: <1391.1120094146@sss.pgh.pa.us> (raw)
In-Reply-To: <42C33C13.5010308@cshl.edu>
References: <42C33C13.5010308@cshl.edu>

"Vsevolod (Simon) Ilyushchenko" <simonf@cshl.edu> writes:
> However, when I pg_dump the database and import it on another server, 
> the tables are exported alphabetically, so when the 'people_roles' table 
> is created with its foreign keys, the table 'roles' does not exist yet. 
> Thus, the foreign key creation fails. Is there a way around it?

Are you sure you are using 8.0 pg_dump?  That's a longstanding
deficiency in older versions, but 8.0 is not supposed to have a problem
with it.  If you're sure it's an up-to-date pg_dump, could you provide a
complete test case (ie, a script to create a database that pg_dump has
trouble with)?

> 2. I've just discovered the 'serial' column type and tried to do this:
> alter table people_roles alter column  people_roles_code type serial;
> To my surprise, it fails:
> ERROR:  type "serial" does not exist

Serial isn't quite a true type, and so it doesn't work in every context
that you might think.  It'd probably make sense for "alter column type"
to accept it, but for now what you gotta do is create a sequence
and set the column default manually.

			regards, tom lane



view thread (2+ messages)

Message-ID: <1391.1120094146@sss.pgh.pa.us>
Permalink:  ../1391.1120094146@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1391.1120094146@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, simonf@cshl.edu
  Subject: Re: Foreign key pg_dump issue and serial column type
  In-Reply-To: <1391.1120094146@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox