Re: [GENERAL] scope quirk in copy in function

2015-03-23 Thread Tom Lane
Adrian Klaver writes: > On 03/23/2015 06:59 AM, Scott Ribe wrote: >> 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 ... > "Variable substituti

Re: [GENERAL] scope quirk in copy in function

2015-03-23 Thread Adrian Klaver
On 03/23/2015 06:59 AM, Scott Ribe wrote: 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 cu

[GENERAL] scope quirk in copy in function

2015-03-23 Thread Scott Ribe
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 ins