diff --git a/src/catalog/default/default_functions.cpp b/src/catalog/default/default_functions.cpp index cedef30b4bd..7fb47ecd776 100644 --- a/src/catalog/default/default_functions.cpp +++ b/src/catalog/default/default_functions.cpp @@ -27,6 +27,11 @@ static DefaultMacro internal_macros[] = { {"pg_catalog", "pg_typeof", {"expression", nullptr}, "lower(typeof(expression))"}, // get the data type of any value + {"pg_catalog", "current_database", {nullptr}, "current_database()"}, // name of current database (called "catalog" in the SQL standard) + {"pg_catalog", "current_query", {nullptr}, "current_query()"}, // the currently executing query (NULL if not inside a plpgsql function) + {"pg_catalog", "current_schema", {nullptr}, "current_schema()"}, // name of current schema + {"pg_catalog", "current_schemas", {"include_implicit"}, "current_schemas(include_implicit)"}, // names of schemas in search path + // privilege functions // {"has_any_column_privilege", {"user", "table", "privilege", nullptr}, "true"}, //boolean //does user have privilege for any column of table {"pg_catalog", "has_any_column_privilege", {"table", "privilege", nullptr}, "true"}, //boolean //does current user have privilege for any column of table diff --git a/test/sql/catalog/test_set_search_path.test b/test/sql/catalog/test_set_search_path.test index c16283e0546..66a9ce7d3f8 100644 --- a/test/sql/catalog/test_set_search_path.test +++ b/test/sql/catalog/test_set_search_path.test @@ -90,6 +90,11 @@ SELECT MAIN.CURRENT_SCHEMAS(false); ---- [test, test2] +query I +SELECT pg_catalog.CURRENT_SCHEMAS(false); +---- +[test, test2] + statement ok SET SCHEMA = 'test'; @@ -103,6 +108,11 @@ SELECT MAIN.CURRENT_SCHEMA(); ---- test +query I +SELECT pg_catalog.CURRENT_SCHEMA(); +---- +test + query I SELECT current_schema(); ---- diff --git a/test/sql/pg_catalog/system_functions.test b/test/sql/pg_catalog/system_functions.test index b92f90d7f7d..a79122dd37b 100644 --- a/test/sql/pg_catalog/system_functions.test +++ b/test/sql/pg_catalog/system_functions.test @@ -20,6 +20,11 @@ SELECT CURRENT_DATABASE() ---- memory +query I +SELECT pg_catalog.CURRENT_DATABASE() +---- +memory + query I SELECT USER ---- @@ -38,6 +43,11 @@ SELECT current_query(); ---- SELECT current_query(); +query I +SELECT pg_catalog.current_query(); +---- +SELECT pg_catalog.current_query(); + query IIII SELECT 1, 2, 3, current_query(); ----