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

From Juan Daniel Santana Rodés
Subject How to compare the results of two queries?
Date
Msg-id 52386E5F.8080505@estudiantes.uci.cu
Whole thread Raw
Responses Re: How to compare the results of two queries?  (Raymond O'Donnell <rod@iol.ie>)
Re: How to compare the results of two queries?  (Igor Neyman <ineyman@perceptron.com>)
Re: How to compare the results of two queries?  (Luca Ferrari <fluca1978@infinito.it>)
Re: How to compare the results of two queries?  (Eduardo Morras <emorrasg@yahoo.es>)
List pgsql-general
I am developing a task in which I need to know how to compare the
results of two queries ...
I thought about creating a procedure which both queries received by
parameters respectively. Then somehow able to run queries and return if
both have the same result. As a feature of the problem, both queries are
selection.
Here I leave a piece of code I want to do.

create or replace function compare(sql1 character varying, sql2
character varying) returns boolean as
$body$
Declare
Begin
--here in some way to run both queries and then compare
End;
$body$
language 'plpgsql';

I've been studying and I found that there EXECUTE but to use it, first
you should have used PREPARE, and in this case the values ​​of the
parameters are already made ​​inquiries.
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.
Thanks in advance.
Best regards from Cuba.
__________________________________________________
"Todos el 12 de Septiembre con una Cinta Amarilla"
FIN A LA INJUSTICIA, LIBERENLOS YA!!
http://www.antiterroristas.cu
http://justiciaparaloscinco.wordpress.com


pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: best practice for || set of rows --> function --> set of rows
Next
From: Raymond O'Donnell
Date:
Subject: Re: How to compare the results of two queries?