| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Ed L(dot)" <pgsql(at)bluepolka(dot)net> |
| Cc: | Postgres-General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Converting non-null unique idx to pkey |
| Date: | 2007-08-22 05:40:30 |
| Message-ID: | 2467.1187761230@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Ed L." <pgsql(at)bluepolka(dot)net> writes:
> Are there
> are any known or obvious gotchas associated with transforming a
> unique index on a non null column into a primary key via this
> sql?
> update pg_index
> set indisprimary = 't'
> where indexrelid = <my non-null unique index oid>
The problem with that is there won't be any pg_constraint entry,
nor any pg_depend entries linking to/from the constraint.
I don't offhand know which bits of logic look at indisprimary
and which pay attention to the pg_constraint entry (and 7.4 is
probably different from current sources on the point anyway).
Things could get a bit weird though, particularly for pg_dump.
Of course, you could gin up the required pg_constraint and pg_depend
entries by hand too, but it's a lot more complex than the above.
If you really wanna do this I'd strongly recommend experimenting
in a scratch database.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Frank Millman | 2007-08-22 06:02:44 | Problem with UPDATE and UNIQUE |
| Previous Message | Robin Helgelin | 2007-08-22 05:35:32 | Re: history table |