The following query
Code: Select all
select table_name from v_catalog.tables
where table_schema=(select current_schema())
ERROR: Meta-function("current_schema") can be used only in the Select clause; Error while executing the query.
Moderator: NorbertKrupa
Code: Select all
select table_name from v_catalog.tables
where table_schema=(select current_schema())
ERROR: Meta-function("current_schema") can be used only in the Select clause; Error while executing the query.
Code: Select all
SELECT table_schema,
table_name
FROM tables
WHERE table_schema = (SELECT split_part(trim(split_part(qp.query_search_path, ',', 2)), ' ', 1) the_current_schema
FROM current_session cs
JOIN query_profiles qp
ON qp.transaction_id = cs.transaction_id
AND qp.statement_id = cs.statement_id)
ORDER BY table_name;
Code: Select all
SELECT table_schema,
table_name
FROM tables
WHERE table_schema = (SELECT split_part(trim(split_part(search_path, ',', 2)), ' ', 1) the_current_schema
FROM users
WHERE user_name = user)
ORDER BY table_name;
Code: Select all
dbadmin=> select current_user(), user;
current_user | current_user
--------------+--------------
dbadmin | dbadmin
(1 row)
Code: Select all
dbadmin=> select current_schema(), schema;
ERROR 4856: Syntax error at or near "schema" at character 26
LINE 1: select current_schema(), schema;
^