Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some pg session function to pg_catalog #10156

Merged
merged 1 commit into from Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/catalog/default/default_functions.cpp
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/sql/catalog/test_set_search_path.test
Expand Up @@ -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';

Expand All @@ -103,6 +108,11 @@ SELECT MAIN.CURRENT_SCHEMA();
----
test

query I
SELECT pg_catalog.CURRENT_SCHEMA();
----
test

query I
SELECT current_schema();
----
Expand Down
10 changes: 10 additions & 0 deletions test/sql/pg_catalog/system_functions.test
Expand Up @@ -20,6 +20,11 @@ SELECT CURRENT_DATABASE()
----
memory

query I
SELECT pg_catalog.CURRENT_DATABASE()
----
memory

query I
SELECT USER
----
Expand All @@ -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();
----
Expand Down