Subject: Several troubles with Postgres.

From: [email-masked] (Fernando Ariznavarreta)
Date: Mon, 26 Apr 93 12:09:20 -0700

Hello,
		We've found several troubles developing under Postgres.
I'll explain them next, but first I would like to thank Mr Paul M. Aoki for
his answers to our problems with the unique number generator and modifying
tuples creation time: he gave us good news - we don't need the number generator
at all- and bad news - it doesn't seem possible to change the tmin of a tuple.
This are real bad news as we cannot use Postgres capabilities to maintain our
data and archive it.

The problems we have with Postgres 4.01 are of several kinds: 
	1.- When we compile a program that uses LIBPQ library using the
compiler in ansi mode, it complains about libpq headers files: a trivial
warning about caracter following #endif and other more serious about unexpected
symbol pbuff_alloc in libpq and other errors similar to this.
This means we cannot use ansi function prototypes and other ansi facilities
and we have to develope our code in old Kerninham & Ritchie C style.
Does anybody know how to fix this problem?

	2.- In the application we are developing, the data is input 
automatically in the postgres database, as it is data from automatic sensing
devices. Once we have receive a block of data, we cannot loose it, we have
to insert it in the database or if it is not possible (e.g. due to a postmaster
crash or any other error) we should grab the data in a file to insert it later
when the problem was fixed. The trouble is that when I call PQsetdb(), if
the Postmaster has crashed - or in many other errors- the library never returns
control to my program it gives an error message and then makes an exit(1), so
I cannot write my data to a file or try to make a crash recovery.
	I think that a library - libpq in this case - shouldn't exit from
the program on its own, it might return an error to the calling program and
let it decide what to do in case of error. Doesn't anybody have this kind of
problem with libpq?

-- 
Fernando Ariznavarreta Fernandez       E-Mail:[email-masked]
Dpto. Explotacion y Prospeccion de Minas     Phone: +34 8 510 4267
School of Mines. University of Oviedo               +34 8 510 4336
Independencia, 13                            Fax:   +34 8 510 4242
Oviedo 33004, SPAIN                                 +34 8 510 4340

---

From: [email-masked]
Date: Tue, 27 Apr 93 05:39:55 -0700

I also use postgres to store and manupulate data collected from
sensing equipment.  WRT your problems, I suggest workaround:

 >2.- The trouble is that when I call PQsetdb(), if the Postmaster has
  crashed - or in many other errors- the library never returns control
  to my program it gives an error message and then makes an exit(1)

Fork a subprocess to do the data insertion.  You can then do a wait
and find out if it succeeded.

Still, libPQ is somewhat ill designed in it's treatment of errors.
I suggest to the developers that they should examine X11 xlib and
model the libPQ error handling after that.  Error handling should be
entirely under the control of the calling code.
---
 Robert Withrow, Tel: +1 617 598 4480, Fax: +1 617 598 4430, Net: [email-masked]
 R.W. Withrow Associates, 21 Railroad Ave, Swampscott MA 01907-1821 USA