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

DROP TABLE IF EXISTS silently ignores views #9129

Closed
findepi opened this issue Sep 6, 2021 · 12 comments · Fixed by #11555
Closed

DROP TABLE IF EXISTS silently ignores views #9129

findepi opened this issue Sep 6, 2021 · 12 comments · Fixed by #11555
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@findepi
Copy link
Member

findepi commented Sep 6, 2021

With Hive connector

trino:default> CREATE TABLE one (a varchar);
            -> CREATE VIEW two AS SELECT * FROM one;
CREATE TABLE
CREATE VIEW

DROP TABLE is rejected on a view:

trino:default> DROP TABLE two;
Query 20210906_150832_00015_id3y3 failed: line 1:1: Table 'hive.default.two' does not exist, but a view with that name exists. Did you mean DROP VIEW hive.default.two?

Now this should fail informing that relation indeed exists, but is not a table -- but succeeds:

trino:default> DROP TABLE IF EXISTS two;
DROP TABLE

nothing got dropped:

trino:default> SELECT * FROM two;
 a
---
(0 rows)
@ronnuriel
Copy link

can you assign me to this issue ?

@ronnuriel
Copy link

i have installed hadoop and hive ,
how can i get data for testing hive and configurations ?

@sopel39
Copy link
Member

sopel39 commented Sep 17, 2021

how can i get data for testing hive and configurations ?

You need to create view and then use DROP TABLE IF EXIST on that view

@ronnuriel
Copy link

how can i get data for testing hive and configurations ?

You need to create view and then use DROP TABLE IF EXIST on that view

How do i create a view im new

@sopel39
Copy link
Member

sopel39 commented Sep 17, 2021

Please refer to Trino documentation: https://trino.io/docs/current/

@wendigo
Copy link
Contributor

wendigo commented Nov 2, 2021

@ronnuriel are you working on that?

@kyo-tom
Copy link
Contributor

kyo-tom commented Nov 22, 2021

@wendigo can I work for this issuse?

@wendigo
Copy link
Contributor

wendigo commented Nov 22, 2021

@kyo-tom sure, go ahead :)

@kyo-tom
Copy link
Contributor

kyo-tom commented Nov 23, 2021

I had see issues #9023. In my opinion, the sql of ‘DROP TABLE IF EXISTS two’ should be success。when the view named two is not exists,this sql will success but why this sql should be fail and return fail information when the view named two is exists. I only execute drop table,the result should not be change by view

@kyo-tom kyo-tom closed this as completed Nov 23, 2021
@kyo-tom kyo-tom reopened this Nov 23, 2021
@dchvn
Copy link
Contributor

dchvn commented Mar 10, 2022

@kyo-tom Are you still working on this? Can I go for it?

@Riddle4045
Copy link
Member

Riddle4045 commented Mar 17, 2022

@sopel39 @dchvn @kyo-tom I ran into this issue recently and I have a review ready for the fix, Can I publish it?
Draft request - #11555

@sopel39
Copy link
Member

sopel39 commented Mar 18, 2022

@Riddle4045 please go ahead

@Riddle4045 Riddle4045 self-assigned this Mar 19, 2022
antoniivanov added a commit to vmware/versatile-data-kit that referenced this issue Jul 6, 2022
Recent change in trino library broke our tests -

After trinodb/trino#9129  trino would fail
`drop view if not exists` query if table with that name exists instead
of silently proceeding.

which is problem for us since our tests seem to rely on us they execute
both drop view and drop table to make sure a table or view is deleted.

So now I am pinning to old version of trino to hopefully fix the issue
as a quick workaround. Will create separate ticket to fix it in a way
that works against latest version of trino.

Testing Done: this PR CICD :)

Signed-off-by: Antoni Ivanov <aivanov@vmware.com>
antoniivanov added a commit to vmware/versatile-data-kit that referenced this issue Jul 7, 2022
Recent change in trino library broke our tests -

After trinodb/trino#9129  trino would fail
`drop view if not exists` query if table with that name exists instead
of silently proceeding.

which is problem for us since our tests seem to rely on us they execute
both drop view and drop table to make sure a table or view is deleted.

So now I am pinning to old version of trino to hopefully fix the issue
as a quick workaround. Will create separate ticket to fix it in a way
that works against latest version of trino.

Testing Done: this PR CICD :)

Signed-off-by: Antoni Ivanov <aivanov@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
7 participants