From: pavan95 <pavan.postgresdba@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Copying data from a CSV file into a table dynamically
Date: Tue, 14 Aug 2018 06:10:53 -0700 (MST)
Message-ID: <1534252253597-0.post@n3.nabble.com> (raw)
Hi all,
I am well versed with the COPY command for copying the contents of a csv
file into a table. I am used to the below mentioned command:
* COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-2018-08-14_000000.csv'
WITH csv;*
But in the location "/tmp/abc/xyz/" daily a file(with header
postgresql-2018-08-14_000000.csv) will be generated.
So how can I automate this task instead of manually specifying the file
name, it has to look for the filename with current_date at the time of
copying into table. How can I achieve this?
Any suggestions or modifications are most welcome.
Regards,
Pavan
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pavan.postgresdba@gmail.com
Subject: Re: Copying data from a CSV file into a table dynamically
In-Reply-To: <1534252253597-0.post@n3.nabble.com>
References: <1534252253597-0.post@n3.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox