ALTER TABLE fails when changing column type due to index with bit_ops opclass - Mailing list pgsql-bugs

From Manuel Rigger
Subject ALTER TABLE fails when changing column type due to index with bit_ops opclass
Date
Msg-id CA+u7OA4=vs9LjjP_643kgLRENv2eW+8v+5M8QGsY3Sg1K_18fg@mail.gmail.com
Whole thread Raw
Responses Re: ALTER TABLE fails when changing column type due to index with bit_ops opclass  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi everyone,

Consider the following statements:

CREATE TABLE t0(c0 BIT VARYING(1));
CREATE INDEX i0 ON t0(c0 bit_ops);
ALTER TABLE t0 ALTER c0 TYPE TEXT; -- ERROR:  operator class "bit_ops"
does not accept data type text

Altering the column type fails, which is somewhat unexpected, since it
does not seem to cause problems for other opclasses. For example, the
following executes without errors:

CREATE TABLE t0(c0 TEXT);
CREATE INDEX i0 ON t0(c0 text_ops);
ALTER TABLE  t0 ALTER c0 TYPE BIT VARYING(1) USING c0::bit varying(1);

Is this a bug or expected? I can reproduce this on a recent trunk
version (b3c265d).

Best,
Manuel



pgsql-bugs by date:

Previous
From: Prasad Jadhav
Date:
Subject: Re: BUG #16126: Missing the sp_OACreate procedures
Next
From: PG Bug reporting form
Date:
Subject: BUG #16127: PostgreSQL 12.1 on Windows 2008 R2 copy table from ‘large 2GB csv’report “iso-8859-1 error”