mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Make it possible for regular users to execute functions in the schema `_timescaledb_debug`. As a consequence, the `extension_state()` function in this schema can now be executed by "public". This is the only function in this schema and there is no security risk in making it accessible.
27 lines
742 B
SQL
27 lines
742 B
SQL
-- This file and its contents are licensed under the Apache License 2.0.
|
|
-- Please see the included NOTICE for copyright information and
|
|
-- LICENSE-APACHE for a copy of the license.
|
|
|
|
\c :TEST_DBNAME :ROLE_SUPERUSER
|
|
SET ROLE :ROLE_DEFAULT_PERM_USER;
|
|
|
|
SELECT _timescaledb_debug.extension_state();
|
|
|
|
RESET ROLE;
|
|
|
|
DO $$
|
|
DECLARE
|
|
module text;
|
|
BEGIN
|
|
SELECT probin INTO module FROM pg_proc WHERE proname = 'extension_state' AND pronamespace = '_timescaledb_debug'::regnamespace;
|
|
EXECUTE format('CREATE FUNCTION extension_state() RETURNS TEXT AS ''%s'', ''ts_extension_get_state'' LANGUAGE C', module);
|
|
END
|
|
$$;
|
|
|
|
DROP EXTENSION timescaledb;
|
|
SELECT * FROM extension_state();
|
|
|
|
\c
|
|
CREATE EXTENSION timescaledb;
|
|
SELECT * FROM extension_state();
|