Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin;
- CREATE OR REPLACE FUNCTION evergreen.redact_value_anyelement(
- input_data anyelement,
- skip_redaction BOOLEAN DEFAULT FALSE, -- pass TRUE for "I passed the test!" and avoid redaction
- redact_with anyelement DEFAULT NULL
- ) RETURNS anyelement AS $f$
- DECLARE
- result ALIAS FOR $0;
- BEGIN
- IF skip_redaction THEN
- result := input_data;
- ELSE
- result := redact_with;
- END IF;
- RETURN result;
- END;
- $f$ STABLE LANGUAGE PLPGSQL;
- select 1 as expected, evergreen.redact_value_anyelement(id,true,'3') from actor.usr where id=1;
- select 3 as expected, evergreen.redact_value_anyelement(id,false,'3') from actor.usr where id=1;
- rollback;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement