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

Detect GET FIRST/GET LAST without lock #926

Open
movedoa opened this issue Nov 23, 2021 · 3 comments
Open

Detect GET FIRST/GET LAST without lock #926

movedoa opened this issue Nov 23, 2021 · 3 comments

Comments

@movedoa
Copy link

movedoa commented Nov 23, 2021

A rule to detect GET-FIRST/GET-LAST without an explicit lock would be nice.
Using this without a lock can lead to problems like error 2819 and other problems.

Quote from the doc:

The GET statement inherits its lock mode from
the most recent OPEN QUERY statement, unless you give a
lock-mode on the GET itself. So if you do an OPEN QUERY...
EXCLUSIVE-LOCK, and then do a subsequent GET on that
query, the GET will be EXCLUSIVE-LOCK too.

#880 is a related i guess.

@gquerret
Copy link
Contributor

I'll have a look, I thought the problem was fixed as part of #880.

@gquerret
Copy link
Contributor

The GET-FIRST and GET-LAST methods use NO-LOCK by default, so I assume you're talking about the GET statement with a modifier on a static query ? e.g.

define query qry for customer.
open query for each customer.
get first qry. // Missing lock as it's not specified in the open query statement
get next qry. // Ditto

@movedoa
Copy link
Author

movedoa commented Nov 25, 2021

The GET-FIRST and GET-LAST methods use NO-LOCK by default, so I assume you're talking about the GET statement with a modifier on a static query ? e.g.

define query qry for customer.
open query for each customer.
get first qry. // Missing lock as it's not specified in the open query statement
get next qry. // Ditto

Yes, i typed the hyphen out of habit :D.

@gquerret gquerret changed the title Detect GET-FIRST/GET-LAST without lock Detect GET FIRST/GET LAST without lock Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants