From b8eacd99a2c9453a52e682cb17d2256ee64bfd91 Mon Sep 17 00:00:00 2001
From: ironman <34911091+lcfliuxi@users.noreply.github.com>
Date: Wed, 6 Nov 2024 14:22:22 +0800
Subject: [PATCH 1/4] Fix PostgreSQL time extract function parse week and
quarter error
---
.../postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 b/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
index 751ca07f4e0f2..4a1910c3b99f4 100644
--- a/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
+++ b/parser/sql/dialect/postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
@@ -330,6 +330,7 @@ unreservedWord
| PROCEDURES
| PROGRAM
| PUBLICATION
+ | QUARTER
| QUOTE
| RANGE
| READ
@@ -428,6 +429,7 @@ unreservedWord
| VIEW
| VIEWS
| VOLATILE
+ | WEEK
| WHITESPACE
| WITHIN
| WITHOUT
@@ -1114,7 +1116,9 @@ extractList
extractArg
: YEAR
+ | QUARTER
| MONTH
+ | WEEK
| DAY
| HOUR
| MINUTE
From 48b3080b04780a435c525d00528ef6e1976a4dee Mon Sep 17 00:00:00 2001
From: ironman <34911091+lcfliuxi@users.noreply.github.com>
Date: Wed, 6 Nov 2024 14:22:44 +0800
Subject: [PATCH 2/4] Fix openGauss time extract function parse week and
quarter error
---
.../opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
index abf4c2e63d310..610ebdda0be74 100644
--- a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
+++ b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
@@ -329,6 +329,7 @@ unreservedWord
| PROCEDURES
| PROGRAM
| PUBLICATION
+ | QUARTER
| QUOTE
| RANGE
| READ
@@ -427,6 +428,7 @@ unreservedWord
| VIEW
| VIEWS
| VOLATILE
+ | WEEK
| WHITESPACE
| WITHIN
| WITHOUT
@@ -1147,7 +1149,9 @@ extractList
extractArg
: YEAR
+ | QUARTER
| MONTH
+ | WEEK
| DAY
| HOUR
| MINUTE
From eb388095c15088a82ec85dce8af042bd48fc50d2 Mon Sep 17 00:00:00 2001
From: liuch <3466762859@qq.com>
Date: Thu, 7 Nov 2024 10:57:34 +0800
Subject: [PATCH 3/4] Support time extract function parse week and quarter in
openGauss
---
.../parser/src/main/resources/sql/unsupported/unsupported.xml | 2 --
1 file changed, 2 deletions(-)
diff --git a/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml b/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
index d9f55d822d7ba..adfbcb535a9b6 100644
--- a/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
+++ b/test/it/parser/src/main/resources/sql/unsupported/unsupported.xml
@@ -262,8 +262,6 @@
-
-
From d1d70c6f24170d8135d2949bc8600730148d3b4f Mon Sep 17 00:00:00 2001
From: liuch <3466762859@qq.com>
Date: Thu, 7 Nov 2024 13:50:15 +0800
Subject: [PATCH 4/4] Added support for time extract function parse week and
quarter in PostgreSQL and openGauss
---
.../case/dml/select-special-function.xml | 44 +++++++++++++++++++
.../supported/dml/select-special-function.xml | 2 +
2 files changed, 46 insertions(+)
diff --git a/test/it/parser/src/main/resources/case/dml/select-special-function.xml b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
index 696568f2e0828..6712182134b86 100644
--- a/test/it/parser/src/main/resources/case/dml/select-special-function.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
@@ -440,6 +440,50 @@
+
+
+
+