Re: Problem with dblink - Mailing list pgsql-patches

From Joe Conway
Subject Re: Problem with dblink
Date
Msg-id 3FBE5870.2030601@joeconway.com
Whole thread Raw
Responses Re: Problem with dblink  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Andrea Grassi wrote:

[...using dblink_build_sql_insert() inside a PL/pgSQL function...]

> ERROR:  improper call to spi_printtup
> CONTEXT:  PL/pgSQL function "f_sync_trigger_a_clifor" line 6 at select into
> variables

Attached fixes a recently reported bug in dblink. If there are no
objections, I'll make this my first commit :-)

I intend to apply it to HEAD and REL7_4_STABLE, but it could also be
applied to REL7_3_STABLE -- any opinions on that? Are we still
considering a 7.3.5 release?

Thanks,

Joe
Index: dblink.c
===================================================================
RCS file: /opt/src/cvs/pgsql-server/contrib/dblink/dblink.c,v
retrieving revision 1.27
diff -c -r1.27 dblink.c
*** dblink.c    12 Nov 2003 21:15:42 -0000    1.27
--- dblink.c    21 Nov 2003 18:26:17 -0000
***************
*** 1766,1771 ****
--- 1766,1772 ----
          SPITupleTable *tuptable = SPI_tuptable;

          tuple = SPI_copytuple(tuptable->vals[0]);
+         SPI_finish();

          return tuple;
      }
***************
*** 1774,1779 ****
--- 1775,1782 ----
          /*
           * no qualifying tuples
           */
+         SPI_finish();
+
          return NULL;
      }


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: fix compile warning
Next
From: Tom Lane
Date:
Subject: Re: Problem with dblink