Skip to content

Commit

Permalink
Fall back to raw SQL for COLLATE options
Browse files Browse the repository at this point in the history
Column collation options are not representable by `pgroll` `Column`
definitions.
  • Loading branch information
andrew-farries committed Dec 18, 2024
1 parent 47b410f commit ecb7433
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/sql2pgroll/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ func canConvertColumnDef(col *pgq.ColumnDef) bool {
// Column storage options are not supported
case col.GetStorageName() != "":
return false
// Column compression options are not supported
// Column compression options are not supported
case col.GetCompression() != "":
return false
// Column collation options are not supported
case col.GetCollClause() != nil:
return false
default:
return true
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql2pgroll/create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func TestUnconvertableCreateTableStatements(t *testing.T) {

// Column compression options are not supported
"CREATE TABLE foo(a text COMPRESSION pglz)",

// Column collation is not supported
"CREATE TABLE foo(a text COLLATE en_US)",
}

for _, sql := range tests {
Expand Down

0 comments on commit ecb7433

Please sign in to comment.