Ensure all implicit constraints are named

Поиск
Список
Период
Сортировка
Искать

Ensure all implicit constraints are named

От:
Rod Taylor <rbt@rbt.ca>
Дата:
Вложения:
If they're not, the below causes problems, as the foreign key is added
after the CHECK.  Cluster depends on the index name, so I thought it
wise to ensure all names are available, rather than leaving off the
CONSTRAINT "$n" portion for internally named constraints.

CREATE TABLE jkey (col integer primary key);
CREATE TABLE j (col integer REFERENCES jkey);
ALTER TABLE j ADD CHECK(col > 5);


This is a problem in 7.3 series as well as -Tip.

-- 
Rod Taylor 

PGP Key: http://www.rbt.ca/rbtpub.asc

Re: Ensure all implicit constraints are named

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Rod Taylor  writes:
> [above]

Er, weren't you just arguing for the opposite?

			regards, tom lane

Re: Ensure all implicit constraints are named

От:
Rod Taylor <rbt@rbt.ca>
Дата:
Вложения:
On Thu, 2003-06-05 at 01:53, Tom Lane wrote:
> Rod Taylor  writes:
> > [above]
> 
> Er, weren't you just arguing for the opposite?

Yes, I was.  Until I realized that some things in pg_dump depend on the
specific name of the constraint in cases where they are auto-generated.

To fix the problem, they need to be common.

Someday I'll probably propose that cluster should work on a list of
columns, and build the index by itself if one is not already available. 
Once thats done, we can probably revisit pg_dump and make these items
unnamed in the dump file.

-- 
Rod Taylor 

PGP Key: http://www.rbt.ca/rbtpub.asc

Re: Ensure all implicit constraints are named

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Rod Taylor wrote:
-- Start of PGP signed section.
> If they're not, the below causes problems, as the foreign key is added
> after the CHECK.  Cluster depends on the index name, so I thought it
> wise to ensure all names are available, rather than leaving off the
> CONSTRAINT "$n" portion for internally named constraints.
> 
> CREATE TABLE jkey (col integer primary key);
> CREATE TABLE j (col integer REFERENCES jkey);
> ALTER TABLE j ADD CHECK(col > 5);
> 
> 
> This is a problem in 7.3 series as well as -Tip.
> 
> -- 
> Rod Taylor 
> 
> PGP Key: http://www.rbt.ca/rbtpub.asc

[ Attachment, skipping... ]
-- End of PGP section, PGP failed!

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Ensure all implicit constraints are named

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied to HEAD and 7.3.X.  Thanks.

---------------------------------------------------------------------------


Rod Taylor wrote:
-- Start of PGP signed section.
> If they're not, the below causes problems, as the foreign key is added
> after the CHECK.  Cluster depends on the index name, so I thought it
> wise to ensure all names are available, rather than leaving off the
> CONSTRAINT "$n" portion for internally named constraints.
> 
> CREATE TABLE jkey (col integer primary key);
> CREATE TABLE j (col integer REFERENCES jkey);
> ALTER TABLE j ADD CHECK(col > 5);
> 
> 
> This is a problem in 7.3 series as well as -Tip.
> 
> -- 
> Rod Taylor 
> 
> PGP Key: http://www.rbt.ca/rbtpub.asc

[ Attachment, skipping... ]
-- End of PGP section, PGP failed!

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
FAQ