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

Re: [BUGS] General Bug Report: adding column to table w/ index causes column not to be seen

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Diab Jerius <djerius(at)cfa(dot)harvard(dot)edu>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [BUGS] General Bug Report: adding column to table w/ index causes column not to be seen
Date: 1999-05-17 16:11:20
Message-ID: 199905171611.MAA11169@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
I think we fixed this in 6.5 beta.  Can you try that one from our ftp
site?


> --------------------
> It seems that if a column is created in a table with an existant index,
> and an attempt is made to use that index, the backend doesn't
> see the new column.
> 
> --------------------------------------------------------------------------
> 
> Test Case:
> ----------
> The following SQL illustrates the problem:
> 
> ======================================
> drop table snafu;
> create table snafu ( a1 text, a2 text );
> insert into snafu values ( 'snark', 'fido' );
> create index snafu_i1 on snafu using hash ( a1 );
> alter table snafu add column a3 text;
> update snafu set a3 = 'snzay' where a1 = 'snark';
> =========================================
> 
> This results in
> 
> drop table snafu;
> DROP
> 
> create table snafu ( a1 text, a2 text );
> CREATE
> 
> insert into snafu values ( 'snark', 'fido' );
> INSERT 156996266 1
> 
> create index snafu_i1 on snafu using hash ( a1 );
> CREATE
> 
> alter table snafu add column a3 text;
> ADD
> 
> update snafu set a3 = 'snzay' where a1 = 'snark';
> ERROR:  Relation snafu does not have attribute a3
> 
> Removing the "create index ..." line causes the problem to
> go away.
> 
> 
> 
> --------------------------------------------------------------------------
> 
> Solution:
> ---------
> 
> 
> --------------------------------------------------------------------------
> 
> 
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist(at)candle(dot)pha(dot)pa(dot)us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-bugs by date

Next:From: K SambaiahDate: 1999-05-19 07:29:56
Subject: error
Previous:From: Unprivileged userDate: 1999-05-17 15:38:30
Subject: General Bug Report: adding column to table w/ index causes column not to be seen

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