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:
parent
e50775ec76
commit
3e109b13bc
9 changed files with 177 additions and 64 deletions
legacyworlds-server-data/db-structure/tests/user/030-data/150-logs
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Test privileges on sys.logs
|
||||
*/
|
||||
BEGIN;
|
||||
SELECT plan( 4 );
|
||||
|
||||
SELECT diag_test_name( 'sys.logs - INSERT privileges' );
|
||||
SELECT throws_ok(
|
||||
$$ INSERT INTO sys.logs( component , level , message )
|
||||
VALUES ( 'test' , 'WARNING'::log_level , 'test' );
|
||||
$$ , 42501 );
|
||||
|
||||
SELECT diag_test_name( 'sys.logs - UPDATE privileges' );
|
||||
SELECT throws_ok(
|
||||
$$ UPDATE sys.logs SET component = 'retest'; $$ ,
|
||||
42501 );
|
||||
|
||||
SELECT diag_test_name( 'sys.logs - SELECT privileges' );
|
||||
SELECT lives_ok(
|
||||
$$ SELECT * FROM sys.logs; $$
|
||||
);
|
||||
|
||||
SELECT diag_test_name( 'sys.logs - DELETE privileges' );
|
||||
SELECT throws_ok(
|
||||
$$ DELETE FROM sys.logs; $$ ,
|
||||
42501 );
|
||||
|
||||
SELECT * FROM finish( );
|
||||
ROLLBACK;
|
Reference in a new issue