Re: cannot drop intarray extension

Поиск
Список
Период
Сортировка
От jian he
Тема Re: cannot drop intarray extension
Дата
Msg-id CACJufxHweUPLo4Y=HobOoEUoRTv27g7MB+SQo7Sq4N96ntfyEw@mail.gmail.com
обсуждение исходный текст
Ответ на cannot drop intarray extension  (jian he <jian.universality@gmail.com>)
Ответы Re: cannot drop intarray extension
Список pgsql-hackers
On Mon, Jun 3, 2024 at 12:14 PM jian he <jian.universality@gmail.com> wrote:
>
> hi.
>
> ---- setup
> drop table if exist test__int cascade;
> create extension intarray;
>
> CREATE TABLE test__int( a int[] );
> CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 1));
> drop extension intarray cascade;
> NOTICE:  drop cascades to index text_idx
> 2024-06-03 11:53:32.629 CST [41165] ERROR:  cache lookup failed for
> function 17758
> 2024-06-03 11:53:32.629 CST [41165] STATEMENT:  drop extension intarray cascade;
> ERROR:  cache lookup failed for function 17758
>
> ------------------------------------------------
> backtrace info:
> index_getprocinfo
> #0  index_opclass_options (indrel=0x7faeca727b58, attnum=1,
> attoptions=94372901674408, validate=false)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/access/index/indexam.c:1034
> #1  0x000055d4e63a79cb in RelationGetIndexAttOptions
> (relation=0x7faeca727b58, copy=false)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/utils/cache/relcache.c:5872
> #2  0x000055d4e639d72d in RelationInitIndexAccessInfo (relation=0x7faeca727b58)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/utils/cache/relcache.c:1569
> #3  0x000055d4e639c5ac in RelationBuildDesc (targetRelId=24582, insertIt=true)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/utils/cache/relcache.c:1207
> #4  0x000055d4e639e9ce in RelationIdGetRelation (relationId=24582)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/utils/cache/relcache.c:2115
> #5  0x000055d4e5a412fd in relation_open (relationId=24582, lockmode=8)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/access/common/relation.c:58
> #6  0x000055d4e5ae6a06 in index_open (relationId=24582, lockmode=8)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/access/index/indexam.c:137
> #7  0x000055d4e5be61b8 in index_drop (indexId=24582, concurrent=false,
> concurrent_lock_mode=false)
>     at ../../Desktop/pg_src/src4/postgres/src/backend/catalog/index.c:2156
> ------------------------
> i guess it's because we first dropped the function g_intbig_options

in this context, the index "text_idx" has a normal dependency with pg_opclass.
but `drop extension intarray cascade;`,
CASCADE means that we drop the pg_opclass and pg_opclass's inner dependency
first, then drop the index.

while drop index (sub functions
RelationGetIndexAttOptions,index_opclass_options, index_getprocinfo)
requires that pg_opclass and its inner dependencies (namely
g_intbig_options,  g_int_options) are not dropped first.


in deleteObjectsInList, under certain conditions trying to sort the to
be deleted object list
by just using sort_object_addresses seems to work,
but it looks like a hack.
maybe the proper fix would be in findDependentObjects.

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: relfilenode statistics
Следующее
От: Andres Freund
Дата:
Сообщение: Re: relfilenode statistics