cartodb-4.42/lib/sql/scripts-available/CDB_Username.sql

11 lines
324 B
MySQL
Raw Normal View History

2024-04-06 13:25:13 +08:00
-- Returns the cartodb username of the current PostgreSQL session
CREATE OR REPLACE FUNCTION @extschema@.CDB_Username()
RETURNS text
AS $$
SELECT @extschema@.CDB_Conf_GetConf(concat('api_keys_', session_user))->>'username';
$$ LANGUAGE SQL
STABLE
PARALLEL SAFE
SECURITY DEFINER
SET search_path = pg_temp;