scope quirk in copy in function

Поиск
Список
Период
Сортировка
От Scott Ribe
Тема scope quirk in copy in function
Дата
Msg-id 84BAAF8D-20EF-451A-A055-17BBC78CD864@elevated-dev.com
обсуждение исходный текст
Ответы Re: scope quirk in copy in function  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
create or replace function archive_some_stuff() returns void as $$
declare cutoff timestamptz;
begin
  cutoff := now() - '1 day'::interval;
  copy (select * from log where end_when < cutoff) to ...
  ...

Gives me an error that there is column named cutoff. (Other uses of cutoff in queries not inside a copy, iow the delete
fromcommands, work.) 

Is there any alternative to just duplicating the now() expression inside every copy?

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice







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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: xml
Следующее
От: Tom Lane
Дата:
Сообщение: Re: xml