mysqlmariadbmariadb-10.4mariadb-10.1mariadb-connect-engine

Unable to create partition on Mariadb on this child table where Foreign Key Exists?


Unable to create partition this child table "city" with parent table "country" It is showing below error "Foreign Key Not Supported". Without foreign key how relation maintain

ForeignKey not supported by partition] [2] https://i.sstatic.net/WIlQR.png [1]: https://i.sstatic.net/CpjOv.png


Solution

  • Partitioning tables with FOREIGN KEY is not supported in MariaDB.

    According to the MariaDB documentation:

    As an alternative to Foreign Keys you could use Triggers to update the partitioned table when a parent table changes.

    Recent versions of PostgreSQL do support Foreign Keys for Partitioned Tables. If that is important to you, you might want to have a look there.