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

Oracle - insert append - error parsing hint #3074

Closed
sunrutcon opened this issue Mar 3, 2024 · 3 comments · Fixed by #3077
Closed

Oracle - insert append - error parsing hint #3074

sunrutcon opened this issue Mar 3, 2024 · 3 comments · Fixed by #3077
Assignees
Labels
good first issue Good for newcomers

Comments

@sunrutcon
Copy link

sunrutcon commented Mar 3, 2024

Error in parsing Oracle insert append.

SQL

-- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
select banner from v$version;
-- create table
create table iap_tbl (id int, col1 varchar2(20 char));
/
-- normal insert
insert into iap_tbl (id, col1) values (1, 'test');
commit;
/
select * from iap_tbl;
/
-- insert with append hint
insert /*+ append */ into iap_tbl (id, col1) values (2, 'test2');
commit;

Python

# pip show sqlglot
#Name: sqlglot
#Version: 22.2.0

from sqlglot import parse_one

# error parsing hint
sql_nok = "insert /*+ append */ into iap_tbl (id, col1) values (2, 'test2')"

# ok when + removed from comment, normal comment not hint
sql_ok = "insert /* append */ into iap_tbl (id, col1) values (2, 'test2')"

parse_one(sql_ok)

parse_one(sql_nok)
@tobymao tobymao added the good first issue Good for newcomers label Mar 3, 2024
@tobymao
Copy link
Owner

tobymao commented Mar 3, 2024

@sunrutcon this should be relatively easy to handle, would appreciate if you took the time to contribute a pr,

in _parse_insert, handle the insert hint

@sunrutcon
Copy link
Author

I'm working on it. I'll try to solve this until the end of the week.

@VaggelisD VaggelisD self-assigned this Mar 4, 2024
@VaggelisD
Copy link
Collaborator

Hi @sunrutcon, I've already started looking at this and I expect to have it fixed by tonight, apologies for the late notice. Thanks for reporting this and feel free to report and/or contribute your fixes for any other issues you encounter.

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

Successfully merging a pull request may close this issue.

3 participants