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] "drop temporary table" is an invalid syntax for YB #705

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

[MySQL] "drop temporary table" is an invalid syntax for YB #705

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

Comments

@shubham-yb
Copy link
Contributor

shubham-yb commented Dec 23, 2022

If we have a temporary table defined in a function or stored procedure in MySQL, and we have a drop temporary table statement associated with it, it exports as is, which is an invalid syntax for YB. It only supports drop table statements.

Example source schema:

delimiter //

create procedure foo(p_id int)
deterministic
begin
    drop temporary table if exists temp;

    create temporary table temp(id int, name text);

    insert into temp(id,name) select id,p_name from bar where p_id=id;

    select name from temp;

end//
delimiter ;

Exported schema:

CREATE OR REPLACE PROCEDURE foo (p_id integer) AS $body$
BEGIN
    drop temporary table if exists temp;

    create temporary table temp(id int, name text);

    insert into temp(id,name) select id,p_name from bar where p_id=id;

    select name from temp;

end;
$body$
LANGUAGE PLPGSQL
SECURITY DEFINER
;

Workaround:

Remove "temporary" from the drop statement.

@shubham-yb shubham-yb added the documentation Improvements or additions to documentation label Dec 23, 2022
@github-actions github-actions bot added the triage Needs to be triaged label Dec 23, 2022
@shubham-yb shubham-yb added dep-issue Issues with dependencies and removed triage Needs to be triaged labels Dec 23, 2022
@shubham-yb shubham-yb removed the documentation Improvements or additions to documentation label Jan 5, 2023
@shubham-yb shubham-yb assigned shubham-yb and unassigned aishwarya24 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

2 participants