Commit Graph

1528 Commits

Author SHA1 Message Date
Dimitri Fontaine
781e586816 Fix the SBCL 1.5.2 checksum.
Now that we know that the checksum facility actually works and fails when
given the wrong checksum, install the right checksum. Ahem.
2019-05-09 00:46:11 +02:00
Dimitri Fontaine
ede385bce7 Upgrade travis testing to SBCL 1.5.2.
That's needed for current ironclad.
2019-05-09 00:36:58 +02:00
Dimitri Fontaine
0643cf0869 Remove the old mention about building the docs in the README.
It's been a while we switched to the Read The Docs format, the ruby-ronn
manpage is a thing of the past now.
2019-05-09 00:28:01 +02:00
Dimitri Fontaine
3118602702 Attempt to add a Read The Docs badge on the GitHub README for pgloader. 2019-05-09 00:26:05 +02:00
Dimitri Fontaine
1be0f02057 Attempt to get Travis back on its feet again.
The current problem with Travis build is that it's using the Quicklisp
version of the cl-db3 librairy rather than the current master's branch
version, which current sources of pgloader depend on.

In the Dockerfiles we use the alternate build method for preparing the lisp
image, and invoke the `make clones` target explicitely in order to make sure
that we have the right set of dependencies at build time.

In this patch we apply the same approach to Travis, hoping to solve the
current build issues there.
2019-05-09 00:18:11 +02:00
Dimitri Fontaine
291af994ba Let's see how those badges look when on the same line. 2019-05-09 00:14:43 +02:00
Dimitri Fontaine
f17562f62c Attempt to add DockerHub Build Status to the README at GitHub. 2019-05-09 00:13:30 +02:00
Dimitri Fontaine
2b6fb3e6c2 Add a casting rule for the I data type in DBF files.
The I data type is mapped to a PostgreSQL integer.

See #929.
2019-05-08 23:36:17 +02:00
Dimitri Fontaine
7d2e5ae941 Allow lambda expression as cast rules using functions.
Before that it was necessary to install a function in the lisp environment
either in the source itself in src/utils/transforms.lisp, or in a lisp file
loaded with --load-lisp-file (or -l for shorts).

While this could be good enough, sometimes a very simple combination of
existing features is required to transform a function and so doing some
level of lisp coding directly in the load command is a nice to have.

Fixes #961.
2019-05-08 19:02:18 +02:00
Mathieu Santostefano
6aa42ec68f Remove invalid WITH default option (#960)
It seems like `create schema` option for WITH statement is invalid.
2019-05-07 23:06:02 +02:00
Dimitri Fontaine
b1d55e07d6 Implement header parsing for fixed file formats.
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.
2019-05-07 22:57:55 +02:00
Dimitri Fontaine
27b1a83b9f Allow quoted table and column names in user-defined CASTing rules.
Fixes #955.
2019-04-30 16:55:26 +02:00
Dimitri Fontaine
d4369cc605 Move DB3 transformations function in pglaoder.transforms package.
That makes them available for user defined cast rules.

Fix #929.
2019-04-29 16:52:24 +02:00
Dimitri Fontaine
febb2c11be Update HTTP/ZIP/DBF test case.
The URL of the test case source has changed. Use the new one. Also set the
encoding properly, the client_encoding trick has been deprecated for awhile
now, as pgloader only talks to Postgres in UTF-8.
2019-04-28 23:34:31 +02:00
Dimitri Fontaine
6dbe62af1c Attempt to fix MS SQL drop view for Mat Views facility.
It seems that the current open-coding of the materialized views data
structure is still causing some confusion, so use the same code as in the
MySQL support in the MS SQL parts of the code when trying to fix #950.

See #950.
2019-04-28 22:53:08 +02:00
Dimitri Fontaine
70b6845852 Apply identifier case to MS SQL column names in fkey definitions.
This is a blind fix: it looks like we forgot to take care of identifier case
when adding columns to foreign key definitions in MS SQL catalogs.

Fixes #953.
2019-04-28 22:48:07 +02:00
Dimitri Fontaine
513455f552 Implement support for MySQL bitstrings.
We migrate bit(xx) to the same PostgreSQL datatype bit(xx) where in Postgres
we can use bitstring as documented at the following URL. In particular the
COPY syntax accepts the notation Xabcd for the values, which is quite nice
when MySQL sends the data to us a a byte vector:

  https://www.postgresql.org/docs/current/datatype-bit.html

Fixes #943.
2019-04-19 12:52:04 +02:00
Dimitri Fontaine
a9133256a7 Change the main Dockerfile for sbcl to use make save too.
That building script does not rely on buildapp, which might be an advantage
in docker environments: first it's one less dependency, second, we have seen
weird error cases when using buildapp.
2019-04-17 14:56:54 +03:00
Dimitri Fontaine
739be3a730 Fix Dockerfile.ccl
Stop installing sbcl in the CCL image, that's not needed, and also make sure
we use a git clone of some of the libs rather than the current QL version of
them.

Fixes #926.
2019-04-17 14:51:11 +03:00
Dimitri Fontaine
4b9cbcbce3 Fix MySQL processing of Mat Views, again.
The previous fix left to be desired in that it didn't update the code
expectations about what a view-name looks like in fetch-metadata. In
particular we would use (cons NIL "table-name") in the only-table facility,
which expects non qualified names as strings.

Switch to using the :including filters facility instead, as we do in MS SQL.
Later, we might want to deprecate our internal :only-tables facility.

Fix #932. Again.
2019-04-15 23:06:57 +02:00
Dimitri Fontaine
1a4ce4fb46 Re-indent block before editing.
It turns out that current Emacs settings aren't agreeing with the file
indenting, let's clean that up before modifying the file, so that later
reviews are easier.
2019-04-15 23:05:28 +02:00
Dimitri Fontaine
701d54bfdf Bypass using buildapp in the Docker build for CCL. 2019-04-15 12:23:49 +02:00
Dimitri Fontaine
bc1167d3e3 Implement support for DB3 MEMO files.
The support code is actually found in cl-db3, the changes that are necessary
for pgloader are only about updating to the new API.

Fixes #926.
2019-04-14 22:22:33 +02:00
Dimitri Fontaine
7b10fabd94 Update DB3 documentation to include user-defined casting rules.
See #927, #938.
2019-04-14 21:56:04 +02:00
Dimitri Fontaine
39fc78e08f Implement user-defined casting rules support for DB3.
The casting support for DB3 was hand-crafted and didn't get upgraded to
using the current CAST grammar and facilities, for no other reasons than
lack of time and interest. It so happens what implementing it now fixes two
bug reports.

Bug #938 is about conversion defaulting to "not null" column, and that's due
to the usage of the internal pgloader catalogs where the target column's
nullable field is NIL by default, which doesn't make much sense. With
support for user-defined casting rules, the default is nullable columns, so
that's kind of a free fix.

Fixes #927.
Fixes #938.
2019-04-14 21:46:04 +02:00
Dimitri Fontaine
efe70ba3c3 Fix MySQL Materialized Views support, recently broken.
When adding support for Mat Views to MS SQL, we added support for the view
names to be fully qualified (with their schema), using a cons to host
the (schema . name) data.

Well, turns out the MySQL side of things didn't get the memo.

Blind attempt at fixing #932, see also #918.
2019-04-14 00:37:40 +02:00
Dimitri Fontaine
c83a0375a0 Fix glitch in Materialized Views support for MSSQL.
Thanks to @sorix6 for a bug report with a fix!

Fixes #928.
2019-04-14 00:23:37 +02:00
Dimitri Fontaine
957caa877e Add a new transform function for byte-vector to hexadecimal string.
In some cases when migrating from MySQL we want to transform data from
binary representation to an hexadecimal number. One such case is going from
MySQL binary(16) to PostgreSQL UUID data type.

Fixes #904.
2019-03-18 14:21:33 +01:00
Dimitri Fontaine
4d005b5c9c Improve Postgres connection string parsing.
Add support for single-quoting database name as in the Postgres
documentation about connection string at:

  https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-CONNSTRING

In passing, allow for ipv6 as well as ipv4 host ip addresses.

Fixes #923.
2019-03-17 17:25:41 +01:00
Andreas Hildebrandt
4ec8613884 Correctly parse PostgreSQL version string on Windows.
The regex used in parse-postgresql-version-string failed to handle
"PostgreSQL 10.6, compiled by Visual C++ build 1800, 64-bit"
correctly.
2019-02-25 15:48:40 +01:00
Dimitri Fontaine
0081fb6560 Oops, fix trailing closing parens.
When using interactive recompiling of the code in Emacs/SLIME, extra closing
parens are just ignored in Emacs before sending the current form to the CL
compiler. When compiling from the source files, of course, that doesn't
work.

See #910.
2019-02-19 12:50:56 +01:00
Dimitri Fontaine
fbdc95ede6 Fix parsing of MS GUID with mixed endianness.
It turns out that MS SQL Server is using its own representation for GUID
with a mixed endianness. In this blind patch we attempt to parse the binary
vector in the right way when building our internal representation of an
UUID, before making a string out of it for Postgres, which doesn't use the
same mixed-endianness format.

Fixes #910. Maybe?
2019-02-18 19:37:42 +01:00
Dimitri Fontaine
7c146c46b9 Citus support small bug fixes.
When calling the create_distributed_table() function, the column name is
given as a literal parameter to the function and should be quoted that way,
with single quotes. In particular, if our column-name is already
double-quoted, we need to get rid of those extra quotes.

Also, the source-table-name might be a cons object when qualified, or a
plain string when not schema-qualified. Adjust the citus-find-table code to
take that into account.
2019-02-16 15:48:46 +01:00
Dimitri Fontaine
2e6a941d25 Restore --list-encodings option.
It got broken, somehow. Let's move it further up the chain of command line
option processing.

Fixed #909.
2019-02-15 21:18:38 +01:00
Dimitri Fontaine
69d9b381dc Fix previous patch: also process the bad row.
The bad row needs to go to the reject file, and its condition error message
to the reject log. Ooops, forgot.

See #836.
2019-02-15 00:07:39 +01:00
Dimitri Fontaine
632f7f5b4e Implement COPY error handling for non-parsable error messages.
pgloarder parses the COPY error messages to find out the line number where
we have a problem in the batch, allowing for a quite efficient recovery
mechanism where it's easy enough to just skip the known faulty input.

Now, some error messages do not contain a COPY line number, such as fkey
violation messages:

  Database error 23503: insert or update on table "produtos" violates
  foreign key constraint "produtos_categorias_produtos_fk"

In that case rather than failing the whole batch at once (thanks to the
previous commit, we used to just badly fail before that), we can retry the
batch one row at a time until we find our culprit, and then continue one
input row at a time.

Fixes #836.
2019-02-15 00:05:47 +01:00
Dimitri Fontaine
8eea90bb51 Improve Foreign Key error handling.
We don't know how to parse the PostgreSQL condition sent when there is a
fkey error... and the message would not contain the row number where that
error happened anyway.

At the moment it means that the retry-batch facility errors out for failing
to realize that NIL isn't a number on which we can do arithmetic, which in
itself in a little sad.

In this patch we install a condition handler that knows how to deal with
retry-batch failing, so that pgloader may try and continue rather than
appear locked to the user, when I suspect that the debugger is waiting for
input.

See #836, where that's the first half of the fix. The real fix is to handle
foreign key errors correctly of course.
2019-02-14 23:10:12 +01:00
Dimitri Fontaine
2cbf716112 Ensure column names are double-quoted in the COPY command.
In some cases we have to quote column names and it's not been done yet, for
instance when dealing with PostgreSQL as a source database.

Patch mostly from @m0n5t3r, only cosmetic changes applied. Thanks!

Fixes #905.
2019-02-14 22:16:53 +01:00
Dimitri Fontaine
0caa9c30ce Fix Postgres to Postgres migrations with schema name change.
When migrating from PostgreSQL, pgloader takes the index and foreign key
definitions from the server directly, using pg_get_indexdef() and other
catalog functions. That's very useful in that it embeds all the necessary
quoting of the objects, and schema-qualify them.

Of course we can't use the SQL definition as on the source system when we
target a schema name that is different from the source system, which the
code didn't realize before this patch. Here we simply invalidate the
pre-computed SQL statement and resort to using the classic machinery to
build the statement from pieces again.

Fixes #903.
2019-02-14 18:24:50 +01:00
Dimitri Fontaine
213edbe930 Compare type names case-insensitively in casting rules.
The types TEXT and text are the same, and should match both when used as a
casting rule and when checking a catalog merge.

See #132.
2019-02-05 18:26:40 +03:00
ChristophKaser
36fbadded6 Allow "preserve index names" for MSSQL (#902)
With this change, preserve index names is also supported for MSSQL-connections.
2019-02-05 11:08:23 +03:00
William Hakizimana
be2815fda2 Typo: Change issing to issuing (#895) 2019-01-21 18:13:52 +01:00
Dimitri Fontaine
eafaf80b3c Back to non-release development.
Master's branch is now preparing for 3.6.2.
2019-01-21 17:51:44 +01:00
William Hakizimana
3208145e46 Typo: change directly to directory (#894) 2019-01-21 17:50:30 +01:00
Christoph Berg
15106489d6 New upstream version.
* New upstream version.
* SSL is always enabled now, drop our patch.
* Add B-D on python3-sphinx-rtd-theme.
2019-01-21 16:19:50 +01:00
Christoph Berg
de38a4473a Merge branch 'master' into debian 2019-01-21 16:09:05 +01:00
Dimitri Fontaine
25c937879a Fix building for 3.6.1.
The pgloader-image feature must be added in the lisp image before
reading/compiling the pgloader sources for it to be useful.
2019-01-21 15:02:39 +01:00
Dimitri Fontaine
dae5dec03c Allow fields/columns projections when parsing header.
When using a CSV header, we might find fields in a different order than the
target table columns, and maybe not all of the fields are going to be read.
Take account of the header we read rather than expecting the header to look
like the target table definition.

Fix #888.
2019-01-15 22:39:08 +01:00
Dimitri Fontaine
1306b4c953 Desultory improvements.
Killing tasks in the error handling must be done carefully, and given this
testing session it seems better to refrain from doing it when erroring out
at COPY init time (missing column is an example of that). The approach
around that is still very much ad-hoc rather than systematic.

In passing improve the `make save` option to producing a binary image: have
the make recipe respect the CL variable. The command line options
differences were already accounted for.
2019-01-09 18:57:33 +01:00
Dimitri Fontaine
2147a1d07b Implement ALTER TABLE ... SET TABLESPACE ... as a pgloader clause.
This allows creating tables in any target tablespace rather than the default
one, and is supported for the various sources having support for the ALTER
TABLE clause already.
2019-01-08 22:50:24 +01:00