Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2c4d41

Browse files
committed
Hi,
Just in case you'd like to see what I was talking about, I amattachingmy patch to src/interfaces/libpq/fe-exec.c to prevent utility functionscalled from SPI from locking up the client.Jerry Gay
1 parent80db587 commite2c4d41

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.74 1999/02/13 23:22:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.75 1999/03/14 16:42:15 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -467,6 +467,7 @@ static void
467467
parseInput(PGconn*conn)
468468
{
469469
charid;
470+
staticintpendingT=0;
470471

471472
/*
472473
* Loop to parse successive complete messages available in the buffer.
@@ -535,7 +536,15 @@ parseInput(PGconn *conn)
535536
PGRES_COMMAND_OK);
536537
if (pqGets(conn->result->cmdStatus,CMDSTATUS_LEN,conn))
537538
return;
538-
conn->asyncStatus=PGASYNC_READY;
539+
if (pendingT) {
540+
/* Check the returned message */
541+
/* if it's a SELECT in a pendingT case, */
542+
/* then it probably means no rows returned. */
543+
/* We clear pendingT in that case. */
544+
if (strncmp(conn->result->cmdStatus,"SELECT",6)==0)
545+
pendingT=0;
546+
}
547+
if (!pendingT)conn->asyncStatus=PGASYNC_READY;
539548
break;
540549
case'E':/* error return */
541550
if (pqGets(conn->errorMessage,ERROR_MSG_LENGTH,conn))
@@ -545,10 +554,11 @@ parseInput(PGconn *conn)
545554
/* and build an error result holding the error message */
546555
conn->result=PQmakeEmptyPGresult(conn,
547556
PGRES_FATAL_ERROR);
548-
conn->asyncStatus=PGASYNC_READY;
557+
if (!pendingT)conn->asyncStatus=PGASYNC_READY;
549558
break;
550559
case'Z':/* backend is ready for new query */
551560
conn->asyncStatus=PGASYNC_IDLE;
561+
pendingT=0;
552562
break;
553563
case'I':/* empty query */
554564
/* read and throw away the closing '\0' */
@@ -563,7 +573,7 @@ parseInput(PGconn *conn)
563573
if (conn->result==NULL)
564574
conn->result=PQmakeEmptyPGresult(conn,
565575
PGRES_EMPTY_QUERY);
566-
conn->asyncStatus=PGASYNC_READY;
576+
if (!pendingT)conn->asyncStatus=PGASYNC_READY;
567577
break;
568578
case'K':/* secret key data from the backend */
569579

@@ -584,11 +594,15 @@ parseInput(PGconn *conn)
584594
break;
585595
case'T':/* row descriptions (start of query
586596
* results) */
597+
if (pendingT) {
598+
DONOTICE(conn,"Got second 'T' message!\n");
599+
}
587600
if (conn->result==NULL)
588601
{
589602
/* First 'T' in a query sequence */
590603
if (getRowDescriptions(conn))
591604
return;
605+
pendingT=1;
592606
}
593607
else
594608
{
@@ -600,11 +614,13 @@ parseInput(PGconn *conn)
600614
* We stop parsing until the application accepts
601615
* the current result.
602616
*/
617+
pendingT=0;
603618
conn->asyncStatus=PGASYNC_READY;
604619
return;
605620
}
606621
break;
607622
case'D':/* ASCII data tuple */
623+
pendingT=0;
608624
if (conn->result!=NULL)
609625
{
610626
/* Read another tuple of a normal query response */
@@ -622,6 +638,7 @@ parseInput(PGconn *conn)
622638
}
623639
break;
624640
case'B':/* Binary data tuple */
641+
pendingT=0;
625642
if (conn->result!=NULL)
626643
{
627644
/* Read another tuple of a normal query response */
@@ -639,12 +656,15 @@ parseInput(PGconn *conn)
639656
}
640657
break;
641658
case'G':/* Start Copy In */
659+
pendingT=0;
642660
conn->asyncStatus=PGASYNC_COPY_IN;
643661
break;
644662
case'H':/* Start Copy Out */
663+
pendingT=0;
645664
conn->asyncStatus=PGASYNC_COPY_OUT;
646665
break;
647666
default:
667+
pendingT=0;
648668
sprintf(conn->errorMessage,
649669
"unknown protocol character '%c' read from backend. "
650670
"(The protocol character is the first character the "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp