Ticket #344 (closed defect: fixed)

Opened 2 years ago

Last modified 10 months ago

PostGIS Defect : selecting features does not work when primary index is not the first index ceated

Reported by: bscott Assigned to:
Priority: blocker Milestone: 3.4.0
Component: PostGIS Provider Version: 3.2.0
Severity: 1 Keywords:
Cc: External ID:

Description

If the first index created on a PostGIS table is not the primary one, it's not possible to select a feature in Mapguide. To reproduce you just have to drop the primary index and recreate it, thus this index become created after the spatial index and selecting won't work anymore. To reanable it, just drop the spatial index and recreate it ... Another effect of this defect, is in mapguide studio when you created a new PostGIS data connection we have the ability to preview all the tables. All the unselectable tables are not displayed...

The bug reside in the PgTableColumnsReader? class, the sql statement to retreive all the columns is incorrect

I have added a where condition on i.indisprimary = 't' and it fixed the problem.

"SELECT a.attnum AS ordinal_position, a.attname AS column_name" ",t.typname AS data_type, a.attlen AS character_maximum_length" ",a.atttypmod AS modifier, a.attnotnull AS notnull" ",a.atthasdef AS hasdefault, d.adsrc AS defaultVal" ",a.attnum = ANY (i.indkey) AS isprimarykey, i.indkey AS primKey, i.indisprimary AS indisprimary" " FROM pg_attribute a LEFT OUTER JOIN pg_attrdef d ON a.attrelid = d.adrelid" ", pg_type t, pg_namespace n" ", pg_class c LEFT OUTER JOIN pg_index i ON i.indrelid = c.oid" " WHERE a.attnum > 0 AND a.attrelid = c.oid" " AND a.atttypid = t.oid AND c.relnamespace = n.oid" " AND t.typname !~ 'geom'"

" AND i.indisprimary = 't'" " AND c.relname = '" + table + "' AND n.nspname = '" + schema + "' ORDER BY a.attnum;");

Attachments

postgis_trunk_344.patch (0.6 kB) - added by bscott on 05/19/08 03:04:26.
patch for ticket 344

Change History

05/19/08 03:04:26 changed by bscott

  • attachment postgis_trunk_344.patch added.

patch for ticket 344

04/29/09 05:39:15 changed by bscott

  • status changed from new to closed.
  • resolution set to fixed.

04/29/09 06:21:22 changed by mloskot

  • status changed from closed to reopened.
  • resolution deleted.

04/29/09 06:21:27 changed by mloskot

  • owner deleted.
  • status changed from reopened to new.

04/29/09 06:21:30 changed by mloskot

  • status changed from new to closed.
  • resolution set to fixed.