Repository navigation
Conversation
…boolean fields PostgreSQL does not support implicit conversion between BOOLEAN and INTEGER: ERROR: operator does not exist: boolean = integer Changed all boolean field comparisons from integer literals to SQL-compliant boolean literals (true/false) for fields that are BOOLEAN in PostgreSQL: SuperEntity.enabled → BOOLEAN (baseline) 9 files ClusterInstance.autoRegisters → BOOLEAN (baseline) 1 file Catalogue.isLeaf → BOOLEAN (baseline) 1 file Tenant.isDelete → BOOLEAN (baseline) 1 file Columns migrated by V20241205 SMALLINT→BOOLEAN: dinky_alert_instance.enabled, dinky_alert_group.enabled, dinky_alert_rules.enabled, dinky_fragment.enabled NOT changed (both MySQL and PostgreSQL keep SMALLINT/TINYINT): UserTenant.tenantAdminFlag → kept as 1, not BOOLEAN anywhere MySQL backwards-compatible: MySQL treats TRUE as 1 internally. Fixes upstream issue DataLinkDC#4262
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Problem
When using PostgreSQL as Dinky's metadata database, the application fails to start with:
Root Cause
Dinky defines
enabledand other logical columns with different types per database:TINYINT(1)WHERE enabled = 1TINYINT(1)WHERE enabled = 1BOOLEANWHERE enabled = 1PostgreSQL has no implicit BOOLEAN↔INTEGER conversion operator. The same issue affects
auto_registers,is_leaf,is_delete, and other boolean columns.This issue is not limited to
enabled. A full codebase audit found 5 boolean fields using integer literals across 11 files.Fix Applied
Change boolean field comparisons from integer literals to SQL-compliant boolean literals:
Fields Changed (18 changes across 11 files)
Fields Intentionally NOT Changed
SMALLINT = TRUEwhich PostgreSQL also rejects. Kept as1."is_delete", not a Java boolean field. Unrelated pattern.Backward Compatibility
Fully backward-compatible with MySQL and H2 (Dinky's other officially-supported metadata databases):
col = 1(old)col = true(new)TINYINT(1)TINYINT(1)BOOLEANWhy this is safe for MySQL/H2: Both databases treat
TRUEas the integer1internally.WHERE enabled = trueproduces identical query execution plans toWHERE enabled = 1.Database Support Scope
Dinky officially supports 3 metadata databases (confirmed via
dinky-admin/pom.xmlanddb/migration/directories):application-mysql.yml+db/migration/mysql/+ mysql-connector-javaapplication-postgresql.yml+db/migration/postgresql/+ postgresql driverapplication-h2.yml+db/migration/h2/+ h2 driverdinky-metadata-oracle/sqlserverare Flink Catalog Connectors (for querying external data sources from Flink SQL), not Dinky's own metadata database.Verification
V20240506.1.0.2__baseline.sqlcolumn definitions)enabledcolumns on alert_* and fragment tables already migrated from SMALLINT → BOOLEAN via backup-table-and-rename patternUserTenant.tenantAdminFlagcorrectly excluded (PostgreSQL SMALLINT, no BOOLEAN migration)BOOLEAN = INTEGERoperator does not exist (https://www.postgresql.org/docs/current/datatype-boolean.html)operator does not exist: boolean = integererrorChange Summary