Skip to content

Commit

Permalink
Support LIMIT clause in DB2 and DB2i
Browse files Browse the repository at this point in the history
Turns out that DB2 documentation does mention the LIMIT clause,
but it's sneakily hidden at the bottom of the documentation page
and not included to the syntax diagram at the top.
  • Loading branch information
nene committed Nov 13, 2023
1 parent ee7c3a5 commit 653cfc8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/languages/db2/db2.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const reservedClauses = expandPhrases([
'HAVING',
'PARTITION BY',
'ORDER BY [INPUT SEQUENCE]',
'LIMIT',
'OFFSET',
'FETCH NEXT',
'FOR UPDATE [OF]',
Expand Down
1 change: 1 addition & 0 deletions src/languages/db2i/db2i.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const reservedClauses = expandPhrases([
'HAVING',
'PARTITION BY',
'ORDER [SIBLINGS] BY [INPUT SEQUENCE]',
'LIMIT',
'OFFSET',
'FETCH {FIRST | NEXT}',
'FOR UPDATE [OF]',
Expand Down
2 changes: 1 addition & 1 deletion test/db2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Db2Formatter', () => {
behavesLikeDb2Formatter(format);

supportsComments(format);
supportsLimiting(format, { fetchNext: true, offset: true });
supportsLimiting(format, { limit: true, fetchNext: true, offset: true });
supportsCreateTable(format);
supportsAlterTable(format, {
addColumn: true,
Expand Down
2 changes: 1 addition & 1 deletion test/db2i.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Db2iFormatter', () => {
behavesLikeDb2Formatter(format);

supportsComments(format, { nestedBlockComments: true });
supportsLimiting(format, { fetchNext: true, fetchFirst: true, offset: true });
supportsLimiting(format, { limit: true, fetchNext: true, fetchFirst: true, offset: true });
supportsCreateTable(format, { orReplace: true });
supportsAlterTable(format, {
addColumn: true,
Expand Down

0 comments on commit 653cfc8

Please sign in to comment.