Re: [GENERAL] Row level security policy - calling function for right hand side value of 'in' in using_expression
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [GENERAL] Row level security policy - calling function for right hand side value of 'in' in using_expression |
| Дата | |
| Msg-id | 24255.1486102459@sss.pgh.pa.us обсуждение |
| Ответ на | [GENERAL] Row level security policy - calling function for right hand sidevalue of 'in' in using_expression (Jong-won Choi <jongwon@ticketsquad.com>) |
| Ответы |
Re: [GENERAL] Row level security policy - calling function for righthand side value of 'in' in using_expression
|
| Список | pgsql-general |
Jong-won Choi <jongwon@ticketsquad.com> writes:
> I have a RLS policy definition like:
> CREATE POLICY promoter_policy ON Agency
> USING (promoter in build_valid_promoter_list())
> WITH CHECK (promoter in build_valid_promoter_list());
That's failing basic SQL expression syntax: the RHS of "IN" has
to be a parenthesized sub-select or array value. You'd have better
luck with (promoter in (select * from build_valid_promoter_list()))
... syntax-wise, at least. I'm not sure if we allow sub-selects
in RLS conditions.
Personally I'd write that more like
USING (check_valid_promoter(promoter))
with that function being defined in the obvious way. There's little
reason to enumerate the entire set of valid promoters if you only
need to find out whether one specific value is one.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера