Re: COPY for CSV documentation
От | Andrew Dunstan |
---|---|
Тема | Re: COPY for CSV documentation |
Дата | |
Msg-id | 3870.24.211.141.25.1081771632.squirrel@www.dunslane.net обсуждение исходный текст |
Ответ на | Re: COPY for CSV documentation (Bruno Wolff III <bruno@wolff.to>) |
Ответы |
Re: COPY for CSV documentation
|
Список | pgsql-patches |
Bruno Wolff III said: > On Mon, Apr 12, 2004 at 02:26:14 -0400, > Andrew Dunstan <andrew@dunslane.net> wrote: >> >> a few points: >> >> . in CSV mode, NULL should default to '' - that was in what I sent in. > > Postgres normally treats an empty string as an empty string. Are you > sure you really want it to be treated as a NULL by default in this one > place? > Yes ;-) Otherwise, what will happen when we try to import into some non-text field for which '' is not a valid value? Spreadsheets commonly represent missing values as empty strings when reading/writing CSVs - that's why this behaviour should be the default. If you want to force it to use an empty string instead, simply specify some unlikely value for NULL, like 'frobnitz'. But if you do, be prepared for lots of errors unless you are importing into fields where empty string is a valid text value. Of course, a NOT NULL constraint will also break things, unless we went to the MySQL method of handling insertion of NULL into a NOT NULL field ... no I really am kidding. cheers andrew
В списке pgsql-patches по дате отправления: