And I thought I had this solved.

Поиск
Список
Период
Сортировка
От stan
Тема And I thought I had this solved.
Дата
Msg-id 20191122235216.GA7008@panix.com
обсуждение исходный текст
Ответы Re: And I thought I had this solved.
Re: And I thought I had this solved.
Список pgsql-general
A while back I ran into problems caused by  security fix related to the
search path. I wound up adding a line to. for instance, this function:

REATE FUNCTION
work_hours
(
    start_date date,
    end_date date
)
RETURNS decimal(10,4) stable
language sql as $$

    /* workaround for secuirty "feature" */
    SET search_path TO ica, "user" , public;

    SELECT
    sum(case when
    extract(isodow from d)
    between 1 and 5 then
    8.0 else
    +0.0 end)
    from

    generate_series($1,
    $2, interval
    '24 hours') d;

$$;

And walked away happy, or so I thought. Now I just got this error:

[local] stan@stan=# select * from ttl_avail_hours_by_project_and_employee ;
ERROR:  SET is not allowed in a non-volatile function
CONTEXT:  SQL function "work_hours" during startup

How can I solve this issue?


-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
                        -- Benjamin Franklin



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: automated 'discovery' of a table : potential primary key, columnsfunctional dependencies ...
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: And I thought I had this solved.