Subject: Using inheritance & exceptions

From: Gerry Stringer <[email-masked]>
Date: Tue, 3 Dec 91 07:22:29 -0800

I would like to make use of inheritance in Postgres but I'm finding it
awkward to use. Supposing I have an instance of a DERIVED class in
memory derived from BASE. I would like to be able to say
DERIVED.save_yourself() which inside saves its data to a Postgres class
and triggers BASE.save_yourself(). Currently, doing this seems to
involve:

	1) append'ing a row to DERIVED
	2) retrieve'ing the oid
	3) passing the oid to BASE so that it can replace its data

This is probably not very speedy or flexible, deriving another class
from DERIVED would mean that the new class would need to do the append
and DERIVED a replace.

The only other way I can think of is to use string concatenation to put together appropriate append text.

Has anybody got any better ideas? 

Applications I'm developing use XView (the X toolkit) which crashed
with a "File descriptor closed" message after I had PQexec'd
code with a syntax error in. Unfortunately, this looks like a conflict between XView and libpq's exception handling which makes use of longjmp.
XView seems to want to be on top all the time and the "Xview
Programming Manual" warns against using longjmp and pretty much
anything to do with Unix signals except through its library interface.
I have a gentle plea to library designers to watch out for these
areas (I encountered a similar problem with commercial Ingres).

I want to be able to keep applications working in the face of any DBMS
errors, is there anything else I should do apart from checking for an
"R" status from PQexec?

	Many thanks,

	      gerry

Postgres v3.0 on SPARC SUNOS4.1.1, SUN C++ v2.0

+--------------------------------+---------------------------------+
|Gerry Stringer                  |Phone: +44 954 780926            |
|Cambridge Scanning Company Ltd  |Fax:   +44 954 789829            |
|Saxon Way                       |UUCP : [email-masked]       |
|Bar Hill                        |       [email-masked]        |
|Cambridge CB3 8SL               |       			   |
|United Kingdom                  |                                 |
+--------------------------------+---------------------------------+

---

From: postarch (Postgres Mailing Archive)
Date: Wed, 11 Dec 91 16:19:13 PST

you write:
> code with a syntax error in. Unfortunately, this looks like a conflict between
> XView and libpq's exception handling which makes use of longjmp.

None of the code that comprises libpq uses setjmp, longjmp or relies on
unix signals.  These are exploited in the backend, but that is of course
an entirely different process and won't affect the goings on in XView.

> errors, is there anything else I should do apart from checking for an

You might consider modifying the libpq code slightly.  As of now, if it
reads garbage on the line or gets nothing back from the backend it will exit.
When the backend crashes one of these two events are the only possible
occurrences.  It might be more useful to you if you changed things so that it
would set up another connection to another backend giving the application
the appearance of a failed query or an aborted transaction.

Jeff Meredith
[email-masked]