Skip to content

Wrong column name in CHECK when trying to modify a table column #1817

Open

Description

@the-holger

Details for the issue

What did you do?

Tried to modify a table using the "modify table" button.
Simple example table, renaming is_alpha to is_beta:

CREATE TABLE `test` (
	`id`	INTEGER NOT NULL,
	`is_alpha`	BOOLEAN,
	CHECK(is_alpha IN (0,1)),
	PRIMARY KEY(`id`)
);

What did you expect to see?

The renamed table column as in:

CREATE TABLE `test` (
	`id`	INTEGER NOT NULL,
	`is_beta`	BOOLEAN,
	CHECK(is_beta IN (0,1)),
	PRIMARY KEY(`id`)
);

What did you see instead?

The following error message:

Modifying this column failed. Error returned from database:
Creating new table failed. DB says: no such column: is_alpha (CREATE TABLE "sqlb_temp_table_3" (
	"id"	INTEGER NOT NULL,
	"is_beta"	BOOLEAN,
	CHECK(is_alpha IN (0,1)),
	PRIMARY KEY("id")
);)

Problem appears to be the CHECK(is_alpha IN (0,1)),, which should be CHECK(is_beta IN (0,1)),

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: 10.14.4 )
  • Other: ___

What is your DB4S version?

  • 3.11.1
  • 3.11.0
  • 3.10.1
  • Other: 3.11.99 (Mar 24 2019)

Did you also

Tried the current nightly after starting this bug report on the "old" bug that the spaces were missing around the IN in the CHECK statement (on 3.10.1 at least).

Activity

  1. added
    bugConfirmed bugs or reports that are very likely to be bugs.
    on Mar 24, 2019
  2. justinclift commented on Mar 24, 2019

    @justinclift
    Member

    Thanks @the-holger, this sounds like a bug we should be able to fix. 😄

  3. chrisjlocke commented on Mar 24, 2019

    @chrisjlocke
    Member

    ...in the meanwhilst, if you remove the CHECK constraint, I assume you can rename the column, then put the constaint back?

  4. derdritte commented on Jun 30, 2019

    @derdritte

    I have an issue where a space is remove from the CHECK instruction making the modification fail since the function (should be just "in") is now missing. Is this related to this bug or should I open a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bugs or reports that are very likely to be bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions