Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Symfony Messenger - ORA-02014: cannot select FOR UPDATE from view #33718

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

Closed
DasBen opened this issue Sep 26, 2019 · 15 comments
Closed

Symfony Messenger - ORA-02014: cannot select FOR UPDATE from view #33718

DasBen opened this issue Sep 26, 2019 · 15 comments

Comments

@DasBen
Copy link

DasBen commented Sep 26, 2019

Symfony version(s) affected: 4.3

Description

In AbstractOracleDriver.php line 57:

  An exception occurred while executing 'SELECT a.* FROM (SELECT m.* FROM 
messenger_messages m WHERE (m.delivered_at is null OR  
   m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) ORDER BY 
available_at ASC) a WHERE ROWNUM <= 1 FOR UPDATE' with params ["2019-09-26 10:26:28", "2019-09-26 11:26:28", "default"]:                                                     
                                                                                                                         
  ORA-02014: FOR UPDATE kann nicht auf View mit DISTINCT, GROUP BY usw. augewandt werden                                         

In OCI8Exception.php line 16:

  ORA-02014: FOR UPDATE kann nicht auf View mit DISTINCT, GROUP BY usw. augewandt werden  

How to reproduce
Use oracle12 with symfony 4.3 and messenger

Was affected with this issue too: #32427
Fixed it by removing the "T" from that dateformat

I think the query must be rewritten, so that the rownum filter is not on the outer sql. Maybe like this? https://stackoverflow.com/a/6337356/1953421

Could not try, because i do not know where to change the sql for the messenger select.

@xabbuh
Copy link
Member

xabbuh commented Sep 30, 2019

If I don't miss anything, we don't build the SQL ourselves but rely on Doctrine DBAL for that. Thus, I am not sure there is anything we can do or if this shouldn't be reported to the Doctrine project instead.

@roukmoute
Copy link
Contributor

Could you try next release now #32427 is merged?

@xabbuh
Copy link
Member

xabbuh commented Oct 29, 2019

@DasBen Can you confirm that #32427 fixes your issue?

@xabbuh
Copy link
Member

xabbuh commented Oct 31, 2019

Let's close here for now. We can still reopen if it turns out that #32427 isn't enough.

@xabbuh xabbuh closed this as completed Oct 31, 2019
@Tobion
Copy link
Contributor

Tobion commented Nov 2, 2019

I don't see how #32427 should fix this issue? It was even mentioned that ##32427 is a different error that happened in the ticket.

@bohanyang
Copy link
Contributor

This bug is still not solved. (Symfony 5.0.6)
Tried to use symfony messenger together with enqueue/dbal
But there's another bug:
ramsey/uuid-doctrine#46
Enqueue uses UUID as the message id

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3

@bohanyang
Copy link
Contributor

Hey dear bot it's not resolved

@carsonbot carsonbot removed the Stalled label Mar 5, 2021
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Hello? This issue is about to be closed if nobody replies.

@bohanyang
Copy link
Contributor

Hello

@carsonbot carsonbot removed the Stalled label Sep 21, 2021
@xabbuh
Copy link
Member

xabbuh commented Sep 21, 2021

@bohanyang Would you like to try to solve this issue?

@bohanyang
Copy link
Contributor

Sure but maybe we have to write a SQL specific to Oracle to solve this issue.

@rjd22
Copy link
Contributor

rjd22 commented Mar 11, 2022

This issue still exists with Oracle and the latest Dbal driver. To solve this the query needs to be written in the following way:

SELECT * FROM messenger_messages WHERE id in (
    SELECT a.id FROM (
        SELECT m.* 
        FROM messenger_messages m 
        WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?) 
        ORDER BY available_at ASC
    ) a WHERE ROWNUM <= 1
) FOR UPDATE;

What would be the correct way to solve this for symfony/messenger? Make a separate OracleConnection like is done with Postgresql ?

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

No branches or pull requests

8 participants