Page 1 of 1

Get Primary Keys for PostGres Table

Posted: Wed 12 Nov 2008 21:36
by lkeel
Hello all,

I have been working on getting the primary keys for a table for a few hours now and can't seem to get anything to work. I have found this page (http://www.devart.com/dotconnect/postgr ... adata.html) that talks about using the GetSchema("PrimaryKeys", ...) call, but I can't seem to get it to work. Specifically, on my last try I used this call:

GetSchema("PrimaryKeys", new string[] { "%", "%", "grid" })

However, this did not work. I have tried with "_", null, and even the proper values for the first two parameters, but I never get any returned rows. Here is the table that I am testing against:


CREATE TABLE grid
(
id serial NOT NULL,
the_name character varying(50),
the_geom geometry,
CONSTRAINT grid_pk PRIMARY KEY (id),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'POLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 2236)
)
WITHOUT OIDS;
ALTER TABLE grid OWNER TO postgres;

I am using version 3.75.30.0.

Thanks in advance for any help with this matter.
Lee

Posted: Thu 13 Nov 2008 08:39
by Shalex
Please try using the following parameters for the GetSchema method:

GetSchema("PrimaryKeys", new string[] { "Schema_name", "Table_Name"})

Posted: Mon 17 Nov 2008 16:32
by lkeel
That worked. Thanks!!