Re: Library versioning

From: Alfred Perlstein <bright(at)wintelcom(dot)net>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: Library versioning
Date: 2000-09-18 18:17:19
Message-ID: 20000918111719.E15156@fw.wintelcom.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Michael Meskes <meskes(at)postgresql(dot)org> [000918 05:03] wrote:
> If I change some stuff in a library that forces the user to recompile all
> programs because it's not binary compatible I have to change the major
> number right? But just changing the order in an enum datatype does not
> exactly look like such a big change. But the only way to avoid this problem
> is adding the new entries at the end of the enum. Or do I miss something
> obvious here?

If you re-order an exported emum you are going to complete break binary
compatibility, either bump the major or add the entries at the end.

However there's another problem even if you add at the end, namely
that if previously the 'default' doesn't describe the new values
then you also break compatibility, for instance:

Chapter 17. libpq - C Library

..

At any time during connection, the status of the connection
may be checked, by calling PQstatus. If this is CONNECTION_BAD,
then the connection procedure has failed; if this is CONNECTION_OK,
then the connection is ready. Either of these states should be
equally detectable from the return value of PQconnectPoll, as
above. Other states may be shown during (and only during) an
asynchronous connection procedure. These indicate the current
stage of the connection procedure, and may be useful to provide
feedback to the user for example. These statuses may include:

CONNECTION_STARTED: Waiting for connection to be made.

CONNECTION_MADE: Connection OK; waiting to send.

CONNECTION_AWAITING_RESPONSE: Waiting for a response from the postmaster.

CONNECTION_AUTH_OK: Received authentication; waiting for backend startup.

CONNECTION_SETENV: Negotiating environment.

Note that, although these constants will remain (in order to maintain compatibility) an application should
never rely upon these appearing in a particular order, or at all, or on the status always being one of these
documented values. An application may do something like this:

switch(PQstatus(conn))
{
case CONNECTION_STARTED:
feedback = "Connecting...";
break;

case CONNECTION_MADE:
feedback = "Connected to server...";
break;
.
.
.
default:
feedback = "Connecting...";
}

If you happened to add another error state or something that indicated
some other action was required you'd also be breaking compatibility.

--
-Alfred Perlstein - [bright(at)wintelcom(dot)net|alfred(at)freebsd(dot)org]
"I have the heart of a child; I keep it in a jar on my desk."

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-09-18 19:56:01 Re: AW: AW: "setuid" functions, a solution to the RI privil ege problem
Previous Message Tom Lane 2000-09-18 17:57:36 Re: Notice and share memory corruption