Re: Should this require CASCADE? - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: Should this require CASCADE?
Date
Msg-id GNELIHDDFBOCMGBFGEFOGEBLCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: Should this require CASCADE?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> > Also, when talking about whether or not the index supporting a
> constraint
> > should be sort of 'hidden' from the user, should not we change
> pg_dump to
> > dump unique indices using the ALTER TABLE syntax, rather than the CREATE
> > UNIQUE INDEX syntax?  Otherwise this information will be lost.
>
> I thought we did that already.

Nope: (CVS-HEAD)

test=# create table test (a int4 unique);
NOTICE:  CREATE TABLE / UNIQUE will create implicit index 'test_a_key' for
table 'test'
CREATE TABLE
test=# \q
chriskl@alpha:~$ pg_dump test
--
-- Selected TOC Entries:
--
\connect - chriskl

SET search_path = public, pg_catalog;

--
-- TOC Entry ID 2 (OID 16575)
--
-- Name: test Type: TABLE Schema: public Owner: chriskl
--

CREATE TABLE "test" (       "a" integer
);

--
-- Data for TOC Entry ID 4 (OID 16575)
--
-- Name: test Type: TABLE DATA Schema: public Owner: chriskl
--


COPY "test" FROM stdin;
\.
--
-- TOC Entry ID 3 (OID 16577)
--
-- Name: test_a_key Type: INDEX Schema: public Owner: chriskl
--

CREATE UNIQUE INDEX test_a_key ON test USING btree (a);

I think that if an index is unique and uses btree, it should be dumped as an
alter table statement?

Chris



pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Should this require CASCADE?
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Changes in /contrib/fulltextindex