Emmanuel BENOîT
3e109b13bc
* Added user mapping on the "remote" logging database for the administrative user. This allows calls to sys.write_sql_log() to succeed when they are executed by code with administrative privileges. * Added test suites for both the link to the database and the function itself. * Replaced RAISE NOTICE with actual logging in the universe generator
30 lines
834 B
SQL
30 lines
834 B
SQL
-- LegacyWorlds Beta 6
|
|
-- PostgreSQL database scripts
|
|
--
|
|
-- Load and configure required PostgreSQL extensions
|
|
--
|
|
-- Copyright(C) 2004-2012, DeepClone Development
|
|
-- --------------------------------------------------------
|
|
|
|
/* Register the dblink extension */
|
|
CREATE EXTENSION dblink;
|
|
|
|
/* Create foreign data wrapper and server used to write logs from within
|
|
* transanctions
|
|
*/
|
|
CREATE FOREIGN DATA WRAPPER pgsql
|
|
VALIDATOR postgresql_fdw_validator;
|
|
|
|
CREATE SERVER srv_logging
|
|
FOREIGN DATA WRAPPER pgsql
|
|
OPTIONS ( hostaddr '127.0.0.1' , dbname :dbname_string );
|
|
|
|
CREATE USER MAPPING FOR :pgadmin
|
|
SERVER srv_logging
|
|
OPTIONS ( user :dbuser_string , password :dbupass );
|
|
|
|
CREATE USER MAPPING FOR :dbuser
|
|
SERVER srv_logging
|
|
OPTIONS ( user :dbuser_string , password :dbupass );
|
|
|
|
GRANT USAGE ON FOREIGN SERVER srv_logging TO :dbuser;
|