Re: Using current_user as an argument of pl/pgsql function affects collation of other arguments
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Using current_user as an argument of pl/pgsql function affects collation of other arguments |
| Дата | |
| Msg-id | 613285.1723753952@sss.pgh.pa.us обсуждение |
| Ответ на | Using current_user as an argument of pl/pgsql function affects collation of other arguments (Dmytro Astapov <dastapov@gmail.com>) |
| Список | pgsql-bugs |
Dmytro Astapov <dastapov@gmail.com> writes:
> As the subject implies, I am observing that
> current_user/session_user/current_database/current_schema, when used as an
> argument for pl/pgsql function, could affect execution plans of unrelated
> queries inside that pl/pgsql function -- because they seemingly affect
> collation for other arguments (I am not 100% sure about this last claim,
> but the observed effects suggest that this might be the case).
This is expected behavior. Those functions return type "name" not
"text", and "name" is considered to have C collation. Then, in
a call such as
select_test('1',current_user);
that is the only source of collation in the expression and so
select_test is invoked with an input collation of "C", rather
than whatever the database's default is.
The most robust solution probably is to write
explain select *
from tbl
where id = id_to_update COLLATE "default"
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера