jeremyevans / sequel

Sequel: The Database Toolkit for Ruby
http://sequel.jeremyevans.net
Other
4.99k stars 1.07k forks source link

Partial Indices are not migrated from Sqlite to Postgres #2168

Closed smaktacular closed 5 months ago

smaktacular commented 5 months ago

Complete Description of Issue

When I migrate a database from Sqlite to Postgres Partial Indices (=Indices with a where condition) are not created in Postgres.

The migration is being done using the cli with the command sequel -C sqlite:///sqlite/source.db postgres://postgres:postgres@postgres-db-1/destination

No exception is being printed out, but also no warning was emitted, that the index has not been created.

Simplest Possible Self-Contained Example Showing the Bug

e.g. The Index resulting from the statement CREATE INDEX TblA_Idx6 ON TblA (FieldA,FieldB) WHERE (FieldC = 0) is not being created in Postgres while CREATE INDEX TblA_Idx6 ON TblA (FieldA,FieldB) is being created.

The table TblA is created as follows: CREATE TABLE TblA (FieldA INTEGER NULL, FieldB INTEGER NULL, FieldC bit NOT NULL DEFAULT 1)

Full Backtrace of Exception (if any)

No response

SQL Log (if any)

No response

Ruby Version

3.2.4 (docker)

Sequel Version

5.80.0

jeremyevans commented 5 months ago

This is expected behavior. It is explicitly documented that partial indexes are not supported: https://sequel.jeremyevans.net/rdoc/files/doc/bin_sequel_rdoc.html#label-Copy+Databases