After following your advice and tap on the communications
between frontend and backend (I must say it was a bit
intimidating, but I did have a lot of fun), things are
very weird.
My current working theory is that all the commands are
being executed properly, despite a mysterious random
data exchange that produces the error I'm seeing.
What I observed is the following: message from FE
to BE, data: Qinsert into table ......
Then a reply Pblank.CINSERT.304712345
(I guess the number is the OID of the record inserted).
After that, another message from FE to BE, with an X
(which is "close connection", if I understand correctly).
But then, *after* sending that one, the client sends
another block, starting with an e, or a p. Bang!!
That's my error.
Of course, in my code, I simply do:
if (db.Exec (sql_string) != PGRES_COMMAND_OK)
{
cerr << "Error at ... currentdate ...."
<< db.ErrorMessage() << endl;
}
So, apparently Exec is internally doing more than it
should, and by the time it comes back to the calling
function, it carries the error message corresponding to
the spurious block, after having succesfully executed
the statement).
Sounds familiar to anyone out there? Any sane reason
why this could be happening??
This sounds like the typical symptoms of a case of
undefined behaviour -- some lost pointers and the
like... Except that I practically use no pointers at
all (all of them are encapsulated anyway... I use
*strictly* string class, vector, list, and map -- there
is not *a single* use of any pointer in the classical
sense of using pointers -- i.e., pointer manipulation
of data structures, raw allocation, pointer arithmetic,
etc.). Can you think of other explanations?
Thanks!
Carlos
--