pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyle <kyle@actarg.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org, Peter Eisentraut <peter_e@gmx.net>
Subject: Re: Getting FK relationships from information_schema
Date: Tue, 08 Jun 2004 09:13:20 -0600
Message-ID: <40C5D790.6090407@actarg.com> (raw)
In-Reply-To: <26677.1086673982@sss.pgh.pa.us>
References: <40C500D8.9060009@actarg.com>
	<26677.1086673982@sss.pgh.pa.us>

Tom Lane wrote:

>Kyle <kyle@actarg.com> 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.  Postgres doesn't require them to be unique even
>within a table.  
>
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_fkey_$1).  Then if the user wants 
to make named constraints that all have the same name, he can (and 
information_schema will be less useful) or he can rely on the 
automatically generated names to be a bit more descriptive in 
information_schema.

>Can we get away with adding
>implementation-specific columns to information_schema tables?
>If not, what other alternatives are there?
>
>  
>
Another possible approach: Does the constraint name showing up in 
information_schema really have to be the _real_ name?  Or can we just 
make a name consisting of the table name appended to the internal 
postgres constraint name.

I think I like this less than the first idea.

Kyle

view thread (6+ messages)  latest in thread

Message-ID: <40C5D790.6090407@actarg.com>
Permalink:  ../40C5D790.6090407@actarg.com/
Also on:    postgresql.org/message-id/40C5D790.6090407@actarg.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kyle@actarg.com, tgl@sss.pgh.pa.us, peter_e@gmx.net
  Subject: Re: Getting FK relationships from information_schema
  In-Reply-To: <40C5D790.6090407@actarg.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox