[mapguide-users] Connect to PostGis3.2 data

Bruno Scott bscott at geomapgis.com
Fri May 29 11:40:07 EDT 2009


This is my generic connection on windows
  username : postgres
  Password : root
  Service : mydatabase at mymachine:5432
  Datastore : public

If you have a logged provider, you should see some interesting query
The first one will scans all avalable table/views 

SELECT n.nspname AS schemaname,c.relname AS tablename 
FROM pg_class c, pg_namespace n 
WHERE c.relnamespace = n.oid AND 
      c.relkind IN ('r','v') AND 
     (c.relname NOT LIKE 'pg_%') AND 
     (c.relname NOT LIKE 'spatial_ref_sys%') AND 
     (c.relname NOT LIKE 'sql_%') AND 
     (c.relname NOT LIKE 'geom%') AND 
     n.nspname = 'public' 
ORDER BY c.relname

You should try to run it on your machine (replace public by your own schema)

The second one is runned for each table/view
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 = 'mytable' AND 
      n.nspname = 'public' 
ORDER BY a.attnum;


Try this and tell me what it returns

Bruno




-- 
View this message in context: http://n2.nabble.com/Connect-to-PostGis3.2-data-tp2980072p2994528.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list