-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
Postgres "ALTER TABLE" enhancement, and timestamp bug fix #1338
Postgres "ALTER TABLE" enhancement, and timestamp bug fix #1338
Conversation
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.
The code looks good. I'm seeing some linter failures. Can you address these? I think it'll be ready to merge at that point, assuming the build passes.
./src/sqlfluff/dialects/dialect_ansi.py:519:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:361:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:440:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:440:1: D415 First line should end with a period, question mark, or exclamation point
./src/sqlfluff/dialects/dialect_postgres.py:625:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:683:1: D200 One-line docstring should fit on one line with quotes
./src/sqlfluff/dialects/dialect_postgres.py:683:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:683:1: D415 First line should end with a period, question mark, or exclamation point
./src/sqlfluff/dialects/dialect_postgres.py:796:1: D200 One-line docstring should fit on one line with quotes
./src/sqlfluff/dialects/dialect_postgres.py:796:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:796:1: D415 First line should end with a period, question mark, or exclamation point
./src/sqlfluff/dialects/dialect_postgres.py:821:1: D200 One-line docstring should fit on one line with quotes
./src/sqlfluff/dialects/dialect_postgres.py:821:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:821:1: D415 First line should end with a period, question mark, or exclamation point
./src/sqlfluff/dialects/dialect_postgres.py:849:1: D200 One-line docstring should fit on one line with quotes
./src/sqlfluff/dialects/dialect_postgres.py:849:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:849:1: D415 First line should end with a period, question mark, or exclamation point
./src/sqlfluff/dialects/dialect_postgres.py:866:1: D200 One-line docstring should fit on one line with quotes
./src/sqlfluff/dialects/dialect_postgres.py:866:1: D212 Multi-line docstring summary should start at the first line
./src/sqlfluff/dialects/dialect_postgres.py:866:1: D415 First line should end with a period, question mark, or exclamation point
Codecov Report
@@ Coverage Diff @@
## main #1338 +/- ##
==========================================
+ Coverage 97.07% 97.10% +0.03%
==========================================
Files 124 124
Lines 8541 8573 +32
==========================================
+ Hits 8291 8325 +34
+ Misses 250 248 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Linter failures fixed, build passing |
@WittierDinosaur can you checkout what's going on with the formatting changes to |
@tunetheweb No, I'm not sure why that is happening. But I don't think it's been introduced by my code. The output is weird, but it passes the tox -e bench test. I think this issue was introduced somewhere else. I just ran tox before I committed, so the file was changed. I'm getting the same behaviour if I run tox -e bench when I checkout main. Can you verify it's happening on the main branch for you? |
No I'm not getting it. Do you have a |
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.
Looks great. Though as discussed can you try and figure out the benchmark change? Maybe a rogue .sqlfluff
file?
@tunetheweb I've just cloned sqlfluff's main fresh, pip installed tox, and the bench output is doing the same thing. I have no idea how to explain it. Surely nothing is cached outside of the project folder? Maybe an OS thing? I don't know. |
Weird! For now do you just wanna revert the changes in your branch and try your best not to check them in? |
Can do, worried about them masking an issue though. Are you able to checkout my branch and see if tox -e bench does this for my branch on your machine? |
Update - I got my flatmate to test on his machine. His steps were, git clone, pip install tox, tox -e bench, and the same thing happened on his machine |
Actually you're right it DOES do this for me. Sorry for misleading you. I've just never run
So never noticed this before. So we might as well commit it to avoid the issue in future for anyone else that runs this! |
Thought I was going mad 😄 Okay, add in your edits, and check that not keyword then, commits inbound shortly. Also, we should raise this as a bug, i'm sure that's not the expected format |
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.
LGTM! Thanks for this - and for working through the feedback.
@barrywhart you any further comments or happy to merge?
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.
Looks good to me! My only concern was the code linter stuff, and that's been addressed. Thanks!
Hello guys, |
The initial purpose of this PR was to enhance the functionality of ALTER TABLE is Postgres, to match https://www.postgresql.org/docs/13/sql-altertable.html
However, the PR also includes a bugfix, for the timestamp with time zone issue, as this was getting in the way of my testing. It also slightly expands the definition of Expression D in ANSI, to allow the following kind of expression:
timestamp 'epoch' + foo_timestamp * interval '1 second'
Fixes #1289, Fixes #1286, Fixes #1168, Fixes #1155
Are there any other side effects of this change that we should be aware of?
Expands ANSI definitions of Expression_D, and timestamp with time zone (this is ANSI standard though). All current ANSI tests pass.
Pull Request checklist
I have included a lot of test cases for alter table - though more may be required.
The only extra functionality needed is sequences, for which I haven't yet raised a ticket