Skip to content

Fixes query for multi-key primary keys #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomaskern
Copy link

Adding parentheses to the WHERE clauses allows the usage of multi-column
primary keys/foreign keys.

E.g.: columns aid and aid2 are the primary keys and are queried in the
foreign table.

SELECT * FROM tabA WHERE aid = 5 AND aid2 = 7 OR aid = 5 AND aid2 = 8 OR
aid=9 AND aid10;

The parentheses fixes this:

SELECT * FROM tabA WHERE (aid = 5 AND aid2 = 7) OR (aid = 5 AND aid2 = 8) OR
(aid=9 AND aid10);

Adding parentheses to the WHERE clauses allows the usage of multi-column
primary keys/foreign keys.

E.g.: columns aid and aid2 are the primary keys and are queried in the
foreign table.

SELECT * FROM tabA WHERE aid = 5 AND aid2 = 7 OR aid = 5 AND aid2 = 8 OR
aid=9 AND aid10;

The parentheses fixes this:

SELECT * FROM tabA WHERE (aid = 5 AND aid2 = 7) OR (aid = 5 AND aid2 = 8) OR
(aid=9 AND aid10);
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

Successfully merging this pull request may close these issues.

1 participant