Database reference - postgis

postgis -  functions -  public.checkauth

Description

none

Function properties

namevalue
namepublic.checkauth
return typepg_catalog.int4 
languageSQL
deterministicNO

Usage

result = public.checkauth();

Code

CREATE FUNCTION checkauth(text, text, text) RETURNS integer
    AS $_$
DECLARE

    schema text;

BEGIN
    IF NOT LongTransactionsEnabled() THEN
        RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';
    END IF;


    if ( $1 != '' ) THEN
        schema = $1;
    ELSE
        SELECT current_schema() into schema;
    END IF;


    -- TODO: check for an already existing trigger ?

    EXECUTE 'CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON ' 

        || quote_ident(schema) || '.' || quote_ident($2)



        ||' FOR EACH ROW EXECUTE PROCEDURE CheckAuthTrigger('
        || quote_literal($3) || ')';

    RETURN 0;
END;
$_$
    LANGUAGE plpgsql;




Documentation generated by SqlSpec