Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Anywhere: generateChangeLog fails when column's default value is an expression (e. g. Unexpected error running Liquibase: Unknown boolean value: if "mycol" is null then 0 else 1 endif) #4429

Closed
2 tasks done
mkarg opened this issue Jun 23, 2023 · 1 comment · Fixed by #4507

Comments

@mkarg
Copy link
Contributor

mkarg commented Jun 23, 2023

Search first

  • I searched and no similar issues were found

Description

In SQL Anywhere, columns can have default values which are no literals but expressions, for example if "mycol" is null then 0 else 1 endif. Apparently Liquibase cannot support expressions but only literals, as the error message says:

Unexpected error running Liquibase: Unknown boolean value: if "mycol" is null then 0 else 1 endif

This is a showstopper for generating change log from existing SQL Anywhere database.

Steps To Reproduce

CREATE TABLE A (
  c1 int,
  c2 bit NULL COMPUTE (if "c1" is null then 0 else 1 endif)
)
liquibase --changeLogFile=mydatabase_changelog.xml generateChangeLog

Expected/Desired Behavior

Liquibase successfully creates change log including the column default value expression if "mycol" is null then 0 else 1 endif".

Liquibase Version

master

Database Vendor & Version

SAP SQL Anywhere 17.0.11

Liquibase Integration

N/A

Liquibase Extensions

N/A

OS and/or Infrastructure Type/Provider

Windows 10 Pro (German)

Additional Context

N/A

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@mkarg
Copy link
Contributor Author

mkarg commented Jul 18, 2023

I started to work on a fix for this issue.

filipelautert added a commit that referenced this issue Aug 28, 2023
…'s default value is an expression (e. g. Unexpected error running Liquibase: Unknown boolean value: if "mycol" is null then 0 else 1 endif) (#4507)

* Fixed: SQL Anywhere incorrectly reports importedKeyInitiallyImmediate where it needs to report importedKeyNotDeferrable

* Fixed: SQL Anywhere can defer foreign key constraints, but uses a different SQL syntax to define it.

* Adding support for SQL Anywhere generated columns.

* Fixed: Unknown boolean value: if mycol is null then 0 else 1 endif

---------

Co-authored-by: filipe <flautert@liquibase.org>
Co-authored-by: rberezen <ruslan.berezenskyi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment