defaultValuesEqual compares default values.
(col1, col2 *storepb.ColumnMetadata)
| 685 | |
| 686 | // defaultValuesEqual compares default values. |
| 687 | func defaultValuesEqual(col1, col2 *storepb.ColumnMetadata) bool { |
| 688 | // Quick check for identical strings |
| 689 | if col1.Default == col2.Default { |
| 690 | return true |
| 691 | } |
| 692 | |
| 693 | // Handle PostgreSQL type cast normalization for common cases before expression comparison |
| 694 | // This is needed because the expression comparer may not parse complex type casts correctly |
| 695 | normalized1 := normalizePostgreSQLTypecastInDefault(col1.Default) |
| 696 | normalized2 := normalizePostgreSQLTypecastInDefault(col2.Default) |
| 697 | |
| 698 | if normalized1 == normalized2 { |
| 699 | return true |
| 700 | } |
| 701 | |
| 702 | // Use semantic expression comparison for PostgreSQL default values |
| 703 | // This handles schema prefixes and other semantic equivalences |
| 704 | return CompareExpressionsSemantically(storepb.Engine_POSTGRES, col1.Default, col2.Default) |
| 705 | } |
| 706 | |
| 707 | // normalizePostgreSQLTypecastInDefault normalizes PostgreSQL type casts in default values |
| 708 | func normalizePostgreSQLTypecastInDefault(defaultValue string) string { |
no test coverage detected