Re: Fetch zero result rows when executing a query?

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Shay Rojansky <roji(at)roji(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fetch zero result rows when executing a query?
Date: 2015-02-04 05:55:04
Message-ID: 54D1B438.8020906@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/3/15 5:26 AM, Shay Rojansky wrote:
> Sorry if this has been asked before, couldn't find any mention...
>
> I'm working on the Npgsql, the .NET driver for PostgreSQL, and am trying
> to find a way to execute a query but without fetching any rows. The
> Execute message has a maximum result-row count, but zero is documented
> to mean "fetch all rows".
>
> The use case would be sending a query which might modify or might not
> (e.g. UPDATE), but we know that the user is uninterested in any result row.
>
> My current workaround is to specify maxrows=1, was wondering if I missed
> a better alternative.

You might be able to add something like WHERE FALSE to the RETURNING
clause, but I agree with Andres; this seems like premature optimization.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-02-04 07:35:17 Re: [COMMITTERS] pgsql: Add API functions to libpq to interrogate SSL related stuff.
Previous Message Jim Nasby 2015-02-04 05:48:03 Re: Table description in the data file (Re: pg_rawdump)