PREPARE vs query with MULTIPLE statements

From: Andrei Kovalevski <andyk(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: PREPARE vs query with MULTIPLE statements
Date: 2007-11-21 05:51:53
Message-ID: 4743C779.6080904@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

I have found an interesting FRONTEND/BACKEND protocol behaviour. Let's
consider following query:
"SELECT 1; SELECT 2; SELECT3; SELECT4;"

1) If I send it as a simple query - I'm getting:
- correct results for SELECT 1; SELECT 2; SELECT3; SELECT4;
- and then one ReadyForQuery response
from backend.
[send_simple.log & recv_simple.log]

2) If I send it as 'PREPARE "SQL_CUR1" AS SELECT 1; SELECT 2; SELECT3;
SELECT4;' and then 'EXECUTE "SQL_CUR1" - I'm getting:
- results for SELECT 1; SELECT2; SELECT 3;
- ReadyForQuery response
- results for SELECT 4;
- one more ReadyForQuery response
from backend
[send_prepared.log & recv_prepared.log]

Is this behavour is correct and expected?

P.s. Tested on Windows with PostgreSQL 8.0, 8.1 and 8.2 with the same
results.

Thank You,
Andrei.

Attachment Content-Type Size
recv_prepare.log text/plain 753 bytes
recv_simple.log text/plain 734 bytes
send_prepare.log text/plain 221 bytes
send_simple.log text/plain 178 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-21 05:57:35 Re: PREPARE vs query with MULTIPLE statements
Previous Message Tom Lane 2007-11-21 03:38:16 Re: possible to create multivalued index from xpath() results in 8.3?