Re: [SQL] simple "select / if found" isn't

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: [SQL] simple "select / if found" isn't
Дата
Msg-id 20161216111212.edknff56d52bgrjl@hermes.hilbert.loc
обсуждение исходный текст
Ответ на [SQL] simple "select / if found" isn't  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Ответы Re: [SQL] simple "select / if found" isn't  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
On Fri, Dec 16, 2016 at 11:02:37AM +0000, Gary Stainburn wrote:

> All I want to do is return 'found' based on the select but I can't get it to 
> work.  
> 
> If I run 
> 
> select 1 from user_previous_passwords 
>     where u_id=25 and 
>     crypt('MyPaSSword',u_previous_password) = u_previous_password;
> 
> then it returns the matching row(s)
> 
> If I run my function
> 
> create or replace function check_previous_passwords (ID int4, PASS varchar) 
> returns boolean as $$

It just _might_ have to do with permissions to
user_previous_passwords.

If the function somehow got installed as "security definer"
and definer does not have RLS-based (!) permissions on
user_previous_passwords then it won't find rows.

A shot in the dark...

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



В списке pgsql-sql по дате отправления:

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: [SQL] simple "select / if found" isn't
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: [SQL] simple "select / if found" isn't