Re: Date format for bulk copy
| От | Pierre-Frédéric Caillaud |
|---|---|
| Тема | Re: Date format for bulk copy |
| Дата | |
| Msg-id | opsftnbohocq72hf@musicbox обсуждение исходный текст |
| Ответ на | Re: Date format for bulk copy (Michael Fuhr <mike@fuhr.org>) |
| Ответы |
Re: Date format for bulk copy
|
| Список | pgsql-general |
>> Right, I *can* do this. But then I have to build knowledge into that
>> script so it can find each of these date fields (there's like 20 of them
>> across 10 different files) and then update that knowledge each time it
>> changes.
>
> In your case that's a reasonable argument against filtering the
> data with a script. Using a regular expression in the script might
> reduce or eliminate the need for some of the logic, but then you'd
> run the risk of reformatting data that shouldn't have been touched.
Yes, but :
You can have your script make a query in the database to fetch the data
types of the fields and then know which ones are to be transformed and
how. The script would take as arguments a dump file and a
database,schema.table, would read the file and pipe the transformed data
into a psql with a COPY FROM stdin command... could save you a lot of work
no ?
A bonus is that your script can complain if it detects incompatibilities,
and be more fool-proof. Plu
В списке pgsql-general по дате отправления: