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

Region Collapse not working with SQL2016 Temporal Table Syntax #2020

Open
robert-io opened this issue Jun 28, 2016 · 1 comment
Open

Region Collapse not working with SQL2016 Temporal Table Syntax #2020

robert-io opened this issue Jun 28, 2016 · 1 comment

Comments

@robert-io
Copy link

robert-io commented Jun 28, 2016

When defining a temporal table the GENERATED ALWAYS AS ROW END statement triggers the collapsible region prematurely.

The following collapses the whole table leaving just the CREATE TABLE line as expected:

CREATE TABLE [dbo].[Person] (
   [PersonId]
      INT
      IDENTITY(1, 1)
      NOT NULL,

   [Name]
      NVARCHAR(400)
      NOT NULL,

   [BornOn]
      DATETIMEOFFSET
      NOT NULL
);

But the following collapses to the GENERATED ALWAYS AS ROW END leaving the rest of the table exposed:

CREATE TABLE [dbo].[Person] (
   [ValidFrom]
      DATETIME2
      GENERATED ALWAYS AS ROW START
      NOT NULL,

   [ValidTo]
      DATETIME2
      GENERATED ALWAYS AS ROW END
      NOT NULL,

   [PersonId]
      INT
      IDENTITY(1, 1)
      NOT NULL,

   [Name]
      NVARCHAR(400)
      NOT NULL,

   [BornOn]
      DATETIMEOFFSET
      NOT NULL,

   PERIOD FOR SYSTEM_TIME ([ValidFrom], [ValidTo])
)
WITH (SYSTEM_VERSION = ON (HISTORY_TABLE = [dbo].[Person:History]));

Test Conditions:

  • OS: Windows 10
  • Notepad++: v6.9.2
  • Language: SQL

I suspect that for the SQL Language the END keyword is trigger to end the region but in this case the region wasn't started with BEGIN so END shouldn't have a corresponding opening region trigger.

I hope i have provided enough information and you also consider this a bug.

@ArkadiuszMichalski
Copy link
Contributor

You use SQL lexer which is not intended for SQL2016, should be used MSSQL lexer, unfortunately it is currently not exposed in Notepad ++ (same as MySQL lexer). SQL lexer is for standard SQL and Oracle. It would be nice to expose some existing (and popular) lexers.

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

No branches or pull requests

2 participants