Get Primary Keys for PostGres Table

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
lkeel
Posts: 12
Joined: Fri 15 Feb 2008 14:49

Get Primary Keys for PostGres Table

Post by lkeel » Wed 12 Nov 2008 21:36

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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 13 Nov 2008 08:39

Please try using the following parameters for the GetSchema method:

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

lkeel
Posts: 12
Joined: Fri 15 Feb 2008 14:49

Post by lkeel » Mon 17 Nov 2008 16:32

That worked. Thanks!!

Post Reply