SQL logging fixes

* 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
This commit is contained in:
Emmanuel BENOîT 2012-01-07 11:14:17 +01:00
parent e50775ec76
commit 3e109b13bc
9 changed files with 177 additions and 64 deletions
legacyworlds-server-data/db-structure/tests/user/020-extensions

View file

@ -0,0 +1,23 @@
/*
* Test the configuration of the dblink extension from the user's perspective
*/
BEGIN;
SELECT plan( 3 );
SELECT diag_test_name( 'dblink - Connection' );
SELECT lives_ok(
$$ SELECT dblink_connect( 'cn_logging' , 'srv_logging' ) $$
);
SELECT diag_test_name( 'dblink - Remote user = local user' );
SELECT is( username , current_user::TEXT )
FROM dblink( 'cn_logging' , 'SELECT current_user' )
AS ( username TEXT );
SELECT diag_test_name( 'dblink - Disconnection' );
SELECT lives_ok(
$$ SELECT dblink_disconnect( 'cn_logging' ) $$
);
SELECT * FROM finish( );
ROLLBACK;