From 7223561f71d3e6c8962873df49b3a01f9e42019c Mon Sep 17 00:00:00 2001 From: Alexey Borzov Date: Tue, 29 Aug 2023 08:53:55 +0300 Subject: [PATCH] Added `SYSTEM_USER` handling --- Changelog.md | 1 + .../pg_builder/nodes/expressions/SQLValueFunction.php | 4 +++- tests/ParseFunctionCallTest.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 50b6297..8f555f7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,6 +11,7 @@ Support new syntax of PostgreSQL 16 (as of beta 3) `nodes\json\JsonObjectAgg`; * Constructor functions `json_array()` and `json_object()` represented by `nodes\json\JsonArrayValueList`, `nodes\json\JsonArraySubselect`, `nodes\json\JsonObject` classes. + * `SYSTEM_USER` server variable backed by `nodes\expressions\SQLValueFunction`. ## [2.2.0] - 2023-05-14 diff --git a/src/sad_spirit/pg_builder/nodes/expressions/SQLValueFunction.php b/src/sad_spirit/pg_builder/nodes/expressions/SQLValueFunction.php index 904d67d..cdcc165 100644 --- a/src/sad_spirit/pg_builder/nodes/expressions/SQLValueFunction.php +++ b/src/sad_spirit/pg_builder/nodes/expressions/SQLValueFunction.php @@ -51,6 +51,7 @@ class SQLValueFunction extends GenericNode implements FunctionLike, ScalarExpres public const USER = 'user'; public const CURRENT_CATALOG = 'current_catalog'; public const CURRENT_SCHEMA = 'current_schema'; + public const SYSTEM_USER = 'system_user'; public const CURRENT_TIME = 'current_time'; public const CURRENT_TIMESTAMP = 'current_timestamp'; @@ -67,7 +68,8 @@ class SQLValueFunction extends GenericNode implements FunctionLike, ScalarExpres self::SESSION_USER, self::USER, self::CURRENT_CATALOG, - self::CURRENT_SCHEMA + self::CURRENT_SCHEMA, + self::SYSTEM_USER ]; /** diff --git a/tests/ParseFunctionCallTest.php b/tests/ParseFunctionCallTest.php index b4a9439..76ac9e1 100644 --- a/tests/ParseFunctionCallTest.php +++ b/tests/ParseFunctionCallTest.php @@ -105,7 +105,7 @@ protected function setUp(): void public function testNoParenthesesFunctions(): void { $list = $this->parser->parseExpressionList($input = <<