Commit Graph

245 Commits

Author SHA1 Message Date
Dimitri Fontaine
78c6bf097a Fix the build again.
Once more did I change a test file data and forgot to commit the changes
to the expected file of the regression test.
2015-09-12 00:40:15 +02:00
Dimitri Fontaine
98f18c4877 Improve CSV date format, fix #293.
The date format wouldn't allow using colon (:) in the noise parts of it,
and would also insist that milliseconds should be on 4 digits and micro
seconds on 6 digits. Allow for "ragged" input and take however many
digits we actually find in the input.
2015-09-12 00:35:14 +02:00
Dimitri Fontaine
a0dc59624c Fix schema qualified table names usage again.
When the list of columns of the PostgreSQL target table isn't given in
the load command, pgloader will happily query the system catalogs to get
that information. The list-columns query didn't get the memo about the
qualified table name format and the with-schema macro... fix #288.
2015-09-11 11:53:28 +02:00
Dimitri Fontaine
e054eb3838 Travis: set PGTZ in regress.sh
The TimeZone parameter should be set both for input and for output in
order to match our expected result file. Let's try to set PGTZ in the
shell environment...
2015-09-07 20:24:00 +02:00
Dimitri Fontaine
60d58a96b8 Travis: let's try to force client timezone.
The cvs-parse-date test is failing on Travis because the server up there
in the Cloud isn't using the same timezone as my local machine. Let's
just force the timezone in the SET clause...
2015-09-07 20:00:05 +02:00
Dimitri Fontaine
3f539b7384 Travis: update expected output file.
Forgot to update the expected output file in the previous commit, which
Travis is rightfully complaining about...
2015-09-07 17:47:03 +02:00
Dimitri Fontaine
04b2779239 Allow date format parsing to support time.
A useful use case for date parsing at tine input level is to parse
time (hour, minutes, seconds) rather than a full date (timestamp).
Improve the code so that it's possible to use the date format facility
even when the data field lacks the year/month/day information.

Fix #288.
2015-09-07 17:05:10 +02:00
Dimitri Fontaine
eabfbb9cc8 Fix schema qualified table names usage (more).
When parsing table names in the target URI, we are careful of splitting
the table and schema name and store them into a cons in that case. Not
all sources methods got the memo, clean that up.

See #182 and #186, a pull request I am now going to be able to accept.
Also see #287 that should be helped by being able to apply #186.
2015-09-04 01:06:15 +02:00
Dimitri Fontaine
b78bb6dd31 Allow quoted field names to contain spaces, fix #285.
Given a fully quoted field name, there should be no restriction about
using spaces in between the quotes, but the parser used to choke on that
case.
2015-09-01 14:32:50 +02:00
Dimitri Fontaine
75727df72f Quote table names when migrating from SQLite, fix #281.
Apparently I just forgot to apply any smartness whatsoever to SQLite
identifiers and just copied them as they are to PostgreSQL. Change that
by calling apply-identifier-case.
2015-08-25 01:13:19 +02:00
Dimitri Fontaine
573a63cd3a Add a local test, per #271. 2015-08-24 16:42:39 +02:00
Dimitri Fontaine
04ddf940d9 Left pad COPY octal chars with 0, fix #275.
The COPY TEXT format accepts non printable characters with an escaped
sequence wherin pgloader can pass in the octal number for the character
in its encoding. When doing that with small numbers like \6 and the
non-printable character is then followed by other numbers, then it
becomes e.g. \646 which might not be part of the target encoding...

To fix, always left pad the character octal number with zeroes, so that
we now send in \00646 which COPY knows how to read: the char at \006
then 4 then 6.

Also copy the test case over to pgloader and run it in the test suite.
2015-08-20 18:17:18 +02:00
Dimitri Fontaine
833b41c23b Fix the regression test expected values, see #266. 2015-07-26 14:45:43 +02:00
Dimitri Fontaine
b4b36caa84 Fix parsing dates with less-than 4 digits, fix #266.
The previous coding decided to add 2000 to the year as an integer if it
was below 2000, which parses 1999 as 3999. Oops. Trigger the correction
only when the date is given on 2 digits only, parsing 04 as 2004.

Dates given on 3 digits are kept as-is.

Playing with the *century* special parameter allows to cancel this
behavior, that maybe should be made entirely optional. It's just too
common to find current years on 2 digits only, sadly.
2015-07-26 14:41:44 +02:00
Dimitri Fontaine
d2a1a5643e Improve SQL blocks support, fix #265.
It's now possible to use several files in a BEFORE LOAD EXECUTE section,
and to mix DO and EXECUTE parts, bringing lots of flexibility in the
commands. Also it actually simplifies the parser.
2015-07-24 17:41:35 +02:00
Dimitri Fontaine
54e29773d7 Fix index creation reporting, see #251.
The new option 'drop indexes' reuses the existing code to build all the
indexes in parallel but failed to properly account for that fact in the
summary report with timings.

While fixing this, also fix the SQL used to re-establish the indexes and
associated constraints to allow for parallel execution, the ALTER TABLE
statements would block in ACCESS EXCLUSIVE MODE otherwise and make our
efforts vain.
2015-07-18 23:06:15 +02:00
Dimitri Fontaine
a98788b670 Implement drop indexes option for copy and fixed.
The option doesn't seem relevant to the db3 source type which contains a
table definition: pgloader will create the table from scratch and no
indexes are going to be found.
2015-07-16 21:39:06 +02:00
Dimitri Fontaine
49bf7e56f2 Implement a "drop indexes" option in CSV mode, fix #251.
When loading against a table that already has index definitions, the
load can be quite slow. Previous commit introduced a warning in such a
case. This commit introduces the option "drop indexes" that is not used
by default.

When this option is used, pgloader drops the indexes before loading the
data then create the indexes again with the same definitions as before.
All the indexes are created again in parallel to optimize performances.
Only primary key indexes can't be created in parallel, so those are
created in two steps (create unique index then alter table).
2015-07-16 12:22:58 +02:00
Dimitri Fontaine
1c7de22096 Add test coverage for #80. 2015-06-25 14:16:12 +02:00
Dimitri Fontaine
7e508374c4 Add some SQLite test cases for real type, see #249. 2015-06-16 23:13:52 +02:00
Dimitri Fontaine
c3b5d60542 Fix type declaration to include null values, fix #238.
In passing, add a test case for NIL datetime values in our SQLite sample
database.
2015-05-22 23:49:03 +02:00
Dimitri Fontaine
ba7b27b60a Travis: actually push the right version of the expected file. 2015-05-22 12:41:29 +02:00
Dimitri Fontaine
bffec4cc63 Allow for more options in the CSV escape character, fix #38.
To allow for importing JSON one-liners as-is in the database it can be
interesting to leverage the CSV parser in a compatible setup. That setup
requires being able to use any separator character as the escape
character.
2015-05-22 12:31:06 +02:00
Dimitri Fontaine
dc86b5e600 Travis: Fix the text case connection string. 2015-05-21 16:29:14 +02:00
Dimitri Fontaine
abbc105c41 Implement CSV headers support.
Some CSV files are given with an header line containing the list of
their column names, use that when given the option "csv header".

Note that when both "skip header" and "csv header" options are used,
pgloader first skip as many required lines and then uses the next one as
the csv header.

Because of temporary failure to install the `ronn` documentation tool,
this patch only commits the changes to the source docs and omits to
update the man page (pgloader.1). A following patch is intended to be
pushed that fixed that.

See #236 which is using shell tricks to retrieve the field list from the
CSV file itself and motivated this patch to finally get written.
2015-05-21 12:55:23 +02:00
Mark Lee
dc04b40836 Accept periods in CSV field names
Periods are allowed in PG column names as well.
2015-05-15 07:22:07 -07:00
Dimitri Fontaine
95a5eb3184 Implement more COPY options, fix #218.
The COPY format now supports user defined delimiter and null options,
and we don't require the column names anymore as it's useless in that
context.
2015-04-30 14:30:16 +02:00
Dimitri Fontaine
53dcdfd8ef Fix handling of COPY data, fix #222.
When given a file in the COPY format, we should expect that its content
is already properly escaped as expected by PostgreSQL. Rather than
unescape the data then escape it again, add a new more of operation to
format-vector-row in which it won't even try to reformat the data.

In passing, fix an off-by-one bug in dealing with non-ascii characters.
2015-04-30 13:17:02 +02:00
Dimitri Fontaine
11976d2c23 Fix census-places URL location of the source file. 2015-04-17 21:58:19 +02:00
Dimitri Fontaine
7d2d09ce68 Add the option to preserve MySQL index names, fix #187.
See test/parse/hans.goeuro.load for an example usage of the new option.

In passing, any error when creating indexes is now properly reported and
logged, which was missing previously. Oops.
2015-03-07 20:19:47 +01:00
Dimitri Fontaine
48f451bdbc Implement the option to disable triggers when loading data.
This option is dangerous and allows to skip ALL triggers when loading
data against PostgreSQL. This includes foreign key constraints
definitions and will allow loading data out of order.

When using both the options "create no table" and "disable triggers" it
will be possible to load data into a schema prepared by your favorite
external tool, at the cost of not validating FK constraints. Use with
care.

Fix #167.
2015-02-19 15:05:10 +01:00
Dimitri Fontaine
ce5a61face Catch PostgreSQL internal errors too, fixes #155. 2015-01-21 13:01:28 +01:00
Dimitri Fontaine
a3b68bb80a Random test load file cleanup. 2015-01-15 17:49:19 +01:00
Dimitri Fontaine
e1bc6425e2 Implement support for PostgreSQL COPY format, fix #145.
PostgreSQL COPY format is not really CSV but something way easier to
parse. Funnily enough, parsing it as CSV is not that easy, so we add
here a special simple parser for the COPY format.

It should be quite useful too try loading again reject data files from
pgloader after manual fixing, too. It's still missing some documentation
without any good excuse for that, will add soon.
2015-01-02 18:49:17 +01:00
Dimitri Fontaine
1996256f8f Add support for postgres:// URI prefixes, fix #135. 2014-12-15 20:32:49 +01:00
Dimitri Fontaine
87e157bee2 Add a new database source type in the parser.
Now it's possible to parse a command to load data from MS SQL. The
parser was until now parsing all database URI within the same common
rule and that isn't possible anymore if we want to distinguish in
between source database right from the parser, which we actually want to
do.

This patch also implement in-passing fixes all over the place, including
the transformation function float-to-string that only happened to work
on double-float data.
2014-11-17 00:23:06 +01:00
Dimitri Fontaine
68416a79b3 In passing docs review.
Also modernize the test/census-place.load to use the newer fixed file
format options, and show that in the docs.
2014-10-18 22:42:31 +02:00
Dimitri Fontaine
22f4317a30 Add support for the CAST rule to SQLite sources.
This allows users to benefit from the same flexible machinery when using
SQLite as when using MySQL, and also allows to add some more default
cast rules too.
2014-10-13 00:52:55 +02:00
Dimitri Fontaine
00b002124b Travis: switch test case to timestamp, dropping the TZ.
The timezone is different in between my own machine and the test system,
just get rid of that discrepancy so that the test stop failing.
2014-10-02 01:32:19 +02:00
Dimitri Fontaine
08fc7fd092 Square brackets around source field options are now mandatory. 2014-10-02 01:17:24 +02:00
Dimitri Fontaine
2f49c9614c Fix the new test case's out file. 2014-10-02 01:16:58 +02:00
Dimitri Fontaine
7cf7e714fc Implement the source date format option. 2014-10-02 01:03:24 +02:00
Dimitri Fontaine
ac55d71401 Rework CSV and Fixed files source fields options, see #116.
It's not possible to use a comma separator when using more than one
source field option at the same time, and for better readability the
options are to be found enclosed in squared brackets.

Also, it's now possible to spell out "from" and "for" keywords on the
source definitions, making it easier to read and maintain the load file,
as in this full example:

          (
           a from  0 for 10,
           b from 10 for  8,
           c from 18 for  8,
           d from 26 for 17 [null if blanks, trim right whitespace]
          )
2014-10-01 18:32:40 +02:00
Dimitri Fontaine
ea97fc4659 Implement a new source level filter: trim.
As seen in #116, it might be better for the users to be able to ask for
field trimming right in the source definition, like we do for processing
nulls.
2014-09-29 15:16:04 +02:00
Dimitri Fontaine
8a0c91fa40 Fix conjunctions for the INCLUDING clause in MySQL.
We want all table matching any of the given constraints (regexp or
equality search).
2014-09-23 16:44:38 +02:00
Dimitri Fontaine
52e3371be8 Review default SQLite options. 2014-09-22 14:34:57 +02:00
Dimitri Fontaine
d4b58a1f78 Review MySQL default options.
The default values for MySQL WITH clause options wasn't really tested
and broke on simple cases, the new set of defaults is known to work in
many cases (most?).

Other combinations of options will need some review work, and we might
need to consider preventing some of them, that's for another patch tho.
2014-09-21 12:19:20 -05:00
Dimitri Fontaine
ca52ddacb1 SQLite: transform "0" timestamps to NULL, see #100. 2014-07-30 18:42:49 +02:00
Dimitri Fontaine
ed8022ce64 SQLite: transform default values to their PostgreSQL representation.
When default values are used in SQLite they are of course using their
SQLite representation, which might not be compatible with the PostgreSQL
target data type we're casting to. Make it so that the default values
are transformed too, as we already do in the MySQL case.

See #100.
2014-07-30 16:32:35 +02:00
Dimitri Fontaine
4aa8b0946f Get rid of unused sample file. 2014-07-18 11:07:25 +02:00
Dimitri Fontaine
cb4b2a3334 Convert SQLite tinyint to PostgreSQL smallint, fixes #97. 2014-07-18 11:06:37 +02:00
Dimitri Fontaine
9eff1bb4d8 Travis: Adapt test/ixf.load to work against 9.1. 2014-07-17 17:35:41 +02:00
Dimitri Fontaine
5a2b98856f Update the main SQLite test database. 2014-07-17 16:56:28 +02:00
Dimitri Fontaine
07b5aa3ed6 Add BEFORE/AFTER LOAD clauses to IXF and DBF commands. 2014-07-17 16:56:13 +02:00
Dimitri Fontaine
3e0526c957 Implement early support for IXF files. 2014-07-14 21:53:50 +02:00
Dimitri Fontaine
53a7e47058 New MySQL default Cast Rule for bit(1) to boolean, fix #93.
We need a new transformation function that work with a vector of
integers as input.
2014-07-03 11:47:59 +02:00
Dimitri Fontaine
6d49d9e10a Add a "real" column test case in SQLite main test, Closes #73. 2014-06-29 16:33:42 +02:00
Dimitri Fontaine
55655ed927 Fix fixed-file column name quoting, as we did for CSV, fixes #70. 2014-06-29 16:25:30 +02:00
Dimitri Fontaine
2ac374bcc8 Improve internal testing a bit.
This should get into a full reproducible regression test against MySQL
some day.
2014-06-25 12:43:57 +02:00
Dimitri Fontaine
f7d251ed86 Fix quoting of TRUNCATE command, fix #84.
That patch is not a principaled approach at fixing the problem but
should allow for not messing up with fully qualified table names.

A proper way to do it would be to have a pgsql object name structure
composed of the catalog, the schema and the name as separate entries,
with assorted API to print that object properly. That's for another day
though.
2014-06-20 13:10:39 +02:00
Dimitri Fontaine
63e6b506be Travis; tweak some tests for PostgreSQL 9.1 compat. 2014-06-17 01:00:33 +02:00
Dimitri Fontaine
c14d620d83 Travis: let's see some debug information. 2014-06-16 21:15:22 +02:00
Dimitri Fontaine
32b4cf23e8 New test case showing off the 'null if' source field option, see #80. 2014-06-16 19:59:08 +02:00
Dimitri Fontaine
f5c703c206 Handle camelCase column names for CSV, fix #79 again.
The previous patch didn't take into account the need to retain the case
of the PostgreSQL column names when using double-quotes in the load
command, which is now properly forwarded down in the COPY command.
2014-06-16 17:33:14 +02:00
Dimitri Fontaine
fe4f577300 Add the csv-filename-pattern test to the suite. 2014-06-16 14:17:53 +02:00
Dimitri Fontaine
65aabb8216 Add a dbf test to the regression suite. 2014-06-16 14:17:33 +02:00
Dimitri Fontaine
7db001a7c3 Allow the MySQL command parser to process clauses in any order, fix #56.
Only the MySQL command is addressed in this patch, because the code
level approach is not safisfying me completely. It might be easier to
just bite the bullet and review all the optional clauses return values
rather than add a layer as this patch does.

The feature still is available for MySQL given this patch, so let's push
it, get feedback, then see about how to make the approach scale and
revise all the other commands.
2014-06-15 14:19:38 +02:00
Dimitri Fontaine
1273c42393 Parse SQLite "unsigned" and "short" noise words, fix #72.
In SQLite it's possible to define columns using type names such as
"smallint unsigned" or "short integer", without any changes to the way
those data types are handled, given its "dynamic typing" features.

Improve the pgloader casting machinery for SQLite to handle those cases.
2014-06-04 11:11:50 +02:00
Dimitri Fontaine
f6fae39b2e Explicitely use gawk in the new regression testing facility.
Turns out that debian has mawk by default, which is not behaving the
same in our very simple use case already. In passing, add gawk as a
build dependency of the debian package, because the packaging is meant
to exercize the test cases.
2014-06-03 13:39:21 +02:00
Dimitri Fontaine
3bcd236de6 Add automated regression tests.
Those tests currently only work when a single table is the target of the
load, and when this target is explicit in the INTO target clause. More
work needs to be done to cover interesting cases like MySQL and SQLite
where we want to diff a full database rather than a single table.
2014-06-03 12:19:23 +02:00
Dimitri Fontaine
ae2f7e9ed0 Add an hstore test
This test is currently commented out of the test suite so that we don't
require the hstore being available to run the basic tests.
2014-06-03 10:33:43 +02:00
Dimitri Fontaine
a2370938b6 MATERIALIZE ALL VIEWS.
Complete the MySQL migration feature.
2014-05-26 18:03:50 +02:00
Dimitri Fontaine
e9e9e364b0 Add optional clauses USING FIELDS and TARGET COLUMNS. 2014-05-26 15:04:06 +02:00
Dimitri Fontaine
b17383fa90 Allow IN DIRECTORY sub-clause for the FILENAME MATCHING clause.
With this the user is now able to have a way about where the files are
going to be read and matched against the regular expression. It used not
to be necessary in the archive expansion mode, but is required now that
the feature is exposed in more cases.
2014-05-26 14:45:12 +02:00
Dimitri Fontaine
36805afc64 Fix *csv-path-root* at run-time.
When using LOAD CSV it's possible to load from filename matching a
regular expression, but for that to work the *csv-path-root* needs to be
properly setup at run-time.
2014-05-26 11:01:19 +02:00
Dimitri Fontaine
9e12035ca1 Review SQLite blob types in light of "manifest typing", fix #60.
When using SQLite 3, a blob column might return either string of byte
vector values dynamically depending on the data itself, or maybe some
more complex parameters controlled at data insert time.

Hard-code the rule that a blob column returned as a string is in fact
base64 encoded (which looks like common practice) and decode it
automatically when needed, before sending to byte-vector-to-bytea. It
might be a tad slow but at least the data is properly converted.

In future, that decision might come and byte us in the back again, at
which point it'll be necessary to consider full casting options as in
the MySQL CAST rules. It seems like a big enough win for now if we can
avoid that.
2014-05-16 23:13:57 +02:00
Dimitri Fontaine
39af63b053 Implement support for SQLite blob to bytea, fixes #59.
This issue has been re-opened with blob instead of double. Semi-blindly
implement support for the blob type with an image data type.

Disturbingly enough when tested with non-binary data SQLite was
returning strings rather than byte vectors, tripping up the transform
function that sure expects byte vectors.
2014-05-16 00:28:02 +02:00
Dimitri Fontaine
d6c457d89a Add support for SQLite "double" data type, Fix #59.
This time with a test case rather than trying to blindly address the
problem in a very small amount of time.
2014-05-15 23:28:21 +02:00
Dimitri Fontaine
c38798a4dd Implement BEFORE/AFTER LOAD EXECUTE 'filename'.
That allows using the same SQL files as usual when using pgloader, as it
even supports the \i and \ir psql features (and dollar quoting, etc).

In passing, refactor docs to avoid saying the same things all over the
place, which isn't a very good idea in a man page, at least as far
editing it is involved.
2014-05-04 23:04:45 +02:00
Dimitri Fontaine
ee498111bc Implement MySQL local (socket) connection. Fix #39.
The parser was happily parsing such a connection string as the
following, but the rest of the code didn't really know what to do about
it:

  mysql://unix:/var/run/mysqld/mysqld.sock:/main

In passing, fix bugs where the PostgreSQL unix domain socket connection
was still shy of a brick load, omitting to consider the case where the
connection host is actually a list of '(:unix . "path/to/socket").
2014-05-02 22:48:17 +02:00
Dimitri Fontaine
9084a01086 Switch a test case to the "utf-8" spelling.
The spelling "utf8" is not recognized by CCL.
2014-04-29 15:24:12 +02:00
Dimitri Fontaine
1d5d0ae72f Update the bossa.load test case.
The archive contents seem to have changed, and the regular expression to
match files that we were using doesn't match any filename in the archive
any more.

Also, have the command load more data by parsing more files, using the
ALL FILENAME MATCHING clause.
2014-04-29 14:51:14 +02:00
Dimitri Fontaine
429232c3de Fix loading data from stdin: fix #53.
The stdin support really was one brick shy of a load, and in particular
with-open-file was used against a stream when using that option.
2014-04-27 23:38:02 +02:00
Dimitri Fontaine
efd11ab759 Add user options to control pgloader batch behaviour.
The new WITH options allows the user to set values for the dynamic
variables *copy-batch-rows*, *copy-batch-size* and *concurrent-batches*.
That's needed in case like in issue #16 even with the batch size
defaulting to what looks like a proper setup.

In a longer term a review of the pgloader memory usage should be done
seriously, the numbers being way higher than the batch sizes we do setup
here.
2014-04-27 22:37:17 +02:00
Dimitri Fontaine
789d854799 Fix issue #49 where data could be considered as a format string. 2014-04-23 17:03:35 +02:00
Dimitri Fontaine
56f3da28ed Fix #20 by skipping table and view missing from the catalogs. 2014-03-04 14:01:04 +01:00
Dimitri Fontaine
46fd6632f2 Fix #40 by providing a per-table forced-encoding option.
This patch takes benefits from the recent patch
62fc85a1cf
so that you will need to freshen your local Qmynd copy if you want to
test from sources.
2014-03-03 23:39:22 +01:00
Dimitri Fontaine
b033aed88b Some more testing. 2014-03-02 01:27:02 +01:00
Dimitri Fontaine
7befe27807 Add encoding errors to the csv-error.load test. 2014-03-02 01:27:02 +01:00
Alexander Pánek
97109153f4 Removed tinyint cast rule
This rule has overridden the default rule for `tinyint(1)` and instead of placing `boolean`, it kept the typemod and placed `boolean(1)` into the resulting query.
2014-02-17 16:14:27 +01:00
Dimitri Fontaine
643875a266 Improve CSV error handling, thanks to cl-csv continue restart. 2014-02-08 17:51:15 +01:00
Dimitri Fontaine
dbfd8cf06c Implement new CSV option "lines terminated by", fixes #23. 2014-02-04 20:58:46 +01:00
Dimitri Fontaine
a8b0f91f37 Allow optional control of batch memory footprint, see #16 and #22.
With the new internal setting *copy-batch-size* it's now possible to
instruct pgloader to close batches early (before *copy-batch-rows* limit)
when crossing the byte count threshold.

When set to 20 MB it allows the new test case (exhausted) to pass under SBCL
and CCL, and there's no measurable cost when *copy-batch-size* is set to
nil (its default value) in the testing done.

This patch is published without any way to tune the values from the command
language yet, that's the next step once its been proven effective.
2014-01-26 23:22:18 +01:00
Dimitri Fontaine
8ac2cc4930 Skip empty lines when reading from files. 2014-01-24 15:11:15 +01:00
Dimitri Fontaine
3f61c66a79 Also handle extra columns in CSV parsing. 2014-01-23 15:15:42 +01:00
Dimitri Fontaine
516ef08c37 Allow loading ragged CSV files. 2014-01-23 15:07:05 +01:00
Dimitri Fontaine
7c238f45f2 Fix batch retry handling, broken in previous refactoring. Fixes #22. 2014-01-22 22:52:18 +01:00
Dimitri Fontaine
a5c661dd4a Cleanup error recovery logging. 2014-01-22 17:57:56 +01:00
Dimitri Fontaine
c13d7bbae7 Bug fix when processing plain filenames. 2014-01-22 11:00:12 +01:00
Dimitri Fontaine
c56bbab0c4 Fix #24 by allowing cast rules adding only transformation functions. 2014-01-20 16:00:09 +01:00
Dimitri Fontaine
80b6c46aae Version 3.0.97. 2014-01-15 22:53:43 +01:00
Dimitri Fontaine
07c614c170 Switch to the newer cl-csv API.
Thanks to the work at https://github.com/AccelerationNet/cl-csv/pull/12 we
can now use the main branch of cl-csv again.
2014-01-11 18:28:24 +01:00
Dimitri Fontaine
ef358c0b7d Take benefits of PostgreSQL COPY error CONTEXT.
This message has the line number where the erroneous data was found on the
server, and given the pre-processing we already done at that point, it's
easy to convert that number into an index into the current batch, an array.

To do do, we need Postmodern to expose the CONTEXT error message and we need
to parse it. The following pull request cares about the Postmodern side of
things:

  https://github.com/marijnh/Postmodern/pull/46

The parsing is done as simply as possible, only assuming that the error
message is using comma separators and having the line number in second
position. The parsing as done here should still work with localized message
strings.

  CONTEXT: COPY errors, line 3, column b: "2006-13-11"

This change should significantly reduce the cost of error processing.
2013-12-25 21:43:22 +01:00
Dimitri Fontaine
43fc540660 Pick a CL encoding name found both in SBCL and CCL for the census test. 2013-12-24 19:37:15 +01:00
Dimitri Fontaine
b84541367d Add MySQL (MariaDB) support in tests. 2013-12-03 22:06:10 +01:00
Dimitri Fontaine
3ddcc959ac Improve tests and add test cases. 2013-11-26 16:48:45 +01:00
Dimitri Fontaine
ea4e74e545 Improve parsing of list separating commas wrt to whitespacing. 2013-11-23 21:49:08 +01:00
Dimitri Fontaine
4bc4cc53a7 Add support for connecting to PostgreSQL with Unix Domain Sockets, fixing #15. 2013-11-22 17:19:48 +01:00
Dimitri Fontaine
6a6684bd8b Desultory improve the SQLite importer. 2013-11-21 21:34:02 +01:00
Dimitri Fontaine
941747e36a Cleanup in the census places test. 2013-11-21 10:54:57 +01:00
Dimitri Fontaine
ee857e7523 While at it, provide a proper right-trim transforms function. 2013-11-18 11:55:26 +01:00
Dimitri Fontaine
8d8e0b041a Allow filename matching expressions in the FIXED command, and support it in archives. 2013-11-18 11:38:50 +01:00
Dimitri Fontaine
fb54d19357 Review some default casting rules, in particular add tinyint(1) to boolean. 2013-11-18 10:28:38 +01:00
Dimitri Fontaine
b31ccded6f Implement per-column MySQL CAST rules. 2013-11-18 10:12:43 +01:00
Dimitri Fontaine
8fa7a86013 Implement typemod and default guards in the MySQL CAST clause. 2013-11-17 22:33:06 +01:00
Dimitri Fontaine
718ac80560 Implement a Materiaze Views option for MySQL. 2013-11-16 21:41:07 +01:00
Dimitri Fontaine
d99b859c3f Improve and fix COPY error handling, transactions, connections, and GUCs. 2013-11-13 23:54:41 +01:00
Dimitri Fontaine
00d3886ba6 Fix the goeuro local only test case. 2013-11-13 22:35:45 +01:00
Dimitri Fontaine
9d5dad7e3e Implement support for FIXED COLS input files, reaching release candidate status. 2013-11-07 15:39:28 +01:00
Dimitri Fontaine
fe75f3df54 Improve the set of options for loading from databases, assorted fixes. 2013-11-05 23:07:03 +01:00
Dimitri Fontaine
450c06b6fb Add a "with foreign keys" option to the MySQL Command. 2013-11-05 19:16:12 +01:00
Dimitri Fontaine
6593995832 Add support for BEFORE LOAD DO and FINALLY DO blocks in the MySQL command. 2013-11-05 17:07:13 +01:00
Dimitri Fontaine
2477b68e15 Implement filtering against the list of tables to migrate, in MySQL. 2013-11-05 14:48:05 +01:00
Dimitri Fontaine
ff9d0fd6f5 Fix function exporting bug, and index counts that caused infinite waiting. 2013-11-04 23:13:46 +01:00
Dimitri Fontaine
24f47640e2 Add grammar support for loading a SQLite database. 2013-11-04 21:54:51 +01:00
Dimitri Fontaine
561eb29175 Add a test case for the sakila database. 2013-11-04 21:24:23 +01:00
Dimitri Fontaine
63005168fd MySQL SET datatype support: convert to ENUM Arrays. 2013-11-01 11:34:43 +00:00
Dimitri Fontaine
2f6c7677fc Fix "reset sequences" option to only target just loaded tables. 2013-10-21 23:15:24 +02:00
Dimitri Fontaine
9fd0bbabe2 Yet another round of fixes for the test setup.
Including some Makefile hacks where test doesn't depend on the main pgloader
binary anymore because I coulnd't stop the binary to get being built again
even if it's been done already...
2013-10-20 23:27:11 +02:00
Dimitri Fontaine
208d10c919 Review and clean the vagrant setup, add tests. 2013-10-20 22:51:06 +02:00
Dimitri Fontaine
f619054c79 Improve database connection parsing to use sensible defaults. 2013-10-19 22:39:09 +02:00
Dimitri Fontaine
f768f74cbb Add support for comments (-- and /* */ style) in the command language. 2013-10-18 11:19:24 +02:00
Dimitri Fontaine
e1d2bd1318 Improve LOAD DBF command (support for http and zip). 2013-10-13 22:48:24 +02:00
Dimitri Fontaine
89aaabd179 Port tests from pgloader 2.x, implement trailing-sep. 2013-10-13 22:10:07 +02:00
Dimitri Fontaine
7d1b34477e Implement CSV option keep|trim unquoted blanks. 2013-10-12 14:49:52 +02:00
Dimitri Fontaine
4ff7d9ae69 Improve documentation and empty strings test cases, now that cl-csv is fixed. 2013-10-12 14:36:35 +02:00
Dimitri Fontaine
1407d379f1 Add support for the SET (gucs) option in the CSV commands. 2013-10-11 13:50:23 +02:00
Dimitri Fontaine
b762905953 Use our HTTP available very small test case for the archive tests. 2013-10-11 12:07:55 +02:00
Dimitri Fontaine
1cf15b0f6f Add a NULL test case and fix some areas of the code to make it pass. 2013-10-11 11:20:35 +02:00
Dimitri Fontaine
3221ce6cc3 Add support for loading INLINE data in CSV commands. 2013-10-11 01:00:52 +02:00
Dimitri Fontaine
f22eeec123 Allow LOAD CSV command to accept BEFORE LOAD DO and AFTER LOAD DO sections. 2013-10-10 23:37:49 +02:00
Dimitri Fontaine
65035b1bc6 Allow for loading CSV files not using any field quoting. 2013-10-08 22:16:52 +02:00
Dimitri Fontaine
bab53d1cd0 Improve testing, load commands from files. 2013-10-08 21:48:43 +02:00
Dimitri Fontaine
165f74b197 Add some test files. 2013-10-04 17:12:50 +02:00
Dimitri Fontaine
0af0ac315c Remove useless block of example code. 2013-08-21 17:26:36 +02:00