Re: Bug in ALTER COLUMN SET DATA TYPE ?

Pavan Deolasee <pavan.deolasee@gmail.com>

From: Pavan Deolasee <pavan.deolasee@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-11-02T15:07:14Z
Lists: pgsql-hackers
On Fri, Nov 2, 2012 at 8:11 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Pavan Deolasee <pavan.deolasee@gmail.com> writes:
> > I noticed this behavior on master and it seems like a bug to me:
>
> > postgres=# CREATE TABLE test (a float check (a > 10.2));
> > CREATE TABLE
> > postgres=# CREATE TABLE test_child() INHERITS(test);
> > CREATE TABLE
> > postgres=# ALTER TABLE test ALTER COLUMN a SET DATA TYPE numeric;
> > ERROR:  constraint must be added to child tables too
>
> Interestingly, this works in 8.3 and earlier ... but it fails as
> described in all later versions.  So we broke it quite some time back.
> It would be good to identify exactly what change broke it.
>
>
Hmm.. I haven't yet tested on other branches. But I'm surprised that you
find it broken on so much old branches. "git annotate" suggests that the
offending error message was added by commit
09ff76fcdb275769ac4d1a45a67416735613d04b and that commit is dated Apr 20,
2012

Thanks,
Pavan

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Recast "ONLY" column CHECK constraints as NO INHERIT

  2. Adjust join_search_one_level's handling of clauseless joins.

  3. Allow CHECK constraints to be declared ONLY

  4. Change the rules for inherited CHECK constraints to be essentially the same