Re: [HACKERS] Idea on how to simplify comparing two sets

Поиск
Список
Период
Сортировка
От Pantelis Theodosiou
Тема Re: [HACKERS] Idea on how to simplify comparing two sets
Дата
Msg-id CAE3TBxxPpDuZFp+MGkzbfZcS1+__7Lhi2Z9Dct7p9MDqg9DQHg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Idea on how to simplify comparing two sets  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers


On Tue, Feb 7, 2017 at 3:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Joel Jacobson <joel@trustly.com> writes:
> Currently there is no simple way to check if two sets are equal.

Uh ... maybe check whether SELECT set1 EXCEPT SELECT set2
and SELECT set2 EXCEPT SELECT set1 are both empty?

                        regards, tom lane


Yes, if the wanted result is true or false, something like this:

SELECT EXISTS (TABLE a EXCEPT TABLE b)   OR EXISTS (TABLE b EXCEPT TABLE a) ;

And if a new operator was added (in the same category as UNION and EXCEPT), it could be:


SELECT EXISTS (TABLE a XORSET TABLE b) ;

What about using the = and <> operators in sets? Is the following allowed in the standard?


SELECT (TABLE a) <> (TABLE b) ;

 

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: [HACKERS] Parallel bitmap heap scan