BUG #9048: Misleading error in transferring sequence between tables
От | m.sakrejda@gmail.com |
---|---|
Тема | BUG #9048: Misleading error in transferring sequence between tables |
Дата | |
Msg-id | 20140131020328.13610.47977@wrigleys.postgresql.org обсуждение исходный текст |
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 9048 Logged by: Maciek Sakrejda Email address: m.sakrejda@gmail.com PostgreSQL version: 9.3.2 Operating system: Ubuntu 13.04 64-bit Description: If I run the following SQL: CREATE TABLE events (id serial); ALTER TABLE events RENAME TO old_events; CREATE TABLE events (LIKE old_events INCLUDING ALL); ALTER TABLE old_events ALTER COLUMN id DROP DEFAULT; DROP TABLE old_events; The drop fails with: ERROR: cannot drop table old_events because other objects depend on it DETAIL: default for table events column id depends on sequence events_id_seq HINT: Use DROP ... CASCADE to drop the dependent objects too. Following the HINT advice would technically resolve this particular issue, but in this case, what I'd really like to do is transfer the sequence to the new table (someone on IRC helpfully suggested "ALTER SEQUENCE events_id_seq OWNED BY events.id", which is exactly what I was looking for). It's especially confusing, since once I drop the default, there is no clear relationship between the sequence and the old_events table: maciek=# \d+ old_events Table "public.old_events" Column | Type | Modifiers | Storage | Stats target | Description --------+---------+-----------+---------+--------------+------------- id | integer | not null | plain | | Has OIDs: no A '\d+' on the sequence itself does show the owner, but while the DETAIL points out the sequence is the issue, it does not tell me about the relationship to the parent table. Could the error message suggest changing the ownership when there is ownership but no functional dependency and there *is* a functional dependency from another object?
В списке pgsql-bugs по дате отправления: