From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | amaury(at)castordoc(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #17271: Updating enum columns type fails when constraints exist |
Date: | 2021-11-04 14:22:57 |
Message-ID: | 321163.1636035777@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thu, Nov 4, 2021 at 6:54 AM PG Bug reporting form <noreply(at)postgresql(dot)org>
> wrote:
>> ERROR: operator does not exist: direction_state = direction_state_old
> This does not surprise me - why do you believe it is a bug? What should
> happen?
Yeah. Concretely, what you have in the constraint (after the RENAME
TYPE) is
# \d example
...
Check constraints:
"ck_example_direction" CHECK (direction = 'DOWN'::direction_state_old AND below OR NOT below)
Simply updating "direction" to some other type doesn't provide any
guidance about changing the type of the constant, so re-parsing the
constraint fails. It's hard to see what we could do here that
wouldn't involve a lot of guesswork and chances of getting things
wrong.
I concur with David's advice that ALTER TYPE ADD VALUE would
be a better answer, at least for the specific use-case you're
showing here.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-11-04 14:42:38 | Re: BUG #17271: Updating enum columns type fails when constraints exist |
Previous Message | Amaury Dumoulin | 2021-11-04 14:18:18 | Re: BUG #17271: Updating enum columns type fails when constraints exist |