index on function confuses drop table cascade on child

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема index on function confuses drop table cascade on child
Дата
Msg-id 4CCEE02D020000250003708E@gw.wicourts.gov
обсуждение исходный текст
Ответы Re: index on function confuses drop table cascade on child  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Checkout from HEAD this morning, no modifications.  Did make
distclean and fresh build to ensure no problems caused by mixed
build.  32 bit kubuntu on single drive dual core workstation.  Fresh
initdb.  Default configuration.

postgres=# create database bug;
CREATE DATABASE
postgres=# \c bug
You are now connected to database "bug" as user "kgrittn".
bug=# create table person (namel text not null);
CREATE TABLE
bug=# create table t (id int primary key) inherits (person);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"t_pkey" for table "t"
CREATE TABLE
bug=# create or replace function sname(person) returns text
bug-#   language sql immutable as $$select upper($1.namel)$$;
CREATE FUNCTION
bug=# create index t_sname on t (sname(t));
CREATE INDEX
bug=# select oid, relname from pg_class
bug-#   where relname in ('person','t');
  oid  | relname
-------+---------
 16385 | person
 16391 | t
(2 rows)

bug=# drop table t cascade;
DROP TABLE

[so far, behavior is as expected]

bug=# drop table person cascade;
NOTICE:  drop cascades to 2 other objects
DETAIL:  drop cascades to function sname(person)
drop cascades to index t_sname
ERROR:  could not open relation with OID 16391
bug=# create table person (namel text not null);
ERROR:  relation "person" already exists
bug=# create table t (id int primary key) inherits (person);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"t_pkey" for table "t"
CREATE TABLE
bug=# create or replace function sname(person) returns text
bug-#   language sql immutable as $$select upper($1.namel)$$;
CREATE FUNCTION
bug=# create index t_sname on t (sname(t));
ERROR:  relation "t_sname" already exists
bug=# select oid, relname from pg_class
bug-#   where relname in ('person','t');
  oid  | relname
-------+---------
 16385 | person
 16401 | t
(2 rows)

All is fine if the t_searchname index is left out or the t table
defines all columns directly rather than inheriting them from
person.  Similar failure if person is dropped first or on the same
statement as t.

-Kevin

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5738: btree index search bug
Следующее
От: "Kim Garren"
Дата:
Сообщение: BUG #5739: postgresql will not start