Re: [GENERAL] Plpgsql - Custom fields Postgres 9.5
От | Adrian Klaver |
---|---|
Тема | Re: [GENERAL] Plpgsql - Custom fields Postgres 9.5 |
Дата | |
Msg-id | 2e970123-8c68-1cab-d74e-08609b16404b@aklaver.com обсуждение исходный текст |
Ответ на | Re: [GENERAL] Plpgsql - Custom fields Postgres 9.5 (Lucas Possamai <drum.lucas@gmail.com>) |
Список | pgsql-general |
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@aklaver.com
В списке pgsql-general по дате отправления: