view schema/updates/1104/01.remove_function.sql @ 5399:47c2ca05e8ec

Merged extented-report branch back into default.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 07 Jul 2021 11:44:40 +0200
parents 5466562cca60
children
line wrap: on
line source

DROP POLICY same_country ON import.imports;
CREATE POLICY same_country ON import.imports
    FOR ALL TO waterway_admin
    USING (EXISTS(SELECT 1 FROM users.list_users lu
            WHERE lu.username = imports.username));

ALTER TABLE users.templates ALTER COLUMN country DROP DEFAULT;

CREATE OR REPLACE FUNCTION users.current_user_area_utm()
    RETURNS geometry
    AS $$
        DECLARE utm_area geometry;
        BEGIN
            SELECT ST_Transform(area::geometry, best_utm(area))
                INTO STRICT utm_area
                FROM users.responsibility_areas
                WHERE country = (SELECT country
                    FROM users.list_users WHERE username = current_user);
    RETURN utm_area;
        END;
    $$
    LANGUAGE plpgsql
    STABLE PARALLEL SAFE;

DROP FUNCTION users.current_user_country();