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

The ->> operation in postgresql does not work properly #1571

Closed
offSwitch opened this issue Jun 20, 2022 · 5 comments · Fixed by #1745
Closed

The ->> operation in postgresql does not work properly #1571

offSwitch opened this issue Jun 20, 2022 · 5 comments · Fixed by #1745

Comments

@offSwitch
Copy link

select visit_hour,json_array_elements(into_sex_json)->>'name',json_array_elements(into_sex_json)->>'value' from period_market

@wumpz
Copy link
Member

wumpz commented Jul 3, 2022

The problem here is that JSqlParser does only support:

column ->> literal

a function as a first "parameter" is not supported. Something you want to provide. PRs are welcome.

@yasu1209
Copy link

I'm using the latest version 4.6 and this problem seems not solved yet.
Would it be possible to be fixed in the future?

@manticore-projects
Copy link
Contributor

Unfortunately, allowing Function() is not possible as it will break performance reason. I think, this one is beyond any refactoring and tricks. A new and clean Grammar would be needed to achieve that.

@yasu1209
Copy link

Unfortunately, allowing Function() is not possible as it will break performance reason. I think, this one is beyond any refactoring and tricks. A new and clean Grammar would be needed to achieve that.

Thank you for your reply.
I'll check my code to see if it can be refactored.

manticore-projects added a commit to manticore-projects/JSqlParser that referenced this issue Mar 14, 2023
Supports `Function() ->> Literal` (although `Function()` would not allow Nested Expression Parameters)

fixes JSQLParser#1571
@manticore-projects
Copy link
Contributor

manticore-projects commented Mar 14, 2023

PR #1745 allows Function() ->> Literal as long as the Function is simple (no nested expressions as parameters).

wumpz pushed a commit that referenced this issue Mar 21, 2023
* Fixes #1684: Support CREATE MATERIALIZED VIEW with AUTO REFRESH

Support parsing create view statements in Redshift with AUTO REFRESH
option.

* Reduce cyclomatic complexity in CreateView.toString

Extract adding the force option into a dedicated method resulting in the
cyclomatic complexity reduction of the CreateView.toString method.

* Enhanced Keywords

Add Keywords and document, which keywords are allowed for what purpose

* Fix incorrect tests

* Define Reserved Keywords explicitly
Derive All Keywords from Grammar directly
Generate production for Object Names (semi-) automatically
Add parametrized Keyword Tests

* Fix test resources

* Adjust Gradle to JUnit 5

Parallel Test execution
Gradle Caching
Explicitly request for latest JavaCC 7.0.10

* Do not mark SpeedTest for concurrent execution

* Remove unused imports

* Adjust Gradle to JUnit 5

Parallel Test execution
Gradle Caching
Explicitly request for latest JavaCC 7.0.10

* Do not mark SpeedTest for concurrent execution

* Remove unused imports

* Sphinx Documentation

Update the MANTICORE Sphinx Theme, but ignore it in GIT
Add the content to the Sphinx sites
Add a Gradle function to derive Stable and Snapshot version from GIT Tags
Add a Gradle GIT change task
Add a Gradle sphinx task
Add a special Test case for illustrating the use of JSQLParser

* doc: request for `Conventional Commit` messages

* feat: make important Classes Serializable

Implement Serializable for persisting via ObjectOutputStream

* chore: Make Serializable

* doc: Better integration of the RR diagrams

- apply neutral Sphinx theme
- insert the RR diagrams into the sphinx sources
- better documentation on Gradle dependencies
- link GitHub repository

* Merge

* feat: Oracle Alternative Quoting

- add support for Oracle Alternative Quoting e.g. `q'(...)'`
- fixes #1718
- add a Logo and FavIcon to the Website
- document recent changes on Quoting/Escaping
- add an example on building SQL from Java
- rework the README.md, promote the Website
- add Spotless Formatter, using Google Java Style (with Tab=4 Spaces)

* style: Appease PMD/Codacy

* doc: fix the issue template

- fix the issue template
- fix the -SNAPSHOT version number

* Update issue templates

* Update issue templates

* feat: Support more Statement Separators

- `GO`
- Slash `/`
- Two empty lines

* feat: FETCH uses EXPRESSION

- `FETCH` uses `EXPRESSION` instead of SimpleJDBCParameter only
- Visit/Accept `FETCH` `EXPRESSION` instead of `append` to String
- Visit/Accept `OFFSET` `EXPRESSION` instead of `append` to String
- Gradle: remove obsolete/incompatible `jvmArgs` from Test()

* style: apply Spotless

* test: commit missing test

* fix: JSon Operator can use Simple Function

Supports `Function() ->> Literal` (although `Function()` would not allow Nested Expression Parameters)

fixes #1571

* style: Reformat changed files and headers

* style: Remove unused variable

* feat: Add support for Hangul "\uAC00"-"\uD7A3"

fixes #1747

* style: expose `SetStatement` key-value list

fixes #1746

* style: Appease PMD/Codacy

* feat: `ConflictTarget` allows multiple `IndexColumnNames`

fixes #1749
fixes #1633
fixes #955

* doc: fix reference in the Java Doc

* build: better Upload Groovy Task

---------

Co-authored-by: zaza <tzarna@gmail.com>
wumpz pushed a commit that referenced this issue Apr 27, 2023
* Fixes #1684: Support CREATE MATERIALIZED VIEW with AUTO REFRESH

Support parsing create view statements in Redshift with AUTO REFRESH
option.

* Reduce cyclomatic complexity in CreateView.toString

Extract adding the force option into a dedicated method resulting in the
cyclomatic complexity reduction of the CreateView.toString method.

* Enhanced Keywords

Add Keywords and document, which keywords are allowed for what purpose

* Fix incorrect tests

* Define Reserved Keywords explicitly
Derive All Keywords from Grammar directly
Generate production for Object Names (semi-) automatically
Add parametrized Keyword Tests

* Fix test resources

* Adjust Gradle to JUnit 5

Parallel Test execution
Gradle Caching
Explicitly request for latest JavaCC 7.0.10

* Do not mark SpeedTest for concurrent execution

* Remove unused imports

* Adjust Gradle to JUnit 5

Parallel Test execution
Gradle Caching
Explicitly request for latest JavaCC 7.0.10

* Do not mark SpeedTest for concurrent execution

* Remove unused imports

* Sphinx Documentation

Update the MANTICORE Sphinx Theme, but ignore it in GIT
Add the content to the Sphinx sites
Add a Gradle function to derive Stable and Snapshot version from GIT Tags
Add a Gradle GIT change task
Add a Gradle sphinx task
Add a special Test case for illustrating the use of JSQLParser

* doc: request for `Conventional Commit` messages

* feat: make important Classes Serializable

Implement Serializable for persisting via ObjectOutputStream

* chore: Make Serializable

* doc: Better integration of the RR diagrams

- apply neutral Sphinx theme
- insert the RR diagrams into the sphinx sources
- better documentation on Gradle dependencies
- link GitHub repository

* Merge

* feat: Oracle Alternative Quoting

- add support for Oracle Alternative Quoting e.g. `q'(...)'`
- fixes #1718
- add a Logo and FavIcon to the Website
- document recent changes on Quoting/Escaping
- add an example on building SQL from Java
- rework the README.md, promote the Website
- add Spotless Formatter, using Google Java Style (with Tab=4 Spaces)

* style: Appease PMD/Codacy

* doc: fix the issue template

- fix the issue template
- fix the -SNAPSHOT version number

* Update issue templates

* Update issue templates

* feat: Support more Statement Separators

- `GO`
- Slash `/`
- Two empty lines

* feat: FETCH uses EXPRESSION

- `FETCH` uses `EXPRESSION` instead of SimpleJDBCParameter only
- Visit/Accept `FETCH` `EXPRESSION` instead of `append` to String
- Visit/Accept `OFFSET` `EXPRESSION` instead of `append` to String
- Gradle: remove obsolete/incompatible `jvmArgs` from Test()

* style: apply Spotless

* test: commit missing test

* fix: JSon Operator can use Simple Function

Supports `Function() ->> Literal` (although `Function()` would not allow Nested Expression Parameters)

fixes #1571

* style: Reformat changed files and headers

* style: Remove unused variable

* feat: Add support for Hangul "\uAC00"-"\uD7A3"

fixes #1747

* style: expose `SetStatement` key-value list

fixes #1746

* style: Appease PMD/Codacy

* feat: `ConflictTarget` allows multiple `IndexColumnNames`

fixes #1749
fixes #1633
fixes #955

* doc: fix reference in the Java Doc

* build: better Upload Groovy Task

* feat: ParenthesedSelectBody and ParenthesedFromItem

- First properly working version
- Work in progress, 13 tests failing

* feat: ParenthesedSelectBody and ParenthesedFromItem

- delete unneeded ParenthesedJoin
- rename ParenthesisFromItem into ParenthesedFromItem

* feat: ParenthesedSelectBody and ParenthesedFromItem

- fix `NULLS FIRST` and `NULLS LAST`

* feat: ParenthesedSelectBody and ParenthesedFromItem

- fix Oracle Hints

* feat: ParenthesedSelectBody and ParenthesedFromItem

- parse `SetOperation` only after a (first plain) SelectBody has found, this fixes the performance issue
- one more special Oracle Test succeeds
- 5 remaining test failures

* feat: ParenthesedSelectBody and ParenthesedFromItem

- extract `OrderByElements` into `SelectBody`
- one more special Oracle Test succeeds
- all tests succeed

* style: Appease PMD/Codacy

* style: Appease PMD/Codacy

* feat: Refactor SelectBody implementations

- `SelectBody` implements `FromItem`
- get rid of `SubSelect` and `SpecialSubSelect`
- `Merge` can use `FromItem` instead of `SubSelect` or `Table`
- `LateralSubSelect` extends `ParenthesedSelectBody` directly
- Simplify the `Select` statement, although it is still redundant since     `SelectBody` also could implement `Statement` directly
- `WithItem` can use `SelectBody` directly, which allows for nested `WithItems`

BREAKING-CHANGE: Lots of redundant methods and intermediate removed

* feat: Refactor SelectBody implementations

- `SelectBody` implements `Statement` and so makes `Select` redundant
- get rid of `ValuesList`
- refactor `ValuesStatement` into `Values` which just implements `SelectBody` (and becomes a `Statement` and a `FromItem`), move to `select` package

BREAKING-CHANGE: Lots of redundant methods and intermediate removed

* style: Code cleanup

- remove 3 unused/obsolete productions
- appease PMD/Codacy

* feat: Merge `SelectBody` into `Select` Statement

- former `SelectBody` implements `Statement` and so becomes `Select`
- this reduces the AST by 1 hierarchy level

* style: Remove unused import

* test: @disabled invalid Test

* style: Appease PMD/Codacy

* test: Add a SubSelect Parsing Test

---------

Co-authored-by: zaza <tzarna@gmail.com>
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 a pull request may close this issue.

4 participants