On Tue, May 19, 2009 at 7:00 PM, Tom Lane t...@sss.pgh.pa.us wrote:
Merlin Moncure mmonc...@gmail.com writes:
On Mon, May 18, 2009 at 3:13 PM, Joshua Berry yob...@gmail.com wrote:
Is there an easy and efficient way to return a boolean false for a query
that returns no result, and true for one
On Mon, May 18, 2009 at 03:13:56PM -0400, Joshua Berry wrote:
Hello all,
Is there an easy and efficient way to return a boolean false for a query
that returns no result, and true for one that does return a result?
Currently we select the result into a temp table.
SELECT INTO temp_table id
On Mon, May 18, 2009 at 3:13 PM, Joshua Berry yob...@gmail.com wrote:
Hello all,
Is there an easy and efficient way to return a boolean false for a query
that returns no result, and true for one that does return a result?
Probably the best general approach is to:
select count(*) = 1 from
(
Merlin Moncure mmonc...@gmail.com writes:
On Mon, May 18, 2009 at 3:13 PM, Joshua Berry yob...@gmail.com wrote:
Is there an easy and efficient way to return a boolean false for a query
that returns no result, and true for one that does return a result?
Probably the best general approach is
Hello all,
Is there an easy and efficient way to return a boolean false for a
query that returns no result, and true for one that does return a
result?
Currently we select the result into a temp table.
SELECT INTO temp_table id FROM ... ;
IF temp_table IS NULL THEN
resp:= 'NO';
ELSE
Hello
look on GET DIAGNOSTIC statement or FOUND variable
CREATE OR REPLACE FUNCTION foo()
RETURNS boolean AS $$
BEGIN
SELECT INTO temp_table ...
RETURN found;
END;
$$ language plpgsql;
regards
Pavel Stehule
2009/5/18 Joshua Berry yob...@gmail.com:
Hello all,
Is there an easy and
On Mon, May 18, 2009 at 03:13:56PM -0400, Joshua Berry wrote:
Hello all,
Is there an easy and efficient way to return a boolean false for a query
that returns no result, and true for one that does return a result?
Currently we select the result into a temp table.
SELECT INTO temp_table id
On Mon, May 18, 2009 at 3:13 PM, Joshua Berry yob...@gmail.com wrote:
Any hints/tips? Is our original solution okay, or is there something we can
do to improve things?
It seems as if you don't really care about the results of the query-
just whether or not it returns any rows. In that case, why
On Mon, 2009-05-18 at 15:13 -0400, Joshua Berry wrote:
Is there an easy and efficient way to return a boolean false for a
query that returns no result, and true for one that does return a
result?
Presuming that you're not using the values in temp_table, I think you
should be using PERFORM *