ALTER TABLE fails when changing column type due to index with bit_ops opclass

From: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: ALTER TABLE fails when changing column type due to index with bit_ops opclass
Date: 2019-11-20 12:42:30
Message-ID: CA+u7OA4=vs9LjjP_643kgLRENv2eW+8v+5M8QGsY3Sg1K_18fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-11-20 12:42:38 BUG #16127: PostgreSQL 12.1 on Windows 2008 R2 copy table from ‘large 2GB csv’report “Unknown error”
Previous Message Prasad Jadhav 2019-11-20 10:09:34 Re: BUG #16126: Missing the sp_OACreate procedures