Re: Parse message is not generating a ParseOk response

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Maurício Linhares <mauricio(dot)linhares(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Parse message is not generating a ParseOk response
Date: 2012-03-11 15:21:35
Message-ID: 24152.1331479295@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?ISO-8859-1?Q?Maur=EDcio_Linhares?= <mauricio(dot)linhares(at)gmail(dot)com> writes:
> I'm writing an async driver for PosgreSQL in Scala (
> https://github.com/mauricio/postgresql-netty ) and I'm now working on
> getting the prepared statements to work. Following the protocol
> documentation for extended queries (
> http://www.postgresql.org/docs/9.1/static/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
> ) it says I should first send a Parse message and wait for a
> ParseComplete message back, but this isn't working for me.

> I send the Parse message and nothing is sent back to me nor the server
> says anything.

You need to add a Sync message if you're going to wait for the Parse to
come back (think of it as being like fflush). Usually, though, people
don't wait for mere ParseComplete, but send additional messages before
waiting; perhaps do a Describe, or proceed directly with execution.
The idea is that if a step fails, the server will send an error and then
skip any subsequent messages till Sync, so you can optimistically assume
the Parse succeeds and do whatever you'd have done next, thus saving
network round-trips.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-03-11 20:51:37 Re: Error installing postgresq91-python package
Previous Message Maurício Linhares 2012-03-11 13:22:32 Parse message is not generating a ParseOk response