Re: Importing undelimited files (Flat Files or Fixed-Length records)

Поиск
Список
Период
Сортировка
От Gregory Williamson
Тема Re: Importing undelimited files (Flat Files or Fixed-Length records)
Дата
Msg-id 8B319E5A30FF4A48BE7EEAAF609DB233021F2E66@COMAIL01.digitalglobe.com
обсуждение исходный текст
Ответ на Importing undelimited files (Flat Files or Fixed-Length records)  (Bill Thoen <bthoen@gisnet.com>)
Список pgsql-general

Bill Thoen asked:

>
> I've got to load some large fixed-legnth ASCII records into PG and I was
> wondering how this is done. The Copy command looks like it works only
> with delimited files, and I would hate to have to convert these files to
> INSERT-type SQL to run them through psql.. Is there a way one can
> specify a table structure with raw field widths and then just pass it a
> flat file?

One possibility might be to create a table with one column of type text, load the data into that table with copy, and then, after creating the real table structure, populate it with the data by using substr and casts to get it into shape.

HTH,

Greg Williamson
Senior DBA
DigitalGlobe

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

(My corporate masters made me say this.)

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

Предыдущее
От: Ralph Smith
Дата:
Сообщение: Re: A plpgsql unidentifiable problem.
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Importing undelimited files (Flat Files or Fixed-Length records)