Re: [SQL] Getting FK relationships from information_schema

2004-06-09 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> We have discussed changing the default names of FK constraints >> before. I have no problem with doing something like the above --- any >> objection out there? > I think it's a good idea. It will also make the error messages of the

Re: [SQL] Getting FK relationships from information_schema

2004-06-08 Thread Peter Eisentraut
Tom Lane wrote: > Kyle <[EMAIL PROTECTED]> writes: > > I think this is only an issue when the user relies on postgres to > > choose a constraint name automatically. Seems like a reasonable > > approach would be to have postgres choose a name for the constraint > > that happens to be unique in the

Re: [SQL] Getting FK relationships from information_schema

2004-06-08 Thread Tom Lane
Kyle <[EMAIL PROTECTED]> writes: > I think this is only an issue when the user relies on postgres to choose > a constraint name automatically. Seems like a reasonable approach would > be to have postgres choose a name for the constraint that happens to be > unique in the schema (like tablename_

Re: [SQL] Getting FK relationships from information_schema

2004-06-08 Thread Kyle
Tom Lane wrote: Kyle <[EMAIL PROTECTED]> writes: The problem is, the constraint names ($1, $2, etc.) are not unique so I don't know how to join the third query into the fourth. Hmm, this is messy :-(. The SQL spec requires constraint names to be unique within a schema

Re: [SQL] Getting FK relationships from information_schema

2004-06-07 Thread Tom Lane
Kyle <[EMAIL PROTECTED]> writes: > I'm trying to get my application to deduce foreign key relationships > automatically so it can perform appropriate joins for the user. I'm new > to information_schema and having problems getting what I want. > ... > I can determine all the primary key fields ni

[SQL] Getting FK relationships from information_schema

2004-06-07 Thread Kyle
I'm trying to get my application to deduce foreign key relationships automatically so it can perform appropriate joins for the user. I'm new to information_schema and having problems getting what I want. Here is a test script to be run on a database called "test." -