From: Sandro Santilli Date: Tue, 9 Dec 2003 11:13:41 +0000 (+0000) Subject: WKB_recv: set StringInfo cursor to the end of StringInfo buf as required by postgres... X-Git-Tag: pgis_0_8_1~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18d50c9239bf9b9f694159a5f2fc7d2243ef5b03;p=postgis WKB_recv: set StringInfo cursor to the end of StringInfo buf as required by postgres backend git-svn-id: http://svn.osgeo.org/postgis/trunk@403 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis_inout.c b/postgis_inout.c index 4ec651de6..4f0607559 100644 --- a/postgis_inout.c +++ b/postgis_inout.c @@ -11,6 +11,9 @@ * ********************************************************************** * $Log$ + * Revision 1.31 2003/12/09 11:13:41 strk + * WKB_recv: set StringInfo cursor to the end of StringInfo buf as required by postgres backend + * * Revision 1.30 2003/12/08 17:57:36 strk * Binary WKB input function built only when USE_VERSION > 73. Making some modifications based on reported failures * @@ -3546,6 +3549,12 @@ Datum WKB_out(PG_FUNCTION_ARGS) #if USE_VERSION > 73 +/* + * This function must advance the StringInfo.cursor pointer + * and leave it at the end of StringInfo.buf. If it fails + * to do so the backend will raise an exception with message: + * ERROR: incorrect binary data format in bind parameter # + */ PG_FUNCTION_INFO_V1(WKB_recv); Datum WKB_recv(PG_FUNCTION_ARGS) { @@ -3557,6 +3566,9 @@ Datum WKB_recv(PG_FUNCTION_ARGS) result = (WellKnownBinary *)palloc(buf->len); memcpy(result, buf->data, buf->len); + /* Set cursor to the end of buffer (so the backend is happy) */ + buf->cursor = buf->len; + elog(NOTICE, "WKB_recv end (returning result)"); PG_RETURN_POINTER(result); }