Skip to content

Boolean Default 0 - conversion error from string "0" #8727

Closed

Description

@nLeonardt95

The following Create Table command works with 3.0.4, but it does not work with newer versions such as 3.0.13, 4.0.6, or 5.0.3.
With the newer versions, I get the following error message

CREATE TABLE TESTSTABLE (
    TESTFIELD1  BOOLEAN DEFAULT 0 NOT NULL,
    TESTFIELD2  BOOLEAN DEFAULT 0 NOT NULL
);
**error message**


Overflow occurred during data type conversion.
conversion error from string "0".
----------------------------------------------
SQLCODE: -413
SQLSTATE: 22018
GDSCODE: 335544334

This command is OK for all versions.

CREATE TABLE TESTSTABLE (
    TESTFIELD1  BOOLEAN DEFAULT FALSE NOT NULL,
    TESTFIELD2  BOOLEAN DEFAULT FALSE NOT NULL
);

But now I have a problem.
I have an existing Firebird 3.0.4 database with a table that contains such a field, and I can no longer correct it in order to migrate to Firebird 5.0.3.

Restoring with Firebird 5.0.3 works. The table is also created and it works just like in Firebird 3.
But if I want to edit a field in the affected table or remove or edit one of the fields with “BOOLEAN DEFAULT 0,” I always get the message "Overflow occurred during data type conversion.
conversion error from string “0”."

Since the table with “BOOLEAN DEFAULT 0” also works with Firebird 5 and new records are also pre-populated with FALSE, I consider this to be an error in the new versions in “CREATE TABLE” or “ALTER TABLE”.

What can I do?

Activity

  1. aafemt commented on Sep 4, 2025

    @aafemt
    Contributor

    You should change default:
    ALTER TABLE TESTTABLE ALTER COLUMN TESTFIELD1 SET DEFAULT FALSE

  2. nLeonardt95 commented on Sep 4, 2025

    @nLeonardt95
    Author

    Doesn't work. I get the message “conversion error from string ”0“”.
    Probably because it also finds the error in the other field?
    I have two fields that have “BOOLEAN DEFAULT 0”.

  3. mrotteveel commented on Sep 4, 2025

    @mrotteveel
    Member

    Then alter them both at once?

  4. mrotteveel commented on Sep 4, 2025

    @mrotteveel
    Member

    That is, try

    ALTER TABLE TESTTABLE ALTER COLUMN TESTFIELD1 SET DEFAULT FALSE, ALTER COLUMN TESTFIELD2 SET DEFAULT FALSE
  5. nLeonardt95 commented on Sep 4, 2025

    @nLeonardt95
    Author

    @mrotteveel Thank you very much, that works.

  6. mrotteveel commented on Sep 4, 2025

    @mrotteveel
    Member

    As this seems to be more a support question (and the fact it was originally even possible to use DEFAULT 0 on a Boolean was - AFAIK - a bug), I'll move this to Discussions.

  7. locked and limited conversation to collaborators on Sep 4, 2025
  8. converted this issue into a discussion #8728 on Sep 4, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions