2016-12-15 14:34 GMT+13:00 Adrian Klaver <adrian.klaver@xxxxxxxxxxx>:
On 12/14/2016 05:19 PM, Patrick B wrote:
Reading the suggestions might help:)
Another try:
CREATE or REPLACE FUNCTION l_extract(date_start text, date_end text))
RETURNS void AS $$
begin
execute '
COPY
(
SELECT
uuid,
clientid,
*
FROM
logging
WHERE
logtime
BETWEEN
date_start
AND
date_end
)
TO ''/var/lib/postgresql/'|| date_start ||'_logs.csv''';
end
$$ language 'plpgsql';
select l_extract('201611015', '201612015');
select l_extract('201611015','201612015');
ERROR: column "date_start" does not exist
Patrick