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] Key in tables within functions/procedures cause issues #707

Open
shubham-yb opened this issue Dec 23, 2022 · 0 comments
Open

[MySQL] Key in tables within functions/procedures cause issues #707

shubham-yb opened this issue Dec 23, 2022 · 0 comments
Assignees
Labels
dep-issue Issues with dependencies

Comments

@shubham-yb
Copy link
Contributor

If we have a simple key defined within a table in a function/procedure, it is exported as is, which causes issues as just key isn't a right syntax for YB.

Sample source schema:

delimiter //

create function foo (p_id int)
returns varchar(20)
reads sql data
begin
create temporary table temp(id int, name text,key(id));
insert into temp(id,name) select id,p_name from bar where p_id=id;
return (select name from temp);
end//

Exported schema:

CREATE OR REPLACE FUNCTION foo (p_id integer) RETURNS varchar AS $body$
BEGIN
create temporary table temp(id int, name text,key(id));
insert into temp(id,name) select id,p_name from bar where p_id=id;
return(select name from temp);
end;
$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;

Workaround:

Remove the key from the exported schema, or create an index manually

@shubham-yb shubham-yb added documentation Improvements or additions to documentation dep-issue Issues with dependencies labels Dec 23, 2022
@github-actions github-actions bot added the triage Needs to be triaged label Dec 23, 2022
@shubham-yb shubham-yb removed the triage Needs to be triaged label Dec 23, 2022
@shubham-yb shubham-yb removed the documentation Improvements or additions to documentation label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dep-issue Issues with dependencies
Projects
None yet
Development

No branches or pull requests

1 participant