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

Поиск
Список
Период
Сортировка
От Corey Huinker
Тема Re: [HACKERS] Idea on how to simplify comparing two sets
Дата
Msg-id CADkLM=cABSZQ2_bebAN2mCdb8cw32g96RkDgXCAqcTFVLkd-CA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Idea on how to simplify comparing two sets  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: [HACKERS] Idea on how to simplify comparing two sets  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
FWIW I've found myself needing the precursor to this this (give me the full diff) at least a couple times, and it's quite a PITA on anything but a trivial relation.

It's also not possible to make this easier via an SRF because you don't know in advance what the result set looks like. So the best I've ever come up with is a file that can be included in psql that depends on having set two psql variables to the names of relations that can be queried (and if you need more than a relation you need to create a temp view).

I've wondered about the possibility of allowing PLs the ability to dynamically define their return type based on their arguments. That would allow for an SRF to handle this case, and would be significantly more flexible than trying to do that using pseudotypes.

My experiences are similar. At the moment, I'm resigned to using relying on pgtap:

-- set environment/path to point to "control" 
create temporary table test_1_wants 
as <query of table or function as it was>;

-- set environment/path to point to "experiment" 
create temporary table test_1_has as <query of thing we're trying to test now>;

select results_eq( 'table test_1_has', 'table test_1_wants', 'test 1');

I've had to do it with temp tables any time the environment is different between control/experiment, which is the case when you're developing a drop-in replacement for an SRF or view or whatever.

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

Предыдущее
От: Nico Williams
Дата:
Сообщение: Re: [HACKERS] Idea on how to simplify comparing two sets
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Checksums by default?