Repository: taozhi8833998/node-sql-parser

Issue:
FETCH keyword related syntax not supported for DB2
The following query works fine on the DB2 database.

SELECT * FROM "FGVST2"."CONTACT_TABLE25" FETCH FIRST 10 ROWS ONLY

But astify is throwing error 
<img width="322" alt="image" src="https://github.com/user-attachments/assets/f1878fb0-23f3-4480-8c29-9df8c388ed11" />


<img width="830" alt="image" src="https://github.com/user-attachments/assets/2a02c48f-90c5-4713-b982-f70ab145bbe5" />


Hints from issue comments:
@prchimbalkar: Thanks @taozhi8833998!@daymaadi: @taozhi8833998  - Getting below error when I am using same query. Looks like the issue is not resolved

![Image](https://github.com/user-attachments/assets/17e56afd-392b-499a-bb78-87aecd8e304e)

Solution patch:
diff --git a/pegjs/db2.pegjs b/pegjs/db2.pegjs
index ab36e02..dfc89f7 100644
--- a/pegjs/db2.pegjs
+++ b/pegjs/db2.pegjs
@@ -30,6 +30,7 @@
     'EXPLAIN': true,
 
     'FALSE': true,
+    'FETCH': true,
     'FROM': true,
     'FULL': true,
 
@@ -898,9 +899,7 @@ table_option
 
 
 ALTER_ADD_FULLETXT_SPARITAL_INDEX
-  = KW_ADD __
-    fsid:create_fulltext_spatial_index_definition
-     {
+  = KW_ADD __ fsid:create_fulltext_spatial_index_definition {
       return {
         action: 'add',
         type: 'alter',



Test patch:
diff --git a/test/db2.spec.js b/test/db2.spec.js
index f0e7a1e..2990f4e 100644
--- a/test/db2.spec.js
+++ b/test/db2.spec.js
@@ -13,5 +13,7 @@ describe('db2', () => {
   it('should support basic db2', () => {
     let sql = 'SELECT  id as test FROM customers'
     expect(getParsedSql(sql)).to.be.equal('SELECT id AS test FROM customers')
+    sql = 'SELECT * FROM "FGVST2"."CONTACT_TABLE25" FETCH FIRST 10 ROWS ONLY'
+    expect(getParsedSql(sql)).to.be.equal('SELECT * FROM FGVST2.CONTACT_TABLE25 FETCH FIRST 10 ROWS ONLY')
   })
 })
\ No newline at end of file