pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnaud Lesauvage <arnaud.listes@codata.eu>
To: pgsql-odbc@postgresql.org, pgsql-general <pgsql-general@postgresql.org>
Subject: 'default nextval()' loses schema-qualification in dump ?
Date: Tue, 06 Jul 2010 12:02:30 +0200
Message-ID: <4C32FF36.8030604@codata.eu> (raw)

Hi lists !

We ran into a problem after restoring a database dump.
Postgesql version is 8.4.3 on Win32.

The tables are linked with psqlODBC (v8.03.0400) and have SERIAL primary 
keys (that's why I cross-posted to psql-odbc).
Before the restore, insertion in MSAccess was fine. After the restore, 
insertions failed with a 'currval(<sequence>) not set' error.

After some research, we found in psqlODBC's log that before the restore 
psqlODBC was getting the sequence's nextval with a schema qualified 
call, and after the restore the call was not schema qualified.
I checked in pg_attrdef before and after the dump/restore, and indeed 
the "default nextval()" on this problematic table loses it's schema 
qualification in the process.

Why this doesn't matter in psql, I don't know (the schema in question is 
not in the search_path), but this does break psqlODBC's handling of 
"auto numbering" columns.

I tried a simple dump of the table structure, and indeed the restore 
sets the search_path first and then creates the table without schema 
qualification, neither for the table nore for the sequence.

Is this by design ? How can I work around this ?
I am not sure this is really normal, since the restored database's 
strucure is not matching perfectly the original one's.

Thanks a lot for your thoughts and help on this matter.

Regards,
Arnaud Lesauvage



view thread (13+ messages)  latest in thread

Message-ID: <4C32FF36.8030604@codata.eu>
Permalink:  ../4C32FF36.8030604@codata.eu/
Also on:    postgresql.org/message-id/4C32FF36.8030604@codata.eu

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: arnaud.listes@codata.eu, pgsql-general@postgresql.org
  Subject: Re: 'default nextval()' loses schema-qualification in dump ?
  In-Reply-To: <4C32FF36.8030604@codata.eu>
  References: <4C32FF36.8030604@codata.eu>

* 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