cartodb-postgresql/scripts-available/CDB_Username.sql

7 lines
257 B
MySQL
Raw Normal View History

-- Returns the cartodb username of the current PostgreSQL session
2019-02-20 17:38:00 +08:00
CREATE OR REPLACE FUNCTION CDB_Username()
RETURNS text
AS $$
SELECT CDB_Conf_GetConf(CONCAT('api_keys_', session_user))->>'username';
$$ LANGUAGE SQL STABLE PARALLEL SAFE SECURITY DEFINER;