src/schema/v0011.js
function(db) {
		function check_javascript_function(js, plv8, ERROR) {
			var fun;
			try {
				// We'll check only positive input
				if(js) {
					fun = (new Function('return (' + js + ')'))();
					if(! (fun && (fun instanceof Function)) ) {
						throw TypeError("Input is not valid JavaScript function: " + (typeof fun) + ": " + fun);
					}
				}
			} catch (e) {
				plv8.elog(ERROR, e);
				return false;
			}
			return true;
		}
		return db.query('CREATE OR REPLACE FUNCTION check_javascript_function(js text) RETURNS boolean LANGUAGE plv8 VOLATILE AS ' + NoPg._escapeFunction(check_javascript_function, ['js', 'plv8', 'ERROR']));
	}
function(db) {
		function check_javascript_function(js, plv8, ERROR) {
			var fun;
			try {
				// We'll check only positive input
				if(js) {
					fun = (new Function('return (' + js + ')'))();
					if(! (fun && (fun instanceof Function)) ) {
						throw TypeError("Input is not valid JavaScript function: " + (typeof fun) + ": " + fun);
					}
				}
			} catch (e) {
				plv8.elog(ERROR, e);
				return false;
			}
			return true;
		}
		return db.query('CREATE OR REPLACE FUNCTION check_javascript_function(js text) RETURNS boolean LANGUAGE plv8 VOLATILE AS ' + NoPg._escapeFunction(check_javascript_function, ['js', 'plv8', 'ERROR']));
	}
function ( db ) { function check_javascript_function ( js , plv8 , ERROR ) { var fun ; try { // We'll check only positive input if ( js ) { fun = ( new Function ( 'return (' + js + ')' ) ) ( ) ; if ( ! ( fun && ( fun instanceof Function ) ) ) { throw TypeError ( "Input is not valid JavaScript function: " + ( typeof fun ) + ": " + fun ) ; } } } catch ( e ) { plv8 . elog ( ERROR , e ) ; return false ; } return true ; } return db . query ( 'CREATE OR REPLACE FUNCTION check_javascript_function(js text) RETURNS boolean LANGUAGE plv8 VOLATILE AS ' + NoPg . _escapeFunction ( check_javascript_function , [ 'js' , 'plv8' , 'ERROR' ] ) ) ; }
Function for checking that only valid javascript goes into types.validator column
Function for checking that only valid javascript goes into types . validator column