You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today when we do a schema export with Voyager create the table using CREATE TABLE and then separately create the primary key using ALTER TABLE...SET PRIMARY KEY. I have seen two issues with this method:
Causes longer import times (creating the table with the primary key is faster than creating the table and then later changing the primary key)
We get an error when trying to migrate a table that needs to be partitioned on the target. This is a process specific to taking an existing application and making changes for it be geo-partitioned. (meaning it was not partitioned on the source but instead we edit the SQL file after the export so that it will be partitioned on the target). The error below:
x_restore_multi_region=# ALTER TABLE ONLY public.account_values ADD CONSTRAINT account_values_pkey PRIMARY KEY (id); ERROR: insufficient columns in PRIMARY KEY constraint definition DETAIL: PRIMARY KEY constraint on table "account_values" lacks column "geo_location" which is part of the partition key. x_restore_multi_region=# ALTER TABLE ONLY public.account_values ADD CONSTRAINT account_values_pkey PRIMARY KEY (id,geo_location); ERROR: changing primary key of a partitioned table is not yet implemented HINT: See https://github.com/yugabyte/yugabyte-db/issues/16980. React with thumbs up to raise its priority
There is a YSQL GH issue already open to support this issue (#16980) .
We can avoid both of this by creating the PRIMARY KEY as part of the CREATE TABLE syntax as shown in our examples.
The text was updated successfully, but these errors were encountered:
Today when we do a schema export with Voyager create the table using
CREATE TABLE
and then separately create the primary key usingALTER TABLE...SET PRIMARY KEY
. I have seen two issues with this method:x_restore_multi_region=# ALTER TABLE ONLY public.account_values ADD CONSTRAINT account_values_pkey PRIMARY KEY (id); ERROR: insufficient columns in PRIMARY KEY constraint definition DETAIL: PRIMARY KEY constraint on table "account_values" lacks column "geo_location" which is part of the partition key. x_restore_multi_region=# ALTER TABLE ONLY public.account_values ADD CONSTRAINT account_values_pkey PRIMARY KEY (id,geo_location); ERROR: changing primary key of a partitioned table is not yet implemented HINT: See https://github.com/yugabyte/yugabyte-db/issues/16980. React with thumbs up to raise its priority
There is a YSQL GH issue already open to support this issue (#16980) .
We can avoid both of this by creating the PRIMARY KEY as part of the CREATE TABLE syntax as shown in our examples.
The text was updated successfully, but these errors were encountered: