seiliki@xxxxxxxxxxxxx writes: > I need to know the match columns of referencing and referenced keys. The query you show definitely won't match them up correctly, since that =ANY test is not order-sensitive. What you need to do is generate the integers from 1 to array_length(conkey) and then join on attnum = conkey[i], rather than using =ANY. You can find some examples in the information_schema views. (In fact, you might well find that the information_schema views are close enough already to what you need.) regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general