[Mapserver-users] change to mappostgis.c for psql 7.4.1

Charlton Purvis cpurvis at asg.sc.edu
Thu Jan 22 14:21:40 PST 2004


This is a multi-part message in MIME format.

------_=_NextPart_001_01C3E136.1B97F4E3
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Don't know if this postgis post made it to mapserver land, but I just
ran into this problem w/ our latest upgrade to pgsl 7.4.1, mapserver
4.0, and postgix 0.8.1.

If you find this in your log:
. . . as foo WHERE gid =3D 40716 -ERROR: cursor "mycursor" already =
exists
. . .

> This is a problem with the mapserver-postgis connector.
>
> There are several issues outstanding involving querying.

So . . .

> I have just added the explicit "CLOSE cursor" instruction in the code
and=20
> now It seems to work. This is the first time that I look at the
mapserver=20
> code so, my modify could be "dangerous" for other aspects that I don't

> know.

Look for the name 'Bonnin Stefano' inside the attached .c for the
modified snips.

Although this post looks similar, too.  Maybe another fix? =20
http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0401/msg00089.h
tml

Anyway, the attached .c works great.

Charlton



=20
=20
=20
Charlton Purvis
(803) 777-8858 : voice
(803) 777-3935 : fax
cpurvis at sc.edu
=20
Baruch Institute
University of South Carolina
Columbia, SC 29208


------_=_NextPart_001_01C3E136.1B97F4E3
Content-Type: application/octet-stream;
	name="mappostgis.c"
Content-Transfer-Encoding: base64
Content-Description: mappostgis.c
Content-Disposition: attachment;
	filename="mappostgis.c"

LyogJElkOiBtYXBwb3N0Z2lzLmMsdiAxLjI3LjIuMSAyMDAzLzEwLzE0IDE1OjA2OjU5IGRhbiBF
eHAgJCAqLwojaW5jbHVkZSAibWFwLmgiCgojaWZuZGVmIEZMVF9NQVgKI2RlZmluZSBGTFRfTUFY
IDI1MDAwMDAwLjAKI2VuZGlmCgojaWZkZWYgVVNFX1BPU1RHSVMKCiNpZm5kZWYgTElUVExFX0VO
RElBTgojZGVmaW5lIExJVFRMRV9FTkRJQU4gMQojZW5kaWYKI2lmbmRlZiBCSUdfRU5ESUFOCiNk
ZWZpbmU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