Skip to content

Conversation

@ovr
Copy link
Contributor

@ovr ovr commented Aug 9, 2022

Hello!

Note: current_catalog, current_schema, current_user, session_user, and user have special syntactic status in SQL: they must be called without trailing parentheses. (In PostgreSQL, parentheses can optionally be used with current_schema, but not with the others.)

https://www.postgresql.org/docs/9.1/functions-info.html

Thanks

@coveralls
Copy link

coveralls commented Aug 9, 2022

Pull Request Test Coverage Report for Build 2839618346

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 39 of 50 (78.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 89.945%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/mod.rs 7 10 70.0%
src/parser.rs 5 13 38.46%
Files with Coverage Reduction New Missed Lines %
src/parser.rs 1 83.21%
Totals Coverage Status
Change from base Build 2839268478: -0.04%
Covered Lines: 9240
Relevant Lines: 10273

💛 - Coveralls

@alamb alamb changed the title feat: Parse special keywors as functions (current_user, user, etc) feat: Parse special keywords as functions (current_user, user, etc) Aug 11, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ovr -- looks good to me except for a question about the special field

pub over: Option<WindowSpec>,
// aggregate functions may specify eg `COUNT(DISTINCT x)`
pub distinct: bool,
pub special: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why a special field is needed ? Wouldn't it be enough to match on the name?

If we do need a special field, can you please add a /// comment explaining what it means and what it is used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this field to skip formating (arguments).

image

Right now, Dialect is not available in formating, because we use fmt::Display for implementing to_string() method.

@alamb
Copy link
Contributor

alamb commented Aug 11, 2022

Marking this as a draft to show it is waiting some changes so I can easily filter out which PRs need review. Please mark it as "ready for review" when it is next ready.

@alamb alamb marked this pull request as draft August 11, 2022 10:48
@ovr ovr force-pushed the special-keyword-functions-pr branch from 8b700ff to a6a3340 Compare August 11, 2022 12:00
@ovr ovr marked this pull request as ready for review August 11, 2022 12:05
@alamb
Copy link
Contributor

alamb commented Aug 11, 2022

Thanks @ovr

@alamb alamb merged commit 54a29e8 into apache:main Aug 11, 2022
@ovr ovr deleted the special-keyword-functions-pr branch August 11, 2022 13:01
mcheshkov pushed a commit to cube-js/sqlparser-rs that referenced this pull request Sep 2, 2024
Can drop this after rebase on commit 54a29e8 " feat: Parse special keywords as functions (current_user, user, etc) (apache#561)", first released in 0.21.0
mcheshkov pushed a commit to cube-js/sqlparser-rs that referenced this pull request Sep 3, 2024
Can drop this after rebase on commit 54a29e8 " feat: Parse special keywords as functions (current_user, user, etc) (apache#561)", first released in 0.21.0
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.

3 participants