Skip to content

[FEATURE] BETWEEN SYMMETRIC not supported #2250

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
tomershay opened this issue May 30, 2025 · 7 comments
Closed

[FEATURE] BETWEEN SYMMETRIC not supported #2250

tomershay opened this issue May 30, 2025 · 7 comments
Assignees
Labels

Comments

@tomershay
Copy link
Contributor

Relevant PG docs: https://www.postgresql.org/docs/current/functions-comparison.html

Steps to reproduce:

CREATE TABLE orders (
    id SERIAL PRIMARY KEY,
    total_price NUMERIC,
    discount_price NUMERIC
);

INSERT INTO orders (total_price, discount_price) VALUES
      (120, 80),     -- 100 is between these (SYMMETRIC: yes)
      (150, 200),    -- 100 is NOT between these
      (90, 110),     -- 100 is between these
      (50, 50),      -- 100 is NOT between
      (130, 70);     -- 100 is between these (SYMMETRIC: yes)

SELECT *
FROM orders
WHERE 100 BETWEEN SYMMETRIC total_price AND discount_price;

The parsing error:

Image
@manticore-projects
Copy link
Contributor

Greetings.

SYMMETRIC is not supported.
I would not mind, when you send a PR but I myself have very little interest in those not standard compliant exotic syntax (pardon for being blunt).

@manticore-projects
Copy link
Contributor

I don't even understand why anyone would use those syntax which are not even a bit portable to any other RDBMS. I thought Oracle would be terrible r/ portability.

@tomershay
Copy link
Contributor Author

Thanks for the quick feedback. Yes, it seems PG is a pioneer in implementing it, but this feature does seem to be a part of the SQL standard (page 321), though as you mentioned most other RDBMS didn't implement it just yet.

@manticore-projects
Copy link
Contributor

You got me good and you have a strong point now.
I will add it over the weekend. Thanks for pointing it out.

@manticore-projects
Copy link
Contributor

manticore-projects commented May 30, 2025

@manticore-projects
Copy link
Contributor

Done.
Please note: JSQLParser 5.4-SNAPSHOT uses (for a first time!) JavaCC-8 Snapshot for generating the parser. Do let me know if anything unexpected happens.

Thanks and cheers!

@tomershay
Copy link
Contributor Author

@manticore-projects Thanks for the swift turnaround!
I’ve just tested an upgrade to the latest commit and everything is working perfectly.

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

No branches or pull requests

2 participants