Mercurial > gemma
diff pkg/imports/gm.go @ 4158:5466562cca60
Remove utility function with possibly bad performance impact
Since the PostgreSQL planner will call functions used in a filter
condition once per row, even if the function is marked STABLE,
under some circumstances (e.g. the removed usage in an RLS policy),
remove the function from the database completely.
The DEFAULT on users.templates that used the function is unused,
thus remove it as a whole, too.
Recreate the function as a helper for tests in order to minimize
necessary changes there.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 02 Aug 2019 16:10:42 +0200 |
parents | c489c78ed525 |
children | 5d7ce7f926eb |
line wrap: on
line diff
--- a/pkg/imports/gm.go Fri Aug 02 13:37:40 2019 +0200 +++ b/pkg/imports/gm.go Fri Aug 02 16:10:42 2019 +0200 @@ -52,7 +52,8 @@ (location).orc, (location).hectometre FROM waterway.gauges -WHERE (location).country_code = users.current_user_country() +WHERE (location).country_code = ( + SELECT country FROM users.list_users WHERE username = current_user) OR pg_has_role('sys_admin', 'MEMBER') `