This repository has been archived on 2025-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
lwb6/legacyworlds-server-data/db-structure/tests/user/030-data/150-logs/010-sys-logs.sql
Emmanuel BENOîT 3e109b13bc 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
2012-01-07 11:14:17 +01:00

29 lines
No EOL
681 B
PL/PgSQL

/*
* 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;