Re: libpq: multiple commands within single query

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Вячеслав Блинников <slavmfm(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: libpq: multiple commands within single query
Date: 2011-01-18 11:55:36
Message-ID: AANLkTimnPL3YjknARH69N3REUEqZZmhR1=Ezg2B+va+3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey,

18 января 2011 г. 14:24 пользователь Вячеслав Блинников
<slavmfm(at)gmail(dot)com>написал:

> By which rules database returns results for multiple commands within single
> query?
> For example I send (execute) such query (obtain different information about
> just connected client):
> "SELECT column1 FROM table1; SELECT column2 FROM table2; SELECT column3
> FROM table3;"
> And when I get response I expect some results (PGresult structure) for EACH
> "SELECT" - so there must be 3 PGresult structures and if one of results
> contains zero rows - it means that there are no data (of such type) for such
> client yet, but there still can be some data for following "SELECT". For
> example (referring to previous example) response can contain 3 results (as I
> expect) where first contains 1 row, second 0 rows and third 1 row. So when I
> examine the response I can match each PGresult to each "SELECT".
> Does it works on this way? Or I missed something?
>
According the documentation: "the client can be handling the
results of one command while the server is still working on later
queries in the same command string.". The key word here is "later".

--
// Dmitriy.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mag Gam 2011-01-18 13:11:58 Re: database slowdown
Previous Message Вячеслав Блинников 2011-01-18 11:24:45 libpq: multiple commands within single query