Re: How to compare the results of two queries?

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: Juan Daniel Santana Rodés <jdsantana(at)estudiantes(dot)uci(dot)cu>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to compare the results of two queries?
Date: 2013-09-17 15:31:07
Message-ID: CAKoxK+5+uBgQjSXMEG+z6hsU41tvjR607o0ArvqrL0_U_Quf_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 17, 2013 at 4:59 PM, Juan Daniel Santana Rodés
<jdsantana(at)estudiantes(dot)uci(dot)cu> wrote:

> For example the execution of the function would be something like ...
>
> select compare('select * from table1', 'select * from table2');
>
> For this case the result is false, then the queries are executed on
> different tables.

I suppose you are taking for sure that both queries references tables
with the same structure, in such case why not computing an hash of
each row to check against the other result set?
About how many rows are we talking? Because it sounds to me like a
good job for a diff-like external tool, is this a possible solution?
Have you considered that the tables could have a different structure
or even just a different layout, in such case a "select *" will return
different results while the data is actually the same?
What is the aim of this?

Luca

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Giuseppe Broccolo 2013-09-17 15:33:26 Re: remove everything before the period
Previous Message Igor Neyman 2013-09-17 15:27:06 Re: How to compare the results of two queries?