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

TSQL temp tables #1574

Merged
merged 2 commits into from Oct 9, 2021
Merged

TSQL temp tables #1574

merged 2 commits into from Oct 9, 2021

Conversation

jpers36
Copy link
Contributor

@jpers36 jpers36 commented Oct 9, 2021

Fixes #1572

TSQL temp tables are identified by a single-hash or double-hash prefix.

https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql?view=sql-server-ver15#temporary-tables

TSQL changes:
+hash_prefix RegexLexer
+inline_comment RegexLexer patch to remove hash commenting
+HashIdentifierSegment to represent a hash-prefixed temp table identifier
Adjust SingleIdentifierGrammar to add HashIdentifierSegment

Test case changes:
+tsql/temp_tables.sql to test temp table identification

@codecov
Copy link

codecov bot commented Oct 9, 2021

Codecov Report

Merging #1574 (e170f4c) into main (eb44ebd) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1574   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          133       133           
  Lines         9338      9339    +1     
=========================================
+ Hits          9338      9339    +1     
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_tsql.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb44ebd...e170f4c. Read the comment docs.

Copy link
Member

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

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

Approved but know @alanmcruickshank is working on 0.7.0 beta release right now so won’t merge for now in case that interrupts his flow.

@alanmcruickshank
Copy link
Member

Nah - this can merge ok :)

@alanmcruickshank alanmcruickshank merged commit 5005058 into sqlfluff:main Oct 9, 2021
@alanmcruickshank alanmcruickshank added the enhancement New feature or request label Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TSQL: Support for temp tables
4 participants