Ralph Smith <rsmith@xxxxxxxxxxx> writes: > <tt>Yeah your right Alban, that looks bad, but it was an artifact of > 'try-this, try-this, no, try-this'.<br> > <br> > The table is empty, and unfortunately remains that way; nothing gets > inserted.<br> > I tried other variations, however FOUND just isn't behaving as I would > think.<br> (Please avoid html-encoded email.) The original mail looked like you were trying to do perform count(*) from something where something; if found then ... This will in fact *always* set FOUND, because the query always yields exactly one row: that's the nature of aggregate functions. FOUND doesn't respond to whether the result of count(*) was zero or nonzero, but just to the fact that it did deliver a result row. You probably wanted something like perform 1 from something where something; if found then ... which will set FOUND depending on whether there are any rows matching the where-clause. Or you could avoid FOUND altogether: if exists(select 1 from something where something) then ... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general