PGRES_POLLING_ACTIVE is unused...

Поиск
Список
Период
Сортировка
Искать

PGRES_POLLING_ACTIVE is unused...

От:
Lennert Buytenhek <buytenh@gnu.org>
Дата:
...any reason why it is there at all?

(Please CC, not on this list.)



diff -urN postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml postgresql-7.3.2/doc/src/sgml/libpq.sgml
--- postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml	2003-01-30 20:50:07.000000000 +0100
+++ postgresql-7.3.2/doc/src/sgml/libpq.sgml	2003-02-26 17:20:34.000000000 +0100
@@ -316,9 +316,7 @@
   
   
    If PQconnectStart</> succeeds, the next stage is to poll libpq</> so that it may
-   proceed with the connection sequence.  Loop thus: Consider a connection
-   inactive by default. If PQconnectPoll last returned PGRES_POLLING_ACTIVE</>,
-   consider it active instead. If PQconnectPoll(conn) last returned
+   proceed with the connection sequence.  Loop thus: If PQconnectPoll(conn) last returned
    PGRES_POLLING_READING, perform a select()</> for reading on PQsocket(conn). If
    it last returned PGRES_POLLING_WRITING, perform a select()</> for writing on
    PQsocket(conn). If you have yet to call PQconnectPoll, i.e. after the call
diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c postgresql-7.3.2/src/interfaces/libpq/fe-connect.c
--- postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c	2003-01-30 20:50:07.000000000 +0100
+++ postgresql-7.3.2/src/interfaces/libpq/fe-connect.c	2003-02-26 17:19:04.000000000 +0100
@@ -1090,9 +1090,6 @@
 		 */
 		switch (flag)
 		{
-			case PGRES_POLLING_ACTIVE:
-				break;
-
 			case PGRES_POLLING_OK:
 				return 1;		/* success! */
 
@@ -1804,9 +1801,6 @@
 		 */
 		switch (flag)
 		{
-			case PGRES_POLLING_ACTIVE:
-				break;
-
 			case PGRES_POLLING_OK:
 				return true;	/* success! */
 
diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h
--- postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h	2002-09-04 22:31:47.000000000 +0200
+++ postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h	2003-02-26 17:19:22.000000000 +0100
@@ -65,7 +65,6 @@
 	PGRES_POLLING_READING,		/* These two indicate that one may	  */
 	PGRES_POLLING_WRITING,		/* use select before polling again.   */
 	PGRES_POLLING_OK,
-	PGRES_POLLING_ACTIVE		/* Can call poll function immediately. */
 } PostgresPollingStatusType;
 
 typedef enum

Re: PGRES_POLLING_ACTIVE is unused...

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Lennert Buytenhek  writes:
> ...any reason why it is there at all?

Good question.  Some digging in CVS shows that it was unused even in the
patch that introduced it, and never has been used in any release since.
So it does seem like useless complication.

However, I think it'd be unwise to remove the constant from libpq-fe.h,
because that would break the application of any poor sod who believed
the documentation and wrote code that actually checks for
PGRES_POLLING_ACTIVE.

I'd be inclined to remove it from the documentation and the library
innards, but leave something like this in libpq-fe.h:

	PGRES_POLLING_ACTIVE	/* unused; keep for awhile for
				 * backwards compatibility */


			regards, tom lane

Re: PGRES_POLLING_ACTIVE is unused...

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Lennert Buytenhek wrote:
> ...any reason why it is there at all?
> 
> (Please CC, not on this list.)
> 
> 
> 
> diff -urN postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml postgresql-7.3.2/doc/src/sgml/libpq.sgml
> --- postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml	2003-01-30 20:50:07.000000000 +0100
> +++ postgresql-7.3.2/doc/src/sgml/libpq.sgml	2003-02-26 17:20:34.000000000 +0100
> @@ -316,9 +316,7 @@
>    
>    
>     If PQconnectStart</> succeeds, the next stage is to poll libpq</> so that it may
> -   proceed with the connection sequence.  Loop thus: Consider a connection
> -   inactive by default. If PQconnectPoll last returned PGRES_POLLING_ACTIVE</>,
> -   consider it active instead. If PQconnectPoll(conn) last returned
> +   proceed with the connection sequence.  Loop thus: If PQconnectPoll(conn) last returned
>     PGRES_POLLING_READING, perform a select()</> for reading on PQsocket(conn). If
>     it last returned PGRES_POLLING_WRITING, perform a select()</> for writing on
>     PQsocket(conn). If you have yet to call PQconnectPoll, i.e. after the call
> diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c postgresql-7.3.2/src/interfaces/libpq/fe-connect.c
> --- postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c	2003-01-30 20:50:07.000000000 +0100
> +++ postgresql-7.3.2/src/interfaces/libpq/fe-connect.c	2003-02-26 17:19:04.000000000 +0100
> @@ -1090,9 +1090,6 @@
>  		 */
>  		switch (flag)
>  		{
> -			case PGRES_POLLING_ACTIVE:
> -				break;
> -
>  			case PGRES_POLLING_OK:
>  				return 1;		/* success! */
>  
> @@ -1804,9 +1801,6 @@
>  		 */
>  		switch (flag)
>  		{
> -			case PGRES_POLLING_ACTIVE:
> -				break;
> -
>  			case PGRES_POLLING_OK:
>  				return true;	/* success! */
>  
> diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h
> --- postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h	2002-09-04 22:31:47.000000000 +0200
> +++ postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h	2003-02-26 17:19:22.000000000 +0100
> @@ -65,7 +65,6 @@
>  	PGRES_POLLING_READING,		/* These two indicate that one may	  */
>  	PGRES_POLLING_WRITING,		/* use select before polling again.   */
>  	PGRES_POLLING_OK,
> -	PGRES_POLLING_ACTIVE		/* Can call poll function immediately. */
>  } PostgresPollingStatusType;
>  
>  typedef enum
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: PGRES_POLLING_ACTIVE is unused...

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

This change will be made to the poll patch:


Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Tom Lane wrote:
> Lennert Buytenhek  writes:
> > ...any reason why it is there at all?
> 
> Good question.  Some digging in CVS shows that it was unused even in the
> patch that introduced it, and never has been used in any release since.
> So it does seem like useless complication.
> 
> However, I think it'd be unwise to remove the constant from libpq-fe.h,
> because that would break the application of any poor sod who believed
> the documentation and wrote code that actually checks for
> PGRES_POLLING_ACTIVE.
> 
> I'd be inclined to remove it from the documentation and the library
> innards, but leave something like this in libpq-fe.h:
> 
> 	PGRES_POLLING_ACTIVE	/* unused; keep for awhile for
> 				 * backwards compatibility */
> 
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: PGRES_POLLING_ACTIVE is unused...

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied.  Thanks.

Symbol kept in include file for backward compatibility, with comment.

---------------------------------------------------------------------------


Lennert Buytenhek wrote:
> ...any reason why it is there at all?
> 
> (Please CC, not on this list.)
> 
> 
> 
> diff -urN postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml postgresql-7.3.2/doc/src/sgml/libpq.sgml
> --- postgresql-7.3.2.orig/doc/src/sgml/libpq.sgml	2003-01-30 20:50:07.000000000 +0100
> +++ postgresql-7.3.2/doc/src/sgml/libpq.sgml	2003-02-26 17:20:34.000000000 +0100
> @@ -316,9 +316,7 @@
>    
>    
>     If PQconnectStart</> succeeds, the next stage is to poll libpq</> so that it may
> -   proceed with the connection sequence.  Loop thus: Consider a connection
> -   inactive by default. If PQconnectPoll last returned PGRES_POLLING_ACTIVE</>,
> -   consider it active instead. If PQconnectPoll(conn) last returned
> +   proceed with the connection sequence.  Loop thus: If PQconnectPoll(conn) last returned
>     PGRES_POLLING_READING, perform a select()</> for reading on PQsocket(conn). If
>     it last returned PGRES_POLLING_WRITING, perform a select()</> for writing on
>     PQsocket(conn). If you have yet to call PQconnectPoll, i.e. after the call
> diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c postgresql-7.3.2/src/interfaces/libpq/fe-connect.c
> --- postgresql-7.3.2.orig/src/interfaces/libpq/fe-connect.c	2003-01-30 20:50:07.000000000 +0100
> +++ postgresql-7.3.2/src/interfaces/libpq/fe-connect.c	2003-02-26 17:19:04.000000000 +0100
> @@ -1090,9 +1090,6 @@
>  		 */
>  		switch (flag)
>  		{
> -			case PGRES_POLLING_ACTIVE:
> -				break;
> -
>  			case PGRES_POLLING_OK:
>  				return 1;		/* success! */
>  
> @@ -1804,9 +1801,6 @@
>  		 */
>  		switch (flag)
>  		{
> -			case PGRES_POLLING_ACTIVE:
> -				break;
> -
>  			case PGRES_POLLING_OK:
>  				return true;	/* success! */
>  
> diff -urN postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h
> --- postgresql-7.3.2.orig/src/interfaces/libpq/libpq-fe.h	2002-09-04 22:31:47.000000000 +0200
> +++ postgresql-7.3.2/src/interfaces/libpq/libpq-fe.h	2003-02-26 17:19:22.000000000 +0100
> @@ -65,7 +65,6 @@
>  	PGRES_POLLING_READING,		/* These two indicate that one may	  */
>  	PGRES_POLLING_WRITING,		/* use select before polling again.   */
>  	PGRES_POLLING_OK,
> -	PGRES_POLLING_ACTIVE		/* Can call poll function immediately. */
>  } PostgresPollingStatusType;
>  
>  typedef enum
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
FAQ