diff --git a/contrib/custom_analyzer_demo/README b/contrib/custom_analyzer_demo/README index f5658fa4a95e21d81da4bf54db7779ca9e37f1de..10d941a06ee24ec1e1b5a557fbb17589d4112491 100644 --- a/contrib/custom_analyzer_demo/README +++ b/contrib/custom_analyzer_demo/README @@ -1,3 +1,28 @@ +## Introduction This is a demo to show how to implement an custom analyzer for openGauss. This demo changes the logic of check_ungrouped_columns_walker, in order to support syntax like SELECT a, b FROM t1 GROUP BY a; which is not supported by original openGauss. -The main logic is to implement an custom AnalyzerRoutine. Check function transformStmt for more details. \ No newline at end of file +The main logic is to implement an custom AnalyzerRoutine. Check function transformStmt for more details. + +## Installation +Copy custom_analyzer_demo directoty to openGauss-server/contrib and make. +``` +cp contrib/custom_analyzer_demo /YOUR_PATH/openGauss-server/contrib -r +cd /YOUR_PATH/openGauss-server/contrib +make && make install +``` + +## Use extension +Connect to gaussdb and create extension. +``` +CREATE EXTENSION custom_analyzer_demo; +``` + +## Test the extension +``` +CREATE TABLE t1(a int, b int); +INSERT INTO t1 values(1,1),(2,2),(3,3),(1,66),(2,88); +SELECT a, b FROM t1 GROUP BY a; --- report error + +SET custom_analyzer_demo.enable_custom_analyzer to true; +SELECT a, b FROM t1 GROUP BY a; --- success +``` \ No newline at end of file