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

[MYSQL] Auto-generated columns not migrated #315

Closed
shubham-yb opened this issue Sep 12, 2022 · 4 comments
Closed

[MYSQL] Auto-generated columns not migrated #315

shubham-yb opened this issue Sep 12, 2022 · 4 comments
Assignees

Comments

@shubham-yb
Copy link
Contributor

Auto Generated column on MYSQL is not getting migrated and so the rows are not getting generated on the target

This is the schema I used:

drop table if exists auto_gen;

create table auto_gen (
	id int primary key auto_increment,
	first_name VARCHAR(50),
	last_name VARCHAR(50),
	fullname varchar(101) GENERATED ALWAYS AS (CONCAT(first_name,' ',last_name)),
	email VARCHAR(50),
	gender VARCHAR(50),
	ip_address VARCHAR(20)
);

This is the exported schema:

CREATE TABLE auto_gen (
	id serial,
	first_name varchar(50),
	last_name varchar(50),
	fullname varchar(101),
	email varchar(50),
	gender varchar(50),
	ip_address varchar(20),
	PRIMARY KEY (id)
) ;

Table description on the source:

Image

Table description on the target:

Image

@github-actions github-actions bot added the triage Needs to be triaged label Sep 12, 2022
@sanyamsinghal sanyamsinghal added bug Something isn't working GA1.0 and removed triage Needs to be triaged labels Sep 13, 2022
@shubham-yb
Copy link
Contributor Author

Tried with a simple numeric auto generated column as well. Didn't work. Not a voyager issue. Yugabyte-DB doesn't support it yet it seems because the same schema worked for Postgres but not YB.

Just for reference the schema I used was:

drop table if exists auto_price;

create table auto_price (
	id INT,
	first_name VARCHAR(50),
	gender VARCHAR(50),
	price_dollar DECIMAL(7,2),
    price_pound DECIMAL(7,2) generated always as (price_dollar * 0.22) STORED
);

@rahulb-yb
Copy link
Collaborator

rahulb-yb commented Sep 14, 2022

Did some digging, generated columns are supported from PG12 and up. YB is unable to support generated columns regardless, we will have to file an issue both on ora2pg and add a check for generated columns (if needed) in analyze schema.

Relavant issues:
yugabyte/yugabyte-db#5805
yugabyte/yugabyte-db#9797

Edit:We report cases of generated columns in analyze schema, just need to raise a ticket on ora2pg GH

@rahulb-yb rahulb-yb assigned shubham-yb and unassigned rahulb-yb Sep 14, 2022
@shubham-yb
Copy link
Contributor Author

shubham-yb commented Sep 15, 2022

I have put up the issue on ora2pg.

@shubham-yb
Copy link
Contributor Author

#355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants