Re: Fetch zero result rows when executing a query?

Поиск
Список
Период
Сортировка
От Stephen R. van den Berg
Тема Re: Fetch zero result rows when executing a query?
Дата
Msg-id 20150204111352.GB25788@cuci.nl
обсуждение исходный текст
Ответ на Fetch zero result rows when executing a query?  (Shay Rojansky <roji@roji.org>)
Ответы Re: Fetch zero result rows when executing a query?  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
Shay Rojansky wrote:
>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.

If you know beforehand the query generates at most one row, then
specifying maxrows=0 is best.
If you know beforehand the query might generate more than one row (SELECT)
yet you also know that you are not interested in those, then maxrows=1
is best; then again, modifying the query to include a LIMIT 1 is even
better, in which case maxrows can be zero again.
maxrows=1 for UPDATE/DELETE/INSERT does not make sense, use maxrows=0.
-- 
Stephen.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Stephen R. van den Berg"
Дата:
Сообщение: Re: Table description in the data file (Re: pg_rawdump)
Следующее
От: "Stephen R. van den Berg"
Дата:
Сообщение: Re: Fetch zero result rows when executing a query?