Re: [HACKERS] GSoC 2017: Foreign Key Arrays

Поиск
Список
Период
Сортировка
От Mark Rofail
Тема Re: [HACKERS] GSoC 2017: Foreign Key Arrays
Дата
Msg-id CAJvoCuuzY7a=Eqv0nCQjYEz3TE2gzd4j+rDTBn2S5yBjcvZ=KQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] GSoC 2017: Foreign Key Arrays  (Mark Rofail <markm.rofail@gmail.com>)
Ответы Re: [HACKERS] GSoC 2017: Foreign Key Arrays
Список pgsql-hackers
To better understand a limitation I ask 5 questions

What is the limitation?
Why is there a limitation?
Why is it a limitation?
What can we do?
Is it feasible? 

Through some reading:

What is the limitation?
presupposes that count(distinct y) has exactly the same notion of equality that the PK unique index has. In reality, count(distinct) will fall back to the default btree opclass for the array element type. 

the planner may choose an optimization of this sort when the index's opclass matches the one
DISTINCT will use, ie the default for the data type.

Why is there a limitation?
necessary because ri_triggers.c relies on COUNT(DISTINCT x) on the element type, as well as on array_eq() on the array type, and we need those operations to have the same notion of equality that we're using otherwise.

Why is it a limitation?
That's wrong: DISTINCT should use the equality operator that corresponds
to the index' operator class instead, not the default one.

What can we do ?
I'm sure that we can replace array_eq() with a newer polymorphic version but I don't know how we could get around COUNT(DISTINCT x)

Is it feasible? 
I don't think I have the experience to answer that

Best Regards,
Mark Rofail

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Hash Functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] PL_stashcache, or, what's our minimum Perl version?