Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Alter table only add primary key constraint - pg_restore to YSQL DB. #3812

Closed
lakshman-battini opened this issue Mar 3, 2020 · 4 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@lakshman-battini
Copy link

lakshman-battini commented Mar 3, 2020

Jira Link: DB-2164
Hello, I am trying to migrate the Postgres database to YSQL DB. Created dump of postgres db using pg_dump and trying to restore in YSQL DB using pg_restore.

pg_dump creates the create table script without any constraints, add the constraints using Alter table scripts. But in YSQL DB 'ALTER TABLE ONLY ADD CONSTRAINT PRIMARY KEY' is not yet supported.

pg_restore: error: could not execute query: ERROR: This ALTER TABLE command is not yet supported.
Command was: ALTER TABLE ONLY


ADD CONSTRAINT PRIMARY KEY (field);

@yugabyte-ci yugabyte-ci added the community/request Issues created by external users label Mar 3, 2020
@ddorian ddorian added the area/ysql Yugabyte SQL (YSQL) label Mar 3, 2020
@ddorian ddorian self-assigned this Mar 3, 2020
@ddorian
Copy link
Contributor

ddorian commented Mar 3, 2020

@lakshman-battini can you try with ysql_dump ? It should be able to create the primary key inside create table statement.

@ddorian
Copy link
Contributor

ddorian commented Mar 3, 2020

Closing as duplicate of #1104
The same recommendation for ysql_dump is mentioned there too.

@ddorian ddorian closed this as completed Mar 3, 2020
@ndeodhar ndeodhar reopened this Mar 3, 2020
@ndeodhar ndeodhar assigned ndeodhar and unassigned ddorian Mar 3, 2020
@ndeodhar
Copy link
Contributor

ndeodhar commented Mar 3, 2020

Re-opening. This request is specifically to track an enhancement to pg_restore to create PKs inline (independently of ysql_dump).

@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jun 9, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug labels Sep 14, 2022
@fizaaluthra
Copy link
Member

ADD PRIMARY KEY is supported (#1104)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
Status: Done
Development

No branches or pull requests

5 participants