On 12/14/2016 05:56 PM, Lucas Possamai wrote:
ERROR: column "date_start" does not exist Patrick Patrick*** - trying on SQL fiddle i got that error when executing what Adrian suggested.
Yeah, it was my turn not to be paying attention. It has been that sort of day and I guess I could not expect the end of day to get better.
So something that might actually work; CREATE or REPLACE FUNCTION l_extract(date_start date, date_end date)) RETURNS void AS $$ begin execute ' COPY ( SELECT uuid, clientid, * FROM logging WHERE logtime BETWEEN $1 AND $2 ) TO ''/var/lib/postgresql/'|| date_start ||'_logs.csv''' USING date_start, date_end; end $$ language 'plpgsql'; select l_extract('20161115'::date, '20161215'::date); -- Adrian Klaver adrian.klaver@xxxxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general