Re: Getting reference key elements in right orders - Mailing list pgsql-general

From Tom Lane
Subject Re: Getting reference key elements in right orders
Date
Msg-id 18483.1274105394@sss.pgh.pa.us
Whole thread Raw
In response to Getting reference key elements in right orders  (seiliki@so-net.net.tw)
List pgsql-general
seiliki@so-net.net.tw 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

pgsql-general by date:

Previous
From: Catalin BOIE
Date:
Subject: Re: PANIC: corrupted item pointer: 32766
Next
From: sunpeng
Date:
Subject: which function should i invoke to create a table and insert tuples?