Re: copy in date string "00-00-00 00:00:00"

Поиск
Список
Период
Сортировка
От Mark Phillips
Тема Re: copy in date string "00-00-00 00:00:00"
Дата
Msg-id E609D9E7-F598-467F-9F0E-742ABD59C6C3@mophilly.com
обсуждение исходный текст
Ответ на Re: copy in date string "00-00-00 00:00:00"  (Andy Colson <andy@squeakycode.net>)
Ответы Re: copy in date string "00-00-00 00:00:00"  (Martin Gregorie <martin@gregorie.org>)
Список pgsql-general
On Mar 14, 2012, at 6:32 PM, Andy Colson wrote:

> On 03/14/2012 08:16 PM, Scott Marlowe wrote:
>>
>>
>> Can you run it through sed and replace the "0000-00-00 00:00:00" to
>> NULL (no quotes) ?  That should work.
>>
>
> I think COPY (depending on arguments) uses \N by default.
>
> Another option is to pull it into a temp table and make fix it up from there.
>
> -Andy


Thanks to all who responded. I appreciate it very much.

Yes, that is a good idea. I wasn't sure how to use the NULL clause of the copy command, but I did wonder about other
nullvalues in the data set. There are many as this database grew up over 15+ years of use and many renditions of the
clientapplication. 

I am not familiar with sed, except for some trivial bits I nicked off the web. Enough to know it works, and to be
dangerous.Nonetheless, using SED may be the way to go as there are two tables that contain a bit over 3,000,000 rows
each. 

 - Mark

В списке pgsql-general по дате отправления:

Предыдущее
От: Aleksey Tsalolikhin
Дата:
Сообщение: Re: A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?
Следующее
От: John R Pierce
Дата:
Сообщение: yum repository packages 9.0 and 9.1 libpq conflict