Re: ecpg threading vs win32

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, PGSQL-Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: ecpg threading vs win32
Date: 2007-04-03 01:06:17
Message-ID: 200704030106.l3316HL09204@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Michael, is there any progress on this?

---------------------------------------------------------------------------

Michael Meskes wrote:
> On Mon, Mar 19, 2007 at 09:48:19AM +0100, Magnus Hagander wrote:
> > > Q2. Do we need to use PQescapeStringConn() instead of PQescapeString()?
> > > PQescapeString() is used to escape literals, and the documentation says
> > > PQescapeStringConn() should be used in multi-threaded client programs.
> > > http://momjian.us/main/writings/pgsql/sgml/libpq-exec.html#LIBPQ-EXEC-ESCAPE-STRING
> > > | PQescapeString can be used safely in single-threaded client programs
> > > | that work with only one PostgreSQL connection at a time
> >
> > Seems so, but that's unrelated to this patch ;-) I'll leave the final
> > comment on that up to Michael.
>
> Looking at the source code it seems to me that the connection argument
> is only used once in PQescapeStringInternal which both functions call.
> Here's the snippet:
>
> if (conn)
> printfPQExpBuffer(&conn->errorMessage,
> libpq_gettext("incomplete multibyte character\n"));
>
> So this essantially is only to get an error message into the connection
> structure. However, having an empty connection makes PQescapeStringConn
> return an error and an empty string which I consider a problem. I have
> to check that in detail but we may run into a usage of
> PQescapeString without an open connection which then would fail.
>
> Michael
> --
> Michael Meskes
> Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
> ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
> Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-04-03 01:09:15 Re: Make CLUSTER MVCC-safe
Previous Message Bruce Momjian 2007-04-03 00:28:15 Re: [HACKERS] Arrays of Complex Types