On Thu, 8 Jan 2004, Tom Lane wrote:
TL> "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
TL> > Some OSes lack proper snprintf()/vsnprintf() fuctions so PostgreSQL includes
TL> > its own version (src/port/snprintf.c) during building. Unfortunately, this
TL> > version of snprintf() is not reentrant (it uses global vars to keep internal
TL> > state), so for example running libpq-based concurrent applications (threads)
TL> > causes libpq fuctions to fail sometimes.
TL> What platforms have workable thread support but not snprintf? I think
TL> this change is not likely to accomplish much except clutter the snprintf
TL> code ...
I discovered this problem while porting libpq (client interface) on
RTEMS OS (rtems.org). This is an embedded OS and as many other embedded OSes it
lacks non-ANSI C functions (at least RTEMS image from my vendor does not have
them). snprintf()/vsnprintf() functions are not ANSI-compliant so they should be
used with care. This OS has POSIX thread support though I did not use it (i.e. I
keep all PgSQL activity in one thread, so the code was compiled without
--enable-thread-safety). The difficulty I observed is: if even I keep PgSQL
calls serialized, calling bare snprintf() from some other thread would likely
cause concurrent PgSQL call to fail. Quite a strange result for such an
inoffensive action, don't you think so?
Anyway, I have fixed this for my code but if you think that the change is
inappropriate for the main stream then let it be. I guess you would hear some
more complaints as there will be more ports on embedded platforms.
TL> regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Kris Jurka||Date: 2004-01-09 08:46:04|
|Subject: Re: jdbc1.AbstractJdbc1Statement.setBinaryStream bug and|
|Previous:||From: Jonathan Purvis||Date: 2004-01-09 03:01:34|
|Subject: JDBC driver doesn't handle NaN values|