Access pgsql x64 from manifold x32/x64 - both installed on win 64

Scenario:

  • windows server x64
  • manifold 8.x x64
  • pgsql 9.x x64
In order to allow manifold x64 to connect to the db server one needs to:
  • install Microsoft Visual C++ 2013 Redistributable Package x64 (actually pgsql will not even start without it)
  • add pgsqls bin to the PATH variable or
  • copy intl.dll, libeay32.dll, libiconv.dll, libpq.dll, ssleay32.dll to manifold x64 installation folder
All good to go until one needs to connect to pgsql from manifold x32... In order to do that:
  • install Microsoft Visual C++ 2013 Redistributable Package x32 and
  • copy intl.dll, libeay32.dll, libiconv.dll, libpq.dll, ssleay32.dll to manifold x32 installation folder
Now you should be able to connect to your x64 pgsql from both manifold versions

Spatial index in postgis

--create geom index
CREATE INDEX mytable_geom_gist
  ON public.mytable
  USING GIST (geometry);

--vacuum analyze
VACUUM ANALYZE public.mytable;

Use PostGIS 2.x in manifold GIS 8.0.x

Solution applies to manifold 8.0.29 and older versions.

In PostGIS 2.x some spatial functions changed names and so far manifold has not been updated to reflect that. When linking the PostGIS data with AOI windowing, manifold tries to call a function called SetSRID - the equivalent is now st_setstrid. This pretty much may prevent users from using newest pgsql/postgis combo with manifold as obviously a db reports an exception.

In order to make things work, it is required to add a fake SetSRID function to PostGIS, so manifold is happy again. To do so, just review the code of the native st_setsrid function and create its SetSRID equivalent:

CREATE OR REPLACE FUNCTION SetSrid(geometry, integer)
  RETURNS geometry AS
'$libdir/postgis-2.0', 'LWGEOM_set_srid'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;
ALTER FUNCTION SetSrid(geometry, integer)
  OWNER TO postgres;
COMMENT ON FUNCTION SetSrid(geometry, integer) IS 'args: geom, srid - Sets the SRID on a geometry to a particular integer value.';