Query to find Foreign Key column data type mismatch

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: PGSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Query to find Foreign Key column data type mismatch
Date: 2009-06-01 06:36:36
Message-ID: 65937bea0905312336x20623976jcc64d144cb547d5d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I wanted to find out if both the ends of a foreign key reference were
using the same data types, since, in older versions, not having the same
data types can lead to Postgres not picking the appropriate index, and in
newer versions also it would be beneficial since having same data types can
avoid having to go through conversion functions for comparisons etc.

So I devised this query and the helper function for the purpose. Just
create the function and then run the query. This query checks all the
foreign keys in the database.

Feedback/comments welcome.

Best regards,
--
Lets call it Postgres

EnterpriseDB http://www.enterprisedb.com

gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com
Mail sent from my BlackLaptop device

Attachment Content-Type Size
Postgres_find_FKey_data_type_mismatch.sql application/octet-stream 2.1 KB

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Smith 2009-06-01 06:41:08 Re: newbie table design question
Previous Message j-lists 2009-06-01 06:29:36 Foreign key verification trigger conditions