[HACKERS] Renaming a table to an array's autogenerated name - Mailing list pgsql-hackers

From Vik Fearing
Subject [HACKERS] Renaming a table to an array's autogenerated name
Date
Msg-id 0f4ade49-4f0b-a9a3-c120-7589f01d1eb8@2ndquadrant.com
Whole thread Raw
Responses Re: [HACKERS] Renaming a table to an array's autogenerated name  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
In commit 9aa3c782c93, Tom fixed a bug in which creating a table _foo
when an array type of that name already existed would make the array
type change its name to get out of the way. But it missed a trick in
that renaming a table would still cause a conflict.

Steps to reproduce:

postgres=# create table foo (id int);
CREATE TABLE
postgres=# create table bar (id int);
CREATE TABLE
postgres=# alter table bar rename to _foo;
ERROR:  type "_foo" already exists

Attached is a patch that fixes this bug.

One interesting thing to note however, is that if you rename a table to
its own array's name (which was my case when I found this bug), the new
array name will be ___foo instead of just __foo.  I don't know if it's
worth worrying about that.
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] CREATE STATISTICS statistic_type documentation
Next
From: Jeevan Ladhe
Date:
Subject: [HACKERS] fix side-effect in get_qual_for_list()