Page 1 of 1

How to find the PKs of a table

Posted: Tue 04 Feb 2014 16:02
by radub
Hello,

Is there any way to find the primary key of a given table?
Something similar with "GetKeyList" from ODAC or "GetFieldDesc(FieldName).IsKey" from SDAC.

Thank you,
Radu B.

Re: How to find the PKs of a table

Posted: Wed 05 Feb 2014 16:36
by AlexP
Hello,

To retrieve information about Constraint and Index, you can use the TPgMetaData component

Code: Select all

  PgMetaData1.Restrictions.Values['TABLE_NAME'] := 'your_table_name';
  PgMetaData1.MetaDataKind := 'Constraints'; //IndexColumns, ...
  PgMetaData1.Open;

Re: How to find the PKs of a table

Posted: Thu 06 Feb 2014 06:59
by radub
I succeeded in obtain the fields working with PgMetaData.
It should be better to have a more detailed help above the functionalities for this component.

Case closed.

Thank you,
Radu B.

Re: How to find the PKs of a table

Posted: Thu 06 Feb 2014 12:31
by AlexP
Description of this component properties is in the PgDAC documentation: http://www.devart.com/pgdac/docs/index. ... tadata.htm