1733
MariaDBERRORNotablePartitioningHIGH confidence

Exchange table must not be a temporary table

Production Risk

Low — operation rejected; no data moved.

What this means

Temporary tables cannot be used as the exchange table in ALTER TABLE ... EXCHANGE PARTITION.

Why it happens
  1. 1Providing a temporary table in the WITH TABLE clause of EXCHANGE PARTITION.
How to reproduce
trigger — this will error
trigger — this will error
CREATE TEMPORARY TABLE tmp LIKE part_t;
ALTER TABLE part_t EXCHANGE PARTITION p0 WITH TABLE tmp;

expected output

ERROR 1733 (HY000): The exchange table cannot be a temporary table.

Fix

Use a permanent table as the exchange table

Use a permanent table as the exchange table
CREATE TABLE staging LIKE part_t;
ALTER TABLE part_t EXCHANGE PARTITION p0 WITH TABLE staging;

Why this works

EXCHANGE PARTITION requires a persistent non-partitioned table.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1733 ER_PARTITION_EXCHANGE_TEMP_TABLE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors