From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | mail(at)joeconway(dot)com |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jonathan Beit-Aharon <jbeitaharon(at)intrusic(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Patching dblink.c to avoid warning about open transaction |
Date: | 2005-09-26 16:58:04 |
Message-ID: | 200509261658.j8QGw4416917@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
[ Joe, would you review this? ]
Your patch has been added to the PostgreSQL unapplied patches list at:
http://momjian.postgresql.org/cgi-bin/pgpatches
It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.
---------------------------------------------------------------------------
Bruce Momjian wrote:
> Tom Lane wrote:
> > Jonathan Beit-Aharon <jbeitaharon(at)intrusic(dot)com> writes:
> > > if (!conn)<br>
> > > DBLINK_CONN_NOT_AVAIL;<br>
> >
> > Could we see this in a less broken format?
>
> Here is the patch in text format.
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
> --- dblink.c Sat Jan 1 00:43:05 2005
> +++
> /home/jbeitaharon/dev/third/postgreSQL/contrib/dblink/dblink.c
> Thu Sep 22 16:10:20 2005
> @@ -329,12 +329,16 @@
> if (!conn)
> DBLINK_CONN_NOT_AVAIL;
> +
> + if (rcon)
> + rcon->remoteTrFlag = (PQtransactionStatus(conn) !=
> PQTRANS_IDLE);
> - res = PQexec(conn, "BEGIN");
> - if (PQresultStatus(res) != PGRES_COMMAND_OK)
> - DBLINK_RES_INTERNALERROR("begin error");
> -
> - PQclear(res);
> + if ((!rcon) || (!(rcon->remoteTrFlag))) {
> + res = PQexec(conn, "BEGIN");
> + if (PQresultStatus(res) != PGRES_COMMAND_OK)
> + DBLINK_RES_INTERNALERROR("begin error");
> + PQclear(res);
> + }
> appendStringInfo(str, "DECLARE %s CURSOR FOR %s", curname,
> sql);
> res = PQexec(conn, str->data);
> @@ -424,12 +428,13 @@
> PQclear(res);
> - /* commit the transaction */
> - res = PQexec(conn, "COMMIT");
> - if (PQresultStatus(res) != PGRES_COMMAND_OK)
> - DBLINK_RES_INTERNALERROR("commit error");
> -
> - PQclear(res);
> + if ((!rcon) || (!(rcon->remoteTrFlag))) {
> + /* commit the transaction */
> + res = PQexec(conn, "COMMIT");
> + if (PQresultStatus(res) != PGRES_COMMAND_OK)
> + DBLINK_RES_INTERNALERROR("commit error");
> + PQclear(res);
> + }
> PG_RETURN_TEXT_P(GET_TEXT("OK"));
> }
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2005-09-26 16:58:34 | On Logging |
Previous Message | Bruce Momjian | 2005-09-26 16:49:23 | Open items list for 8.1 |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-09-26 17:00:21 | Re: roundoff problem in time datatype |
Previous Message | Bruce Momjian | 2005-09-26 16:44:05 | Re: [HACKERS] statement logging / extended query protocol |