mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-06 22:37:02 +02:00
Fixed file formats might contain an header line with column names and a hint of the size of each column. While it might be a long shot that we can acutally use that as a proper fixed-format specification, this patch implements a guess mode that also outputs the parsed header. In case when the parsing is wrong in some level of details, it might actually be a good start to copy/paste from the command output and go from there. Fixes #958.
37 lines
929 B
Fish
37 lines
929 B
Fish
LOAD FIXED
|
|
FROM fixed-guess.dat
|
|
INTO postgresql:///pgloader
|
|
TARGET TABLE fixed.guess
|
|
|
|
WITH fixed header
|
|
|
|
SET work_mem to '14MB',
|
|
standard_conforming_strings to 'on'
|
|
|
|
before load do
|
|
$$ create schema if not exists fixed; $$,
|
|
$$ drop table if exists fixed.guess; $$,
|
|
$$
|
|
create table fixed.guess
|
|
(
|
|
QECDPO character varying(3),
|
|
QECSEM character varying(3),
|
|
QELSEM character varying(30),
|
|
QERSEM character varying(15),
|
|
QENCOM integer,
|
|
QESCRE smallint,
|
|
QEACRE smallint,
|
|
QEMCRE smallint,
|
|
QEJCRE smallint,
|
|
QEHCRE integer,
|
|
QECUCR character varying(10),
|
|
QESMAJ smallint,
|
|
QEAMAJ smallint,
|
|
QEMMAJ smallint,
|
|
QEJMAJ smallint,
|
|
QEHMAJ integer,
|
|
QECUMJ character varying(10),
|
|
QETOPD character varying(1)
|
|
);
|
|
$$ ;
|