Re: valid NULL DATE value

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: valid NULL DATE value
Дата
Msg-id 200108241248.f7OCmMoa027216@linda.lfix.co.uk
обсуждение исходный текст
Ответ на valid NULL DATE value  (Tony Grant <tony@animaproductions.com>)
Ответы Re: valid NULL DATE value  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
Tony Grant wrote:
  >Hello,
  >
  >I am importing via pgaccess a text file from another non-postgres
  >database and the NULL DATE values are written like 00/00/00.
  >
  >What I have tried is replacing 00/00/00 by 9/9/1999 and setting the
  >style to european and I am getting 'can't parse /9/1999' errors.
  >
  >How do I go about importing DATE?

With INSERT, leave the field out of the list or insert NULL.

With COPY, specify NULL as \N.  (You can redefine that - see COPY syntax.)

If you have a flat file with 00/00/00 in it, you can modify it with sed:

  sed -e 's|00/00/00|\\N|g' flatfile > newflatfile


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "I saw in the night visions, and, behold, one like the
      Son of man came with the clouds of heaven, and came to
      the Ancient of days, and they brought him near before
      him. And there was given him dominion, and glory, and
      a kingdom, that all people, nations, and languages,
      should serve him; his dominion is an everlasting
      dominion, which shall not pass away, and his kingdom
      that which shall not be destroyed."
                                    Daniel 7:13,14



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

Предыдущее
От: "Len Morgan"
Дата:
Сообщение: Re: valid NULL DATE value
Следующее
От: Denis Gasparin
Дата:
Сообщение: BIGINT datatype and Indexes Failure