| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: [PLPGSQL] PERFORM into an EXECUTE allowed ? |
| Date: | 2008-10-27 12:12:32 |
| Message-ID: | 14074.1225109552@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com> writes:
> Le 27/10/08 05:16, Tom Lane a crit :
>> Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com> writes:
>>> EXECUTE 'PERFORM COUNT(*)'
>>> || ' FROM ' || quote_ident(TG_RELNAME)
>>> || ' GROUP BY ' || quote_ident(column_name_to_check)
>>> || ' HAVING COUNT(*) > 1';
>>
>> PERFORM is a plpgsql keyword, not a SQL keyword, so it's not surprising
>> that this fails. What I'm wondering is what exactly you hope the above
>> will accomplish? Why would you want to execute this query only to have
>> the results discarded?
> I only want to know if there is at least one result for this query.
> I don't want to get the results itself.
In that case you just do EXECUTE 'SELECT ...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sam Mason | 2008-10-27 12:16:46 | Re: psql screen size |
| Previous Message | Serge Fonville | 2008-10-27 11:26:51 | Re: nearest neighbor search from xyz coordinates |