From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
---|---|
To: | Bhim Kumar <bhimkumar33(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: SQL Query for Foreign constraint |
Date: | 2014-03-20 13:48:15 |
Message-ID: | A76B25F2823E954C9E45E32FA49D70EC7A9C0566@mail.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Bhim Kumar
Sent: Thursday, March 20, 2014 4:01 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] SQL Query for Foreign constraint
Hi sir
Currently I am using following query on mysql :
* SHOW TABLES; ---> To get list of table in a particular db.
* SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME from information_schema.key_column_usage WHERE constraint_schema ='myDBName';
---> to get foreign constraint information.
* SHOW INDEX FROM myTableName FROM myDBName;
I am required to get above information from postgres.
I didn't find postgres query corresponding to above mysql query to fetch corresponding information.
PS : help me for above query in postgres.
Best Regards.
Bhim
Get familiar with INFORMATION_SCHEMA, it has all the information you need.
There is also pg_catalog wich has this info (and more) on a bit "lower" level.
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | dahd101+hm3ufk | 2014-04-04 12:34:07 | Formatting query result like a calendar |
Previous Message | Bhim Kumar | 2014-03-20 08:01:02 | SQL Query for Foreign constraint |