Commit Graph

1288 Commits

Author SHA1 Message Date
Dimitri Fontaine
1d35290914 Assorted fixes for MS SQL support.
When updating the catalog support we forgot to fix the references to the
index and fkey name slots that are now provided centrally for the
catalog of all database source types.

Again, we don't have unit test cases for MS SQL, so that's a blind
fix (but at least that compiles).

See #343.
2017-01-10 21:19:29 +01:00
Dimitri Fontaine
dbf7d6e48f Don't double-quote identifiers in catalog queries.
Avoid double quoting the schema names when used in PostgreSQL catalog
queries, where the identifiers are used as literal values and need to be
single-quoted.

Fix #476, again.
2017-01-10 21:12:34 +01:00
Dimitri Fontaine
8da09d7bed Log PostgreSQL Catalog queries at SQL log level.
See #476 where it would have been helpful to see the PostgreSQL catalog
queries with `--log-min-messages sql` in the bug report. Also more
generally useful.
2017-01-10 21:12:34 +01:00
Dimitri Fontaine
17536e84a4 Create CNAME 2017-01-06 21:37:59 +01:00
Dimitri Fontaine
effa916b31 Improve parallelism setup documentation.
The code comment displayed in the release notes for 3.3.1 is reported to
be better at explaining the concurrency control than what we had in the
main documentation, so add it there.

Fix #496.
2017-01-03 23:13:01 +01:00
Dimitri Fontaine
21a10235db Refrain from issuing the summary twice.
Now that we have a proper flush system for reporting the summary at the
proper time (see 7c5396f097), refrain from
also taking care of the reporting when stopping the monitor.

Adapt the regression driver code to flush the summary after loading the
expected data, which also provides better output.

When the summary output is sent to a file, that would also create a
backup file and replace our summary with an empty new file at monitor
stop...

Fixes #499.
2017-01-03 23:07:58 +01:00
Dimitri Fontaine
b239e6b556 Fix #498. 2017-01-03 22:28:58 +01:00
Dimitri Fontaine
381ba18b50 Add a new log level: SQL.
This sits between NOTICE and INFO, allowing to have a complete log of
the SQL queries sent to the server while avoiding the very verbose
trafic of the DEBUG log level.

See #498.
2017-01-03 22:27:17 +01:00
Dimitri Fontaine
4931604361 Allow ALTER SCHEMA command for MySQL.
This pgloader command allows to migrate tables while changing the schema
they are found into in between their MySQL source database and their
PostgreSQL target database.

This changes the default behavior of pgloader with MySQL from always
targetting the 'public' schema to targetting by default a schema named
the same as the MySQL database. You can revert to the old behavior by
adding a rule:

   ALTER SCHEMA 'dbname' RENAME TO 'public

We might want to add a patch to re-install the default behavior later.

Also see #489 where it used not to be possible to rename the schema at
migration time, causing strange errors (you need to spot NIL as the
schema name in the "failed to find target table" messages.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
bdaacae3e7 Fix Primary Keys count.
That was broken in a recent patch refactoring the PostgreSQL SQL execute
API that now accepts a list of commands to execute.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
320a545533 Fix SQL types creation: consider views too.
When migrating views from e.g. MySQL it is necessary to consider the
user defined SQL types (ENUMs) those views might be using.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
ad56cf808b Fix PostgreSQL index naming.
A PostgreSQL index is always created in the same schema as the table it
is defined against, and the CREATE INDEX command doesn't accept schema
qualified index names.
2016-12-18 19:31:21 +01:00
Andy Freeland
9a0c50f700 Make sure EPEL is enabled when installing SBCL (#494) 2016-12-17 16:30:57 +01:00
Dimitri Fontaine
1c927beb81 Fix cl-postgres packaging (typo). 2016-12-12 12:04:40 +01:00
Dimitri Fontaine
37fc4ba550 Back to development mode. 2016-12-04 14:09:36 +01:00
Dimitri Fontaine
ac202dc70e Prepare release 3.3.2. 2016-12-03 17:38:52 +01:00
Dimitri Fontaine
db9fa2f001 Improve docs for connection strings.
Some parts of the connection strings might be provided from the
environment, such as in the MySQL case. Fix #485.
2016-12-03 15:51:39 +01:00
Dimitri Fontaine
6eef0c6c00 Improve docs with default parallelism settings.
Fix #442 by adding the default values of concurrency and workers.
2016-12-03 15:30:34 +01:00
Dimitri Fontaine
7c5396f097 Review fatal errors handling.
Make it so that fatal errors are printed only once, and when possible
included in the usual log format as handled by our monitoring thread.
Also, improve error and summary reporting when we load from several
sources on the same command line.

All this work has been triggered because of an edge case where the OS
return value of the pgloader command was 0 (zero, success) although the
given file on the command line does not exists.

Fixes #486.
2016-11-27 23:58:50 +01:00
Dimitri Fontaine
2dc733c4d6 Fix corner case in creating indexes again.
When the option "drop indexes" is in use in loading data from a file, we
collect the indexes from the PostgreSQL catalogs and then issue DROP
commands against them before the load, then CREATE commands when it's
done.

The CREATE is done in parallel, and we create an lparallel kernel for
that. The kernel must have a worker-count of at least 1, and we where
not considering the case of 0 indexes on the target table.

Fix #484.
2016-11-20 17:17:15 +01:00
Christoph Berg
27b67c6cf6 Add tzdata to build-depends (Closes: #839468) (#483) 2016-11-20 16:58:30 +01:00
Dimitri Fontaine
526fafb4b7 Allow quoting identifiers in db uri tablename.
As shown in #476, it is sometimes needed to be able to quote the
identifier names even when loading from a file, that is when specifying
the target table name in the database uri.

To that ends, allow the option "identifier case" to be used in the file
based cases too. Fixes #476.
2016-11-13 22:14:48 +01:00
Dimitri Fontaine
e5c8b8d159 Fix Advanced Howto for Geolite.
The example was still using a very old syntax for per-field options, and
even the current debian package doesn't support this syntax anymore...
Update the docs to use current syntax.

Fix #475.
2016-11-13 21:54:09 +01:00
Elias Pipping
af46dc280f Use uiop:run-program ... :directory ... (#473) 2016-11-06 22:40:12 +01:00
Dimitri Fontaine
0bd4488d78 Update scripts to reference freetds-devel.
I'm not sure if anyone is using those scripts anymore, but I suppose
keeping them known broken isn't helping anyone either. This is a blind
fix in reaction to latest comment in bug #131.
2016-11-01 21:08:31 +01:00
Dimitri Fontaine
43bb87943f Fix compilation error.
Introduced recently when refactoring the match rules, forgot to update
all call sites, and the bug went unnoticed for a while, oops. Not sure
the fix is all we need to get back a working feature (alter schema
rename to), but it allows to compile and that's all I have the time to
handle today.

See #466.
2016-10-25 11:54:56 +02:00
Dimitri Fontaine
4a431498ca Typo fix... 2016-10-02 20:09:55 +02:00
Dimitri Fontaine
ac91ea97d0 Add iwoca as a sponsor to pgloader.
Thanks guys ;-)
2016-10-02 16:28:43 +02:00
Dimitri Fontaine
d7d36c5766 Review identifier case :quote.
We added some confution about who's responsible to quote the SQL obejct
names in between src/utils/quoting.lisp and src/pgsql/pgsql-ddl.lisp and
as a result some migrations from MySQL with identifier case set to quote
where broken, as in #439.

To fix, remove any use of the format directive ~s in the PostgreSQL ddl
output methods: we consider that the quoting of ~s is to be decided in
apply-identifier-case. We then use ~a instead of ~s.

Fix #439.
2016-09-17 22:45:45 +02:00
Dimitri Fontaine
8fb542bc90 Improve INCLUDING rule matching for MySQL.
In the MySQL source we have explicit support for both string equality
and regexps for the INCLUDING and EXCLUDING clauses. This got broken
when moved to be shared with the ALTER TABLE implementation, because
we were no longer using the type system in the same way in all places.

To fix, create new abstractions for strings and regexps and use those
new structs in the proper way (thanks to defstruct and CLOS).

Fixes #441.
2016-09-10 18:54:11 +02:00
Dimitri Fontaine
5b6adb02b0 Implement and use DROP ... IF EXISTS.
In cases where we have a WITH include drop option, we are generating
lots of SQL DROP statements. We may be running an empty target database
or in other situations where the target object of the DROP command might
not exists. Add support for that case.
2016-09-10 18:01:04 +02:00
Dimitri Fontaine
5ad21bdbfb Add stats about how many files we processed.
In the FILENAME MATCHING case it might be good to have the information,
which can also explain some of the timing spent. The example in
test/bossa.load currently loads data from 296 files total...
2016-09-02 13:39:21 +02:00
Dimitri Fontaine
3569980378 Fix error reporting of catalogs.
The internal catalog representation are deeply recursive in order to
make it easy to traverse the catalog both downwards (catalog to schema
to tables) and upward (table to its schema to its catalog).

In consequence we need to set *print-circles* to non-nil when we're
going to log the catalogs, so turn it to non-nil before generating the
log messages.

While at it, add logging of such catalogs in the :data log verbosity
mode. The catalog output is very verbose, but it's easy to copy/paste it
from a bug report into being a live object we can inspect in the REPL,
thanks to Common Lisp notion of a reader and readable printer!
2016-08-30 23:25:35 +02:00
Dimitri Fontaine
7070f82976 Back to development mode, not a release anymore.
The next version is going to be either 3.3.2 or 3.4.0.50 depending on
whether we have mainly bug fixes or new features.
2016-08-30 23:17:03 +02:00
Dimitri Fontaine
cb30891fbb Release pgloader v3.3.1. 2016-08-28 20:31:31 +02:00
Dimitri Fontaine
f2dcf982d8 Fix stats collections in some cases.
Calling a -with-timing from within a with-stats-collection macro is
redundant and will have the numbers counted twice. Which in this case
didn't happen because the stats label was manually copied, but borked
with a typo in one copy.
2016-08-28 20:29:53 +02:00
Dimitri Fontaine
0b06bc6ad6 Update an old archive test case. 2016-08-28 20:29:30 +02:00
Dimitri Fontaine
9e574ce884 Rename web/ into docs/
This allows to benefit from github pages without having to maintain a
separate orphaned branch.
2016-08-19 20:55:29 +02:00
Dimitri Fontaine
a86a606d55 Improve existing PostgreSQL database handling.
When loading data into an existing PostgreSQL catalog, we DROP the
indexes for better performance of the data loading. Some of the indexes
are UNIQUE or even PRIMARY KEYS, and some FOREIGN KEYS might depend on
them in the PostgreSQL dependency tracking of the catalog.

We used to use the CASCADE option when dropping the indexes, which hides
a bug: if we exclude from the load tables with foreign keys pointing to
tables we target, then we would DROP those foreign keys because of the
CASCADE option, but fail to install them again at the end of the load.

To prevent that from happening, pgloader now query the PostgreSQL
pg_depend system catalog to list the “missing” foreign keys and add them
to our internal catalog representation, from which we know to DROP then
CREATE the SQL object at the proper times.

See #400 as this was an oversight in fixing this issue.
2016-08-10 22:02:06 +02:00
Dimitri Fontaine
43261e0016 Fix double-counting of fkeys in stats reports. 2016-08-08 21:09:15 +02:00
Dimitri Fontaine
53924fab01 Fix foreign key definition formatting.
When we do have a condef (constraint definition in the PostgreSQL
catalog slang), use it rather than trying to invent it again from the
bits and pieces. See #400, which it actually fixes now...
2016-08-08 01:18:36 +02:00
Dimitri Fontaine
210664fff5 Fix typo: Performance, singular.
Fixed #432.
2016-08-07 21:40:28 +02:00
Dimitri Fontaine
ffef9bc28e Improve pgloader bundle distribution.
Include the local git clones in the bundle so that git is not needed at
build time for consumers of the bundle. Fixes #428.
2016-08-07 21:30:48 +02:00
Dimitri Fontaine
c2c98b8b42 Allow any character in a quoted CSV field name.
We used to force overly strict rules for a quoted field name in a CSV
load file, now accept any character but a quote to be part of the field
name.

Fixes #416.
2016-08-07 20:35:37 +02:00
Dimitri Fontaine
70572a2ea7 Implement support for existing target databases.
Also known as the ORM case, it happens that other tools are used to
create the target schema. In that case pgloader job is to fill in the
exiting target tables with the data from the source tables.

We still focus on load speed and pgloader will now DROP the
constraints (Primary Key, Unique, Foreign Keys) and indexes before
running the COPY statements, and re-install the schema it found in the
target database once the data load is done.

This behavior is activated when using the “create no tables” option as
in the following test-case setup:

  with create no tables, include drop, truncate

Fixes #400, for which I got a test-case to play with!
2016-08-06 20:19:15 +02:00
Dimitri Fontaine
2d47c4f0f5 Use internal catalog when loading from files.
Replace the ad-hoc code that was used before in the load from file code
path to use our full internal catalog representation, and adjust APIs to
that end.

The goal is to use catalogs everywhere in the PostgreSQL target API and
allowing to process reason explicitely about source and target catalogs,
see #400 for the main use case.
2016-08-05 11:42:06 +02:00
Dimitri Fontaine
42c8012e94 Cleanup: remove the now unused file! 2016-08-05 11:39:16 +02:00
Dimitri Fontaine
2aedac7037 Improve our internal catalog representation.
First, add index and foreign keys to the list of objects supported by
the shared catalog facility, where is was only found in the pgsql schema
specific package for historical raisons.

Then also add to our catalog internal structures the notion of a trigger
and a stored procedure, allowing for cleaner advanced default values
support in the MySQL cast functions.

Once we now have a proper and complete catalog, review the pgsql module
DDL output function in terms of the catalog and rewrite the schema
creation support so that it takes direct benefit of our internal
catalogs representation.

In passing, clean-up the code organisation of the pgsql target support
module to be easier to work with.

Next step consists of getting rid of src/pgsql/queries.lisp: this
facility should be replaced by the usage of a target catalog that we
fetch the usual way, thanks to the new src/pgsql/pgsql-schema.lisp file
and list-all-* functions.

That will in turn allow for an explicit step of merging the pre-existing
PostgreSQL catalog when it's been created by other tools than pgloader,
that is when migrating with the help of an ORM. See #400 for details.
2016-08-01 23:14:58 +02:00
Dimitri Fontaine
87f6d3a0a0 Clean-up overloaded parse rule for numbers.
The MSSQL index filters parser needs to parse digits and keep them as
text, but was piggybacking on the main parsers and the fixed file format
positions parser by re-using the rule name "number".

My understanding was that by calling `defrule' in different packages one
would create a separate set of rules. It might have been wrong from the
beginning or just changed in newer versions of esrap. Will have to
investigate more.

This fixes #434 while not applying suggested code: the comment about
where to fix the bug is spot on.

Also, it should be noted that the regression tests framework seems to be
failing us and returns success in that error case, despite code
installed to properly handle the situation. This will also need to be
investigated.
2016-07-31 23:54:18 +02:00
Dimitri Fontaine
7daee9405f Fix column names quoting in reset-all-sequences.
The other user-provided names (schema and table) were already quoted
using the quote_ident() PostgreSQL functio, but the column name (attname
in the catalogs) were not.

Blind attempt to fix #425.
2016-06-20 20:52:24 +02:00