pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists
2+ messages / 2 participants
[nested] [flat]
* BUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists
@ 2019-07-18 03:51 PG Bug reporting form <noreply@postgresql.org>
2019-07-18 03:57 ` Re: BUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2019-07-18 03:51 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: greg.amer@smxemail.com
The following bug has been logged on the website:
Bug reference: 15915
Logged by: Greg Amer
Email address: greg.amer@smxemail.com
PostgreSQL version: 9.6.14
Operating system: Centos 7
Description:
When attempting to set the data type on multiple columns in a single sql
where the columns have indexes, the alter call fails. This previously worked
on 9.6.6.
Example:
# CREATE TABLE a ( b VARCHAR(100), c VARCHAR(100));
CREATE TABLE
# CREATE INDEX a_idx ON a(b);
CREATE INDEX
# CREATE INDEX a1_idx ON a(c);
CREATE INDEX
# INSERT INTO a VALUES ('Test', 'Test');
INSERT 0 1
# ALTER TABLE a ALTER b TYPE text, ALTER c TYPE text;
ERROR: relation "a_idx" already exists
This contradicts the documentation (and previous behaviour)
"SET DATA TYPE
This form changes the type of a column of a table. Indexes and simple table
constraints involving the column will be automatically converted to use the
new column type by reparsing the originally supplied expression."
Note this works if only altering a single column
# ALTER TABLE a ALTER b TYPE text;
ALTER TABLE
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists
2019-07-18 03:51 BUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists PG Bug reporting form <noreply@postgresql.org>
@ 2019-07-18 03:57 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2019-07-18 03:57 UTC (permalink / raw)
To: greg.amer@smxemail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> When attempting to set the data type on multiple columns in a single sql
> where the columns have indexes, the alter call fails. This previously worked
> on 9.6.6.
Thanks for the report! I believe this is the same issue already reported
and fixed at
https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=da1041fc3
At least, your example doesn't fail for me on 9.6 branch tip.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-07-18 03:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 03:51 BUG #15915: ALTER COLUMN SET DATA TYPE fails with index already exists PG Bug reporting form <noreply@postgresql.org>
2019-07-18 03:57 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox