Re: libpq Describe Extension [WAS: Bytea and perl]
От | Volkan YAZICI |
---|---|
Тема | Re: libpq Describe Extension [WAS: Bytea and perl] |
Дата | |
Msg-id | 20060624114533.GA2351@alamut.tdm.local обсуждение исходный текст |
Ответ на | Re: libpq Describe Extension [WAS: Bytea and perl] (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: libpq Describe Extension [WAS: Bytea and perl]
Re: libpq Describe Extension [WAS: Bytea and perl] |
Список | pgsql-hackers |
On Jun 16 08:21, Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.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.
Вложения
В списке pgsql-hackers по дате отправления: