Re: How to compare the results of two queries? - Mailing list pgsql-general

From Luca Ferrari
Subject Re: How to compare the results of two queries?
Date
Msg-id CAKoxK+5+uBgQjSXMEG+z6hsU41tvjR607o0ArvqrL0_U_Quf_g@mail.gmail.com
Whole thread Raw
In response to How to compare the results of two queries?  (Juan Daniel Santana Rodés<jdsantana@estudiantes.uci.cu>)
List pgsql-general
On Tue, Sep 17, 2013 at 4:59 PM, Juan Daniel Santana Rodés
<jdsantana@estudiantes.uci.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


pgsql-general by date:

Previous
From: Igor Neyman
Date:
Subject: Re: How to compare the results of two queries?
Next
From: Giuseppe Broccolo
Date:
Subject: Re: remove everything before the period