Re: ALTER TABLE ... TO ... to change related names

From: Jonathan Gardner <jgardner(at)jonathangardner(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... TO ... to change related names
Date: 2003-08-30 17:26:26
Message-ID: 200308301026.29038.jgardner@jonathangardner.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 30 August 2003 09:06, Andrew Dunstan wrote:
> There is no guarantee that a given sequence is used only for one column
> in one table, as I understand it. So renaming it could screw you up
> badly.
>
> If we made 'serial-ness' first class, and hid the sequence completely
> from view, this would make more sense.
>

I'm just trying to make the following novice mistake less confusing:

CREATE TABLE test (id SERIAL PRIMARY KEY);
ALTER TABLE test TO old_test;
CREATE TABLE test (id SERIAL PRIMARY KEY);
- -> ERROR: Already a sequence with that name, already an index with that name

I don't think that hiding the sequence completely from the user is a good
idea. They may want to manipulate the sequence later. I like Tom's idea of
just telling people that this is what happens, and if they get too intimate
with the system tables and the sequences and indexes that are automatically
created, it's their own fault.

- --
Jonathan Gardner
jgardner(at)jonathangardner(dot)net
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/UN5CWgwF3QvpWNwRAgr5AKCfEfqU4NqWO60+tc6x6zkrqY9EgwCgwD4X
F3Sns/QFfneuijSG8fT85K4=
=l5nJ
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-08-30 17:30:14 database corruption
Previous Message Bruce Momjian 2003-08-30 16:58:05 Re: massive quotes?