Files
cartodb-postgresql/scripts-available/CDB_Username.sql
2019-10-03 18:58:27 +02:00

11 lines
337 B
PL/PgSQL

-- 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 = @extschema@, pg_temp;