[postgis-users] Probe_Geometry_Columns()

Kevin Neufeld kneufeld at refractions.net
Tue Dec 16 13:45:48 PST 2008


Hi pc,

Yup, you're correct.  I created a new bug report to track this issue.

http://code.google.com/p/postgis/issues/detail?id=87

It'll likely show up in the next PostGIS release of 1.3.6.

In the mean time, if you need to run the function now, open up the function in PgAdminIII and edit the "INSERT INTO 
geometry_columns" query, replacing the lines:

		trim(both  '' =)'' from substr(sridcheck.consrc,
			strpos(sridcheck.consrc, ''='')))::integer as srid,

with:
		trim(both  ' =)' from
			replace(replace(split_part(
				sridcheck.consrc, ' = ', 2), ')', ''), '(', ''))::integer AS srid,

Hope that solves your problem.
Cheers,
Kevin



Paolo Cavallini wrote:
> Hi all.
>  SELECT Probe_Geometry_Columns();
> throws an error:
> 
> # SELECT ''::varchar as f_table_catalogue, n.nspname::varchar as
> f_table_schema, c.relname::varchar as f_table_name, a.attname::varchar
> as f_geometry_column, 2 as coord_dimension, trim(both ' =)' from
> substr(sridcheck.consrc, strpos(sridcheck.consrc, '=')))::integer as
> srid, trim(both ' =)''' from substr(typecheck.consrc,
> strpos(typecheck.consrc, '='), strpos(typecheck.consrc, '::')-
> strpos(typecheck.consrc, '=') ))::varchar as type FROM pg_class c,
> pg_attribute a, pg_type t, pg_namespace n, pg_constraint sridcheck,
> pg_constraint typecheck WHERE t.typname = 'geometry' AND a.atttypid =
> t.oid AND a.attrelid = c.oid AND c.relnamespace = n.oid AND
> sridcheck.connamespace = n.oid AND typecheck.connamespace = n.oid AND
> sridcheck.conrelid = c.oid AND sridcheck.consrc LIKE
> '(srid('||a.attname||') = %)' AND typecheck.conrelid = c.oid AND
> typecheck.consrc LIKE '((geometrytype('||a.attname||') = ''%''::text) OR
> (% IS NULL))' AND NOT EXISTS ( SELECT oid FROM geometry_columns gc WHERE
> c.relname::varchar = gc.f_table_name AND n.nspname::varchar =
> gc.f_table_schema AND a.attname::varchar = gc.f_geometry_column );
> ERROR:  invalid input syntax for integer: "(-1"
> 
> Apparently it fails when SRID is -1. Any hint?
> PostGIS 1.3.3.
> All the best.
> pc



More information about the postgis-users mailing list