Skip site navigation (1) Skip section navigation (2)

Re: attislocal value changed with the dump

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: elein <elein(at)varlena(dot)com>, alvherre(at)commandprompt(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: attislocal value changed with the dump
Date: 2005-12-04 04:23:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Is there a TODO here?


Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > This is the repro with the sql file below.
> I looked into this, and the answer is you're doing it to yourself;
> you shouldn't be explicitly re-specifying the defaults for the child
> columns.
> > create table answer_numeric (
> > 	avalue	numeric 
> > ) inherits (answer_values) ;
> > alter table answer_numeric alter column avid  set default nextval('answer_values_avid_seq');
> It's unnecessary to have that "alter column set default" command,
> because avid will have inherited the default expression from the parent
> anyway.  The reason that setting it changes pg_dump's output is that
> what you are setting is not quite right: the actual default expression
> in the parent is
> 	nextval('public.answer_values_avid_seq')
> Since that's different, pg_dump concludes that the child's default is
> non-inherited and emits a redefinition of the column.
> The reason I didn't see the same behavior in CVS tip is that now that
> we use regclass literals for nextval() arguments, the changed default
> still lists out the same way as the parent's default, and so pg_dump
> thinks it's an inherited default.
> It strikes me that there is still a risk here, which is that because
> listing of regclass values is search-path-sensitive, pg_dump could
> come to the wrong conclusion about the inheritance of a default when
> the child is in a different schema than the parent.  We could probably
> fix that by comparing adbin strings instead of the reverse-compiled
> expressions to decide if a child default matches its parent or not.
> Alternatively, maybe we should add explicit inheritance information
> to pg_attrdef.  There's already a proposal to do that for constraints...
> 			regards, tom lane
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-bugs by date

Next:From: Bjrn SjleniusDate: 2005-12-04 10:33:42
Subject: BUG #2093: SUM of timeintervals, no problems in 8.0.3
Previous:From: David J N BegleyDate: 2005-12-04 04:04:07
Subject: Re: BUG #2085: pg_dump incompletely dumps ACLs

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group