cartodb-postgresql/scripts-available/CDB_Username.sql
2019-03-13 10:29:50 +01:00

7 lines
273 B
PL/PgSQL

-- Returns the cartodb username of the current PostgreSQL session
CREATE OR REPLACE FUNCTION cartodb.CDB_Username()
RETURNS text
AS $$
SELECT cartodb.CDB_Conf_GetConf(CONCAT('api_keys_', session_user))->>'username';
$$ LANGUAGE SQL STABLE PARALLEL SAFE SECURITY DEFINER;