Re: 'default nextval()' loses schema-qualification in dump ?

From: Arnaud Lesauvage <arnaud(dot)listes(at)codata(dot)eu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-odbc(at)postgresql(dot)org, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: 'default nextval()' loses schema-qualification in dump ?
Date: 2010-07-06 15:02:43
Message-ID: 4C334593.7030300@codata.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-odbc

Le 6/07/2010 16:22, Tom Lane a écrit :
> Arnaud Lesauvage<arnaud(dot)listes(at)codata(dot)eu> writes:
>> 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.
>
> This is a pretty inadequate description of your problem. Let's see the
> exact SQL you are dealing with.

What is the exact information you want me to give ?
Everything I checked came from my analysis of psqlODBC's log.

I saw that in the first case (before the restore) a schema-qualified
nextval() was issued, and after the restore it was not schema qualified
anymore.

I looked further up in the log to see where the sequence name came from,
and it seemed that it came from pg_attrdef.adsrc.
I checked the value of this field in both databases, and it was different.

Maybe psqlODBC does the wrong thing when taking the sequence name from
this field, but my guess was that the problem came from here.

> Note that if the argument of nextval is a plain regclass constant, like
> nextval('seq'::regclass)
> then the constant is in fact a reference to a specific sequence.
> Whether it's displayed with a schema name depends on whether that
> sequence is visible in your search_path.

Displayed in pg_attrdef.adsrc ? It is not in the search_path, and it is
schema qualified before the dump/restore and not after.

As you have understood, I am not very savvy about postgresql's
internals, but from what you say my guess is that the problem is int the
psqlODBC is getting the default value of the sequence ?

Regards,
Arnaud Lesauvage

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sebastian Ritter 2010-07-06 15:13:36 Re: PostgreSQL trigger execution order
Previous Message ChronicDB Community Team 2010-07-06 14:51:24 Feedback on live schema changes and updates for PostgreSQL

Browse pgsql-odbc by date

  From Date Subject
Next Message Tom Lane 2010-07-06 15:17:38 Re: 'default nextval()' loses schema-qualification in dump ?
Previous Message Tom Lane 2010-07-06 14:22:14 Re: 'default nextval()' loses schema-qualification in dump ?