From: | Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: libpq Describe Extension [WAS: Bytea and perl] |
Date: | 2006-06-24 11:45:33 |
Message-ID: | 20060624114533.GA2351@alamut.tdm.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-novice |
On Jun 16 08:21, Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Volkan YAZICI wrote:
> >> The problem is, AFAICS, it's not possible to distinguish between a tuple
> >> returning query (T, ..., C, Z or T, E) and a description of a portal (T,
> >> Z). Therefore, I've created a global flag (parsing_row_desc) which is
> >> turned on when we receive a 'T' and turned off if we receive a 'C' or
> >> 'E'. It's a kind of ugly method but the only solution I could come up
> >> with.
>
> > The problem with this solution is that it is not thread-safe. Perhaps
> > you can use a per-PGconn boolean?
Ie replaced the static flag with a conn->queryclass value using
PGQueryClass as Tom suggested. Also updated patch to be compatible with
exports.txt stuff.
> The whole thing sounds like brute force to me. Shouldn't you be adding
> states to enum PGQueryClass, if you need to track what sort of Describe
> you're doing?
I totally agree with the followed ugly style. But IMHO the recursive
parsing (that is followed in pqParseInputN()) of received data is the main
problem behind this. I think, it will even get harder everytime somebody
try to to add another type of message parsing capability to that loop.
For instance, isn't pollution of PGQueryClass with state variables (like
PGQUERY_PREPARE or PGQUERY_DESCRIBE) one of the proofs of this.
While playing with pqParseInputN loops, I feel like coding Lisp recursions
using C syntax; it's quite ridiculous.
Regards.
Attachment | Content-Type | Size |
---|---|---|
libpq_desc_msg.patch.5 | text/plain | 12.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Woodward | 2006-06-24 12:14:10 | Re: vacuum, performance, and MVCC |
Previous Message | Heikki Linnakangas | 2006-06-24 09:40:23 | Re: vacuum, performance, and MVCC |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-06-24 19:42:02 | Re: really simple example of c-code and pqlib library |
Previous Message | pablo sebastian rodriguez | 2006-06-24 00:37:03 | using vars in scripts |