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
Support parsing ALTER STATISTICS
in PostgreSQL
#19842
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19842 +/- ##
============================================
- Coverage 60.12% 60.11% -0.01%
- Complexity 2409 2410 +1
============================================
Files 3852 3855 +3
Lines 54936 54935 -1
Branches 7706 7706
============================================
- Hits 33031 33026 -5
- Misses 19070 19075 +5
+ Partials 2835 2834 -1
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
@@ -1056,10 +1056,10 @@ foreignServerVersion | |||
|
|||
alterStatistics | |||
: ALTER STATISTICS | |||
( ifExists? anyName SET STATISTICS signedIconst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove ifExists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't exsits in the PostgreSQL dialect here
https://www.postgresql.org/docs/current/sql-alterstatistics.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't exsits in the PostgreSQL dialect here https://www.postgresql.org/docs/current/sql-alterstatistics.html
Can you check this grammar in PostgreSQL source code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean the postgres gram.y file right?
AlterStatsStmt:
ALTER STATISTICS any_name SET STATISTICS SignedIconst
{
AlterStatsStmt *n = makeNode(AlterStatsStmt);
n->defnames = $3;
n->missing_ok = false;
n->stxstattarget = $6;
$$ = (Node *) n;
}
| ALTER STATISTICS IF_P EXISTS any_name SET STATISTICS SignedIconst
{
AlterStatsStmt *n = makeNode(AlterStatsStmt);
n->defnames = $5;
n->missing_ok = true;
n->stxstattarget = $8;
$$ = (Node *) n;
}
;
There if exists is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, document is sometimes inaccurate, and source code can give us better guidance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for this tip! will keep this in my mind for my next PRs . Ill revert the changes for DDLStatement.g4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@everly-gif Another perfect pr. 👍
Ref #17848 .
Sub-issue of #14015
Changes proposed in this pull request:
ALTER STATISTICS
grammarALTER STATISTICS
in PostgreSQL✅ Builds locally