Repository: taozhi8833998/node-sql-parser

Issue:
Support UNLOGGED tables in create statements
**Database Engine**
PostgreSQL

**To Reproduce**
-the SQL that be parsed
```sql
CREATE UNLOGGED TABLE t1 (
    id integer PRIMARY KEY,
    data text
);
```
-the node-sql-parser version
v5.3.8
-the node version
v18.20.3

**Expected behavior**
Parse successfully 


Discussion:

Solution patch:
diff --git a/pegjs/postgresql.pegjs b/pegjs/postgresql.pegjs
index 614d639..33f0324 100644
--- a/pegjs/postgresql.pegjs
+++ b/pegjs/postgresql.pegjs
@@ -812,6 +812,7 @@ create_domain_stmt
 create_table_stmt
   = a:KW_CREATE __
     tp:KW_TEMPORARY? __
+    ul:KW_UNLOGGED? __
     KW_TABLE __
     ife:if_not_exists_stmt? __
     t:table_ref_list __
@@ -825,6 +826,7 @@ create_table_stmt
           type: a[0].toLowerCase(),
           keyword: 'table',
           temporary: tp && tp[0].toLowerCase(),
+          unlogged: ul,
           if_not_exists: ife,
           table: t,
           partition_of: po
@@ -833,6 +835,7 @@ create_table_stmt
     }
   /  a:KW_CREATE __
     tp:KW_TEMPORARY? __
+    ul:KW_UNLOGGED? __
     KW_TABLE __
     ife:if_not_exists_stmt? __
     t:table_ref_list __
@@ -847,6 +850,7 @@ create_table_stmt
         type: 'create';
         keyword: 'table';
         temporary?: 'temporary';
+        unlogged?: 'unlogged';
         if_not_exists?: 'if not exists';
         table: table_ref_list;
       }
@@ -867,6 +871,7 @@ create_table_stmt
           type: a[0].toLowerCase(),
           keyword: 'table',
           temporary: tp && tp[0].toLowerCase(),
+          unlogged: ul,
           if_not_exists:ife,
           table: t,
           ignore_replace: ir && ir[0].toLowerCase(),
@@ -879,6 +884,7 @@ create_table_stmt
     }
   / a:KW_CREATE __
     tp:KW_TEMPORARY? __
+    ul:KW_UNLOGGED? __
     KW_TABLE __
     ife:if_not_exists_stmt? __
     t:table_ref_list __
@@ -898,6 +904,7 @@ create_table_stmt
           type: a[0].toLowerCase(),
           keyword: 'table',
           temporary: tp && tp[0].toLowerCase(),
+          unlogged: ul,
           if_not_exists:ife,
           table: t,
           like: lt
@@ -5477,6 +5484,7 @@ KW_SELECT   = "SELECT"i     !ident_start
 KW_UPDATE   = "UPDATE"i     !ident_start
 KW_CREATE   = "CREATE"i     !ident_start
 KW_TEMPORARY = "TEMPORARY"i !ident_start
+KW_UNLOGGED = "UNLOGGED" !ident_start { return 'UNLOGGED'; }
 KW_TEMP     = "TEMP"i !ident_start
 KW_DELETE   = "DELETE"i     !ident_start
 KW_INSERT   = "INSERT"i     !ident_start
diff --git a/src/create.js b/src/create.js
index bed93ec..623f353 100644
--- a/src/create.js
+++ b/src/create.js
@@ -75,9 +75,10 @@ function createTableToSQL(stmt) {
     replace: orReplace,
     partition_of: partitionOf,
     query_expr: queryExpr,
+    unlogged: unLogged,
     with: withExpr,
   } = stmt
-  const sql = [toUpper(type), toUpper(orReplace), toUpper(temporary), toUpper(keyword), toUpper(ifNotExists), tablesToSQL(table)]
+  const sql = [toUpper(type), toUpper(orReplace), toUpper(temporary), toUpper(unLogged), toUpper(keyword), toUpper(ifNotExists), tablesToSQL(table)]
   if (like) {
     const { type: likeType, table: likeTable } = like
     const likeTableName = tablesToSQL(likeTable)



Test patch:
diff --git a/test/postgres.spec.js b/test/postgres.spec.js
index e7c2adf..59fdf58 100644
--- a/test/postgres.spec.js
+++ b/test/postgres.spec.js
@@ -2124,6 +2124,16 @@ describe('Postgres', () => {
           'DROP TYPE IF EXISTS some_type, other_type CASCADE'
         ]
       },
+      {
+        title: 'unlogged table',
+        sql: [
+          `CREATE UNLOGGED TABLE t1 (
+              id integer PRIMARY KEY,
+              data text
+          );`,
+          'CREATE UNLOGGED TABLE "t1" (id INTEGER PRIMARY KEY, data TEXT)'
+        ]
+      },
     ]
     neatlyNestTestedSQL(SQL_LIST)
   })