2 .\" generated with Ronn/v0.7.3
3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
5 .TH "PGLOADER" "1" "January 2016" "ff" ""
8 \fBpgloader\fR \- PostgreSQL data loader
14 pgloader [<options>] [<command\-file>]\.\.\.
15 pgloader [<options>] SOURCE TARGET
20 pgloader loads data from various sources into PostgreSQL\. It can transform the data it reads on the fly and submit raw SQL before and after the loading\. It uses the \fBCOPY\fR PostgreSQL protocol to stream the data into the server, and manages errors by filling a pair of \fIreject\.dat\fR and \fIreject\.log\fR files\.
23 pgloader operates either using commands which are read from files:
29 pgloader commands\.load
36 or by using arguments and options all provided on the command line:
42 pgloader SOURCE TARGET
49 The pgloader arguments can be as many load files as needed, or a couple of connection strings to a specific input file\.
51 .SS "SOURCE CONNECTION STRING"
52 The source connection string format is as follows:
58 format:///absolute/path/to/file\.ext
59 format://\./relative/path/to/file\.ext
66 Where format might be one of \fBcsv\fR, \fBfixed\fR, \fBcopy\fR, \fBdbf\fR, \fBdb3\fR or \fBixf\fR\.
72 db://user:pass@host:port/dbname
79 Where db might be of \fBsqlite\fR, \fBmysql\fR or \fBmssql\fR\.
82 When using a file based source format, pgloader also support natively fetching the file from an http location and decompressing an archive if needed\. In that case it\'s necessary to use the \fB\-\-type\fR option to specify the expected format of the file\. See the examples below\.
85 Also note that some file formats require describing some implementation details such as columns to be read and delimiters and quoting when loading from csv\.
88 For more complex loading scenarios, you will need to write a full fledge load command in the syntax described later in this document\.
90 .SS "TARGET CONNECTION STRING"
91 The target connection string format is described in details later in this document, see Section Connection String\.
96 Use these options when you want to know more about how to use \fBpgloader\fR, as those options will cause \fBpgloader\fR not to load any data\.
99 \fB\-h\fR, \fB\-\-help\fR
100 Show command usage summary and exit\.
103 \fB\-V\fR, \fB\-\-version\fR
104 Show pgloader version string and exit\.
107 \fB\-E\fR, \fB\-\-list\-encodings\fR
108 List known encodings in this version of pgloader\.
111 \fB\-U\fR, \fB\-\-upgrade\-config\fR
112 Parse given files in the command line as \fBpgloader\.conf\fR files with the \fBINI\fR syntax that was in use in pgloader versions 2\.x, and output the new command syntax for pgloader on standard output\.
114 .SS "GENERAL OPTIONS"
115 Those options are meant to tweak \fBpgloader\fR behavior when loading data\.
118 \fB\-v\fR, \fB\-\-verbose\fR
122 \fB\-q\fR, \fB\-\-quiet\fR
126 \fB\-d\fR, \fB\-\-debug\fR
127 Show debug level information messages\.
130 \fB\-D\fR, \fB\-\-root\-dir\fR
131 Set the root working directory (default to "/tmp/pgloader")\.
134 \fB\-L\fR, \fB\-\-logfile\fR
135 Set the pgloader log file (default to "/tmp/pgloader\.log")\.
138 \fB\-\-log\-min\-messages\fR
139 Minimum level of verbosity needed for log message to make it to the logfile\. One of critical, log, error, warning, notice, info or debug\.
142 \fB\-\-client\-min\-messages\fR
143 Minimum level of verbosity needed for log message to make it to the console\. One of critical, log, error, warning, notice, info or debug\.
146 \fB\-S\fR, \fB\-\-summary\fR
147 A filename where to copy the summary output\. When relative, the filename is expanded into \fB*root\-dir*\fR\.
150 The format of the filename defaults to being \fIhuman readable\fR\. It is possible to have the output in machine friendly formats such as \fICSV\fR, \fICOPY\fR (PostgreSQL\'s own COPY format) or \fIJSON\fR by specifying a filename with the extension resp\. \fB\.csv\fR, \fB\.copy\fR or \fB\.json\fR\.
153 \fB\-l <file>\fR, \fB\-\-load\-lisp\-file <file>\fR
154 Specify a lisp \fIfile\fR to compile and load into the pgloader image before reading the commands, allowing to define extra transformation function\. Those functions should be defined in the \fBpgloader\.transforms\fR package\. This option can appear more than once in the command line\.
157 \fB\-\-self\-upgrade <directory>\fR:
160 Specify a \fIdirectory\fR where to find pgloader sources so that one of the very first things it does is dynamically loading\-in (and compiling to machine code) another version of itself, usually a newer one like a very recent git checkout\.
162 .SS "COMMAND LINE ONLY OPERATIONS"
163 Those options are meant to be used when using \fBpgloader\fR from the command line only, rather than using a command file and the rich command clauses and parser\. In simple cases, it can be much easier to use the \fISOURCE\fR and \fITARGET\fR directly on the command line, then tweak the loading with those options:
166 \fB\-\-with "option"\fR:
169 Allows setting options from the command line\. You can use that option as many times as you want\. The option arguments must follow the \fIWITH\fR clause for the source type of the \fBSOURCE\fR specification, as described later in this document\.
172 \fB\-\-set "guc_name=\'value\'"\fR
175 Allows setting PostgreSQL configuration from the command line\. Note that the option parsing is the same as when used from the \fISET\fR command clause, in particular you must enclose the guc value with single\-quotes\.
178 \fB\-\-field "\.\.\."\fR
181 Allows setting a source field definition\. Fields are accumulated in the order given on the command line\. It\'s possible to either use a \fB\-\-field\fR option per field in the source file, or to separate field definitions by a comma, as you would do in the \fIHAVING FIELDS\fR clause\.
184 \fB\-\-cast "\.\.\."\fR
187 Allows setting a specific casting rule for loading the data\.
190 \fB\-\-type csv|fixed|db3|ixf|sqlite|mysql|mssql\fR
193 Allows forcing the source type, in case when the \fISOURCE\fR parsing isn\'t satisfying\.
196 \fB\-\-encoding <encoding>\fR
199 Set the encoding of the source file to load data from\.
202 \fB\-\-before <filename>\fR
205 Parse given filename for SQL queries and run them against the target database before loading the data from the source\. The queries are parsed by pgloader itself: they need to be terminated by a semi\-colon (;) and the file may include \fB\ei\fR or \fB\eir\fR commands to \fIinclude\fR another file\.
208 \fB\-\-after <filename>\fR
211 Parse given filename for SQL queries and run them against the target database after having loaded the data from the source\. The queries are parsed in the same way as with the \fB\-\-before\fR option, see above\.
215 .SS "MORE DEBUG INFORMATION"
216 To get the maximum amount of debug information, you can use both the \fB\-\-verbose\fR and the \fB\-\-debug\fR switches at the same time, which is equivalent to saying \fB\-\-client\-min\-messages data\fR\. Then the log messages will show the data being processed, in the cases where the code has explicit support for it\.
219 Review the command line options and pgloader\'s version:
232 .SS "Loading from a complex command"
233 Use the command file as the pgloader command argument, pgloader will parse that file and execute the commands found in it:
239 pgloader \-\-verbose \./test/csv\-districts\.load
246 Load data from a CSV file into a pre\-existing table in your database:
252 pgloader \-\-type csv \e
253 \-\-field id \-\-field field \e
255 \-\-with "fields terminated by \',\'" \e
256 \./test/data/matching\-1\.csv \e
257 postgres:///pgloader?tablename=matching
264 In that example the whole loading is driven from the command line, bypassing the need for writing a command in the pgloader command syntax entirely\. As there\'s no command though, the extra inforamtion needed must be provided on the command line using the \fB\-\-type\fR and \fB\-\-field\fR and \fB\-\-with\fR switches\.
267 For documentation about the available syntaxes for the \fB\-\-field\fR and \fB\-\-with\fR switches, please refer to the CSV section later in the man page\.
270 Note also that the PostgreSQL URI includes the target \fItablename\fR\.
272 .SS "Reading from STDIN"
273 File based pgloader sources can be loaded from the standard input, as in the following example:
279 pgloader \-\-type csv \e
280 \-\-field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \e
281 \-\-with "skip header = 1" \e
282 \-\-with "fields terminated by \'\et\'" \e
284 postgresql:///pgloader?districts_longlat \e
285 < test/data/2013_Gaz_113CDs_national\.txt
292 The dash (\fB\-\fR) character as a source is used to mean \fIstandard input\fR, as usual in Unix command lines\. It\'s possible to stream compressed content to pgloader with this technique, using the Unix pipe:
298 gunzip \-c source\.gz | pgloader \-\-type csv \.\.\. \- pgsql:///target?foo
304 .SS "Loading from CSV available through HTTP"
305 The same command as just above can also be run if the CSV file happens to be found on a remote HTTP location:
311 pgloader \-\-type csv \e
312 \-\-field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \e
313 \-\-with "skip header = 1" \e
314 \-\-with "fields terminated by \'\et\'" \e
315 http://pgsql\.tapoueh\.org/temp/2013_Gaz_113CDs_national\.txt \e
316 postgresql:///pgloader?districts_longlat
323 Some more options have to be used in that case, as the file contains a one\-line header (most commonly that\'s column names, could be a copyright notice)\. Also, in that case, we specify all the fields right into a single \fB\-\-field\fR option argument\.
326 Again, the PostgreSQL target connection string must contain the \fItablename\fR option and you have to ensure that the target table exists and may fit the data\. Here\'s the SQL command used in that example in case you want to try it yourself:
332 create table districts_longlat
338 aland_sqmi double precision,
339 awater_sqmi double precision,
340 intptlat double precision,
341 intptlong double precision
349 Also notice that the same command will work against an archived version of the same data, e\.g\. http://pgsql\.tapoueh\.org/temp/2013_Gaz_113CDs_national\.txt\.gz\.
352 Finally, it\'s important to note that pgloader first fetches the content from the HTTP URL it to a local file, then expand the archive when it\'s recognized to be one, and only then processes the locally expanded file\.
355 In some cases, either because pgloader has no direct support for your archive format or maybe because expanding the archive is not feasible in your environment, you might want to \fIstream\fR the content straight from its remote location into PostgreSQL\. Here\'s how to do that, using the old battle tested Unix Pipes trick:
361 curl http://pgsql\.tapoueh\.org/temp/2013_Gaz_113CDs_national\.txt\.gz \e
363 | pgloader \-\-type csv \e
364 \-\-field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong"
365 \-\-with "skip header = 1" \e
366 \-\-with "fields terminated by \'\et\'" \e
368 postgresql:///pgloader?districts_longlat
375 Now the OS will take care of the streaming and buffering between the network and the commands and pgloader will take care of streaming the data down to PostgreSQL\.
377 .SS "Migrating from SQLite"
378 The following command will open the SQLite database, discover its tables definitions including indexes and foreign keys, migrate those definitions while \fIcasting\fR the data type specifications to their PostgreSQL equivalent and then migrate the data over:
385 pgloader \./test/sqlite/sqlite\.db postgresql:///newdb
391 .SS "Migrating from MySQL"
392 Just create a database where to host the MySQL data and definitions and have pgloader do the migration for you in a single command line:
399 pgloader mysql://user@localhost/sakila postgresql:///pagila
405 .SS "Fetching an archived DBF file from a HTTP remote location"
406 It\'s possible for pgloader to download a file from HTTP, unarchive it, and only then open it to discover the schema then load the data:
413 pgloader \-\-type dbf http://www\.insee\.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013\.zip postgresql:///foo
420 Here it\'s not possible for pgloader to guess the kind of data source it\'s being given, so it\'s necessary to use the \fB\-\-type\fR command line switch\.
422 .SH "BATCHES AND RETRY BEHAVIOUR"
423 To load data to PostgreSQL, pgloader uses the \fBCOPY\fR streaming protocol\. While this is the faster way to load data, \fBCOPY\fR has an important drawback: as soon as PostgreSQL emits an error with any bit of data sent to it, whatever the problem is, the whole data set is rejected by PostgreSQL\.
426 To work around that, pgloader cuts the data into \fIbatches\fR of 25000 rows each, so that when a problem occurs it\'s only impacting that many rows of data\. Each batch is kept in memory while the \fBCOPY\fR streaming happens, in order to be able to handle errors should some happen\.
429 When PostgreSQL rejects the whole batch, pgloader logs the error message then isolates the bad row(s) from the accepted ones by retrying the batched rows in smaller batches\. To do that, pgloader parses the \fICONTEXT\fR error message from the failed COPY, as the message contains the line number where the error was found in the batch, as in the following example:
435 CONTEXT: COPY errors, line 3, column b: "2006\-13\-11"
442 Using that information, pgloader will reload all rows in the batch before the erroneous one, log the erroneous one as rejected, then try loading the remaining of the batch in a single attempt, which may or may not contain other erroneous data\.
445 At the end of a load containing rejected rows, you will find two files in the \fIroot\-dir\fR location, under a directory named the same as the target database of your setup\. The filenames are the target table, and their extensions are \fB\.dat\fR for the rejected data and \fB\.log\fR for the file containing the full PostgreSQL client side logs about the rejected data\.
448 The \fB\.dat\fR file is formatted in PostgreSQL the text COPY format as documented in http://www\.postgresql\.org/docs/9\.2/static/sql\-copy\.html#AEN66609 \fI\fR\.
450 .SH "A NOTE ABOUT PERFORMANCES"
451 pgloader has been developed with performances in mind, to be able to cope with ever growing needs in loading large amounts of data into PostgreSQL\.
454 The basic architecture it uses is the old Unix pipe model, where a thread is responsible for loading the data (reading a CSV file, querying MySQL, etc) and fills pre\-processed data into a queue\. Another threads feeds from the queue, apply some more \fItransformations\fR to the input data and stream the end result to PostgreSQL using the COPY protocol\.
457 When given a file that the PostgreSQL \fBCOPY\fR command knows how to parse, and if the file contains no erroneous data, then pgloader will never be as fast as just using the PostgreSQL \fBCOPY\fR command\.
460 Note that while the \fBCOPY\fR command is restricted to read either from its standard input or from a local file on the server\'s file system, the command line tool \fBpsql\fR implements a \fB\ecopy\fR command that knows how to stream a file local to the client over the network and into the PostgreSQL server, using the same protocol as pgloader uses\.
462 .SH "A NOTE ABOUT PARALLELISM"
463 pgloader uses several concurrent tasks to process the data being loaded:
466 a reader task reads the data in,
469 at least one transformer task is responsible for applying the needed transformations to given data so that it fits PostgreSQL expectations, those transformations include CSV like user\-defined \fIprojections\fR, database \fIcasting\fR (default and user given), and PostgreSQL specific \fIformatting\fR of the data for the COPY protocol and in unicode,
472 at least one writer task is responsible for sending the data down to PostgreSQL using the COPY protocol\.
477 The idea behind having the transformer task do the \fIformatting\fR is so that in the event of bad rows being rejected by PostgreSQL the retry process doesn\'t have to do that step again\.
480 At the moment, the number of transformer and writer tasks are forced into being the same, which allows for a very simple \fIqueueing\fR model to be implemented: the reader task fills in one queue per transformer task, which then pops from that queue and pushes to a writer queue per COPY task\.
483 The parameter \fIworkers\fR allows to control how many worker threads are allowed to be active at any time (that\'s the parallelism level); and the parameter \fIconcurrency\fR allows to control how many tasks are started to handle the data (they may not all run at the same time, depending on the \fIworkers\fR setting)\.
486 With a \fIconcurrency\fR of 2, we start 1 reader thread, 2 transformer threads and 2 writer tasks, that\'s 5 concurrent tasks to schedule into \fIworkers\fR threads\.
489 So with \fBworkers = 4, concurrency = 2\fR, the parallel scheduler will maintain active only 4 of the 5 tasks that are started\.
492 With \fBworkers = 8, concurrency = 1\fR, we then are able to work on several units of work at the same time\. In the database sources, a unit of work is a table, so those settings allow pgloader to be active on as many as 3 tables at any time in the load process\.
495 As the \fBCREATE INDEX\fR threads started by pgloader are only waiting until PostgreSQL is done with the real work, those threads are \fINOT\fR counted into the concurrency levels as detailed here\.
498 pgloader supports the following input formats:
501 csv, which includes also tsv and other common variants where you can change the \fIseparator\fR and the \fIquoting\fR rules and how to \fIescape\fR the \fIquotes\fR themselves;
504 fixed columns file, where pgloader is flexible enough to accomodate with source files missing columns (\fIragged fixed length column files\fR do exist);
507 PostgreSLQ COPY formatted files, following the COPY TEXT documentation of PostgreSQL, such as the reject files prepared by pgloader;
510 dbase files known as db3 or dbf file;
513 ixf formated files, ixf being a binary storage format from IBM;
516 sqlite databases with fully automated discovery of the schema and advanced cast rules;
519 mysql databases with fully automated discovery of the schema and advanced cast rules;
522 MS SQL databases with fully automated discovery of the schema and advanced cast rules\.
526 .SH "PGLOADER COMMANDS SYNTAX"
527 pgloader implements a Domain Specific Language allowing to setup complex data loading scripts handling computed columns and on\-the\-fly sanitization of the input data\. For more complex data loading scenarios, you will be required to learn that DSL\'s syntax\. It\'s meant to look familiar to DBA by being inspired by SQL where it makes sense, which is not that much after all\.
530 The pgloader commands follow the same global grammar rules\. Each of them might support only a subset of the general options and provide specific options\.
537 FROM <source\-url> [ HAVING FIELDS <source\-level\-options> ]
538 INTO <postgresql\-url> [ TARGET COLUMNS <columns\-and\-options> ]
540 [ WITH <load\-options> ]
542 [ SET <postgresql\-settings> ]
544 [ BEFORE LOAD [ DO <sql statements> | EXECUTE <sql file> ] \.\.\. ]
545 [ AFTER LOAD [ DO <sql statements> | EXECUTE <sql file> ] \.\.\. ]
553 The main clauses are the \fBLOAD\fR, \fBFROM\fR, \fBINTO\fR and \fBWITH\fR clauses that each command implements\. Some command then implement the \fBSET\fR command, or some specific clauses such as the \fBCAST\fR clause\.
556 Some clauses are common to all commands:
562 The \fIFROM\fR clause specifies where to read the data from, and each command introduces its own variant of sources\. For instance, the \fICSV\fR source supports \fBinline\fR, \fBstdin\fR, a filename, a quoted filename, and a \fIFILENAME MATCHING\fR clause (see above); whereas the \fIMySQL\fR source only supports a MySQL database URI specification\.
565 In all cases, the \fIFROM\fR clause is able to read its value from an environment variable when using the form \fBGETENV \'varname\'\fR\.
571 The PostgreSQL connection URI must contains the name of the target table where to load the data into\. That table must have already been created in PostgreSQL, and the name might be schema qualified\.
574 The \fIINTO\fR target database connection URI can be parsed from the value of an environment variable when using the form \fBGETENV \'varname\'\fR\.
577 Then \fIINTO\fR option also supports an optional comma separated list of target columns, which are either the name of an input \fIfield\fR or the white space separated list of the target column name, its PostgreSQL data type and a \fIUSING\fR expression\.
580 The \fIUSING\fR expression can be any valid Common Lisp form and will be read with the current package set to \fBpgloader\.transforms\fR, so that you can use functions defined in that package, such as functions loaded dynamically with the \fB\-\-load\fR command line parameter\.
583 Each \fIUSING\fR expression is compiled at runtime to native code\.
586 This feature allows pgloader to load any number of fields in a CSV file into a possibly different number of columns in the database, using custom code for that projection\.
592 Set of options to apply to the command, using a global syntax of either:
601 \fIdo not use option\fR
606 See each specific command for details\.
609 All data sources specific commands support the following options:
615 \fIbatch size = \.\.\. MB\fR
618 \fIbatch concurrency = \.\.\.\fR
623 See the section BATCH BEHAVIOUR OPTIONS for more details\.
626 In addition, the following settings are available:
632 \fIconcurrency = C\fR
637 See section A NOTE ABOUT PARALLELISM for more details\.
643 This clause allows to specify session parameters to be set for all the sessions opened by pgloader\. It expects a list of parameter name, the equal sign, then the single\-quoted value as a comma separated list\.
646 The names and values of the parameters are not validated by pgloader, they are given as\-is to PostgreSQL\.
652 You can run SQL queries against the database before loading the data from the \fBCSV\fR file\. Most common SQL queries are \fBCREATE TABLE IF NOT EXISTS\fR so that the data can be loaded\.
655 Each command must be \fIdollar\-quoted\fR: it must begin and end with a double dollar sign, \fB$$\fR\. Dollar\-quoted queries are then comma separated\. No extra punctuation is expected after the last SQL query\.
658 \fIBEFORE LOAD EXECUTE\fR
661 Same behaviour as in the \fIBEFORE LOAD DO\fR clause\. Allows you to read the SQL queries from a SQL file\. Implements support for PostgreSQL dollar\-quoting and the \fB\ei\fR and \fB\eir\fR include facilities as in \fBpsql\fR batch mode (where they are the same thing)\.
667 Same format as \fIBEFORE LOAD DO\fR, the dollar\-quoted queries found in that section are executed once the load is done\. That\'s the right time to create indexes and constraints, or re\-enable triggers\.
670 \fIAFTER LOAD EXECUTE\fR
673 Same behaviour as in the \fIAFTER LOAD DO\fR clause\. Allows you to read the SQL queries from a SQL file\. Implements support for PostgreSQL dollar\-quoting and the \fB\ei\fR and \fB\eir\fR include facilities as in \fBpsql\fR batch mode (where they are the same thing)\.
677 .SS "Connection String"
678 The \fB<postgresql\-url>\fR parameter is expected to be given as a \fIConnection URI\fR as documented in the PostgreSQL documentation at http://www\.postgresql\.org/docs/9\.3/static/libpq\-connect\.html#LIBPQ\-CONNSTRING\.
684 postgresql://[user[:password]@][netloc][:port][/dbname][?option=value&\.\.\.]
697 Can contain any character, including colon (\fB:\fR) which must then be doubled (\fB::\fR) and at\-sign (\fB@\fR) which must then be doubled (\fB@@\fR)\.
700 When omitted, the \fIuser\fR name defaults to the value of the \fBPGUSER\fR environment variable, and if it is unset, the value of the \fBUSER\fR environment variable\.
706 Can contain any character, including the at sign (\fB@\fR) which must then be doubled (\fB@@\fR)\. To leave the password empty, when the \fIuser\fR name ends with at at sign, you then have to use the syntax user:@\.
709 When omitted, the \fIpassword\fR defaults to the value of the \fBPGPASSWORD\fR environment variable if it is set, otherwise the password is left unset\.
715 Can be either a hostname in dotted notation, or an ipv4, or an Unix domain socket path\. Empty is the default network location, under a system providing \fIunix domain socket\fR that method is preferred, otherwise the \fInetloc\fR default to \fBlocalhost\fR\.
718 It\'s possible to force the \fIunix domain socket\fR path by using the syntax \fBunix:/path/to/where/the/socket/file/is\fR, so to force a non default socket path and a non default port, you would have:
724 postgresql://unix:/tmp:54321/dbname
731 The \fInetloc\fR defaults to the value of the \fBPGHOST\fR environment variable, and if it is unset, to either the default \fBunix\fR socket path when running on a Unix system, and \fBlocalhost\fR otherwise\.
737 Should be a proper identifier (letter followed by a mix of letters, digits and the punctuation signs comma (\fB,\fR), dash (\fB\-\fR) and underscore (\fB_\fR)\.
740 When omitted, the \fIdbname\fR defaults to the value of the environment variable \fBPGDATABASE\fR, and if that is unset, to the \fIuser\fR value as determined above\.
746 The optional parameters must be supplied with the form \fBname=value\fR, and you may use several parameters by separating them away using an ampersand (\fB&\fR) character\.
749 Only some options are supported here, \fItablename\fR (which might be qualified with a schema name) \fIsslmode\fR, \fIhost\fR, \fIport\fR, \fIdbname\fR, \fIuser\fR and \fIpassword\fR\.
752 The \fIsslmode\fR parameter values can be one of \fBdisable\fR, \fBallow\fR, \fBprefer\fR or \fBrequire\fR\.
755 For backward compatibility reasons, it\'s possible to specify the \fItablename\fR option directly, without spelling out the \fBtablename=\fR parts\.
758 The options override the main URI components when both are given, and using the percent\-encoded option parameters allow using passwords starting with a colon and bypassing other URI components parsing limitations\.
762 .SS "Regular Expressions"
763 Several clauses listed in the following accept \fIregular expressions\fR with the following input rules:
766 A regular expression begins with a tilde sign (\fB~\fR),
769 is then followed with an opening sign,
772 then any character is allowed and considered part of the regular expression, except for the closing sign,
775 then a closing sign is expected\.
780 The opening and closing sign are allowed by pair, here\'s the complete list of allowed delimiters:
801 Pick the set of delimiters that don\'t collide with the \fIregular expression\fR you\'re trying to input\. If your expression is such that none of the solutions allow you to enter it, the places where such expressions are allowed should allow for a list of expressions\.
804 Any command may contain comments, following those input rules:
807 the \fB\-\-\fR delimiter begins a comment that ends with the end of the current line,
810 the delimiters \fB/*\fR and \fB*/\fR respectively start and end a comment, which can be found in the middle of a command or span several lines\.
815 Any place where you could enter a \fIwhitespace\fR will accept a comment too\.
817 .SS "Batch behaviour options"
818 All pgloader commands have support for a \fIWITH\fR clause that allows for specifying options\. Some options are generic and accepted by all commands, such as the \fIbatch behaviour options\fR, and some options are specific to a data source kind, such as the CSV \fIskip header\fR option\.
821 The global batch behaviour options are:
827 Takes a numeric value as argument, used as the maximum number of rows allowed in a batch\. The default is \fB25 000\fR and can be changed to try having better performances characteristics or to control pgloader memory usage;
833 Takes a memory unit as argument, such as \fI20 MB\fR, its default value\. Accepted multipliers are \fIkB\fR, \fIMB\fR, \fIGB\fR, \fITB\fR and \fIPB\fR\. The case is important so as not to be confused about bits versus bytes, we\'re only talking bytes here\.
836 \fIbatch concurrency\fR
839 Takes a numeric value as argument, defaults to \fB10\fR\. That\'s the number of batches that pgloader is allows to build in memory in each reader thread\. See the \fIworkers\fR setting for how many reader threads are allowed to run at the same time: each of them is allowed as many as \fIbatch concurrency\fR batches\.
844 Other options are specific to each input source, please refer to specific parts of the documentation for their listing and covering\.
847 A batch is then closed as soon as either the \fIbatch rows\fR or the \fIbatch size\fR threshold is crossed, whichever comes first\. In cases when a batch has to be closed because of the \fIbatch size\fR setting, a \fIdebug\fR level log message is printed with how many rows did fit in the \fIoversized\fR batch\.
850 This command instructs pgloader to load data from a \fBCSV\fR file\. Here\'s an example:
857 FROM \'GeoLiteCity\-Blocks\.csv\' WITH ENCODING iso\-646\-us
860 startIpNum, endIpNum, locId
862 INTO postgresql://user@localhost:54393/dbname?geolite\.blocks
865 iprange ip4r using (ip\-range startIpNum endIpNum),
870 fields optionally enclosed by \'"\',
871 fields escaped by backslash\-quote,
872 fields terminated by \'\et\'
874 SET work_mem to \'32 MB\', maintenance_work_mem to \'64 MB\';
881 The \fBcsv\fR format command accepts the following clauses and options:
887 Filename where to load the data from\. Accepts an \fIENCODING\fR option\. Use the \fB\-\-list\-encodings\fR option to know which encoding names are supported\.
890 The filename may be enclosed by single quotes, and could be one of the following special values:
896 The data is found after the end of the parsed commands\. Any number of empty lines between the end of the commands and the beginning of the data is accepted\.
902 Reads the data from the standard input stream\.
905 \fIFILENAMES MATCHING\fR
908 The whole \fImatching\fR clause must follow the following rule:
914 [ ALL FILENAMES | [ FIRST ] FILENAME ]
916 [ IN DIRECTORY \'\.\.\.\' ]
923 The \fImatching\fR clause applies given \fIregular expression\fR (see above for exact syntax, several options can be used here) to filenames\. It\'s then possible to load data from only the first match of all of them\.
926 The optional \fIIN DIRECTORY\fR clause allows specifying which directory to walk for finding the data files, and can be either relative to where the command file is read from, or absolute\. The given directory must exists\.
931 The \fIFROM\fR option also supports an optional comma separated list of \fIfield\fR names describing what is expected in the \fBCSV\fR data file, optionally introduced by the clause \fBHAVING FIELDS\fR\.
934 Each field name can be either only one name or a name following with specific reader options for that field, enclosed in square brackets and comma\-separated\. Supported per\-field reader options are:
940 See the description of \fIfield terminated by\fR below\.
943 The processing of this option is not currently implemented\.
949 When the field is expected of the date type, then this option allows to specify the date format used in the file\.
952 Date format string are template strings modeled against the PostgreSQL \fBto_char\fR template strings support, limited to the following patterns:
955 YYYY, YYY, YY for the year part
958 MM for the numeric month part
961 DD for the numeric day part
964 HH, HH12, HH24 for the hour part
967 am, AM, a\.m\., A\.M\.
970 pm, PM, p\.m\., P\.M\.
973 MI for the minutes part
976 SS for the seconds part
979 MS for the milliseconds part (4 digits)
982 US for the microseconds part (6 digits)
985 unparsed punctuation signs: \- \. * # @ T / \e and space
990 Here\'s an example of a \fIdate format\fR specification:
996 column\-name [date format \'YYYY\-MM\-DD HH24\-MI\-SS\.US\']
1007 This option takes an argument which is either the keyword \fIblanks\fR or a double\-quoted string\.
1010 When \fIblanks\fR is used and the field value that is read contains only space characters, then it\'s automatically converted to an SQL \fBNULL\fR value\.
1013 When a double\-quoted string is used and that string is read as the field value, then the field value is automatically converted to an SQL \fBNULL\fR value\.
1016 \fItrim both whitespace\fR, \fItrim left whitespace\fR, \fItrim right whitespace\fR
1019 This option allows to trim whitespaces in the read data, either from both sides of the data, or only the whitespace characters found on the left of the streaing, or only those on the right of the string\.
1028 When loading from a \fBCSV\fR file, the following options are supported:
1034 When this option is listed, pgloader issues a \fBTRUNCATE\fR command against the PostgreSQL target table before reading the data file\.
1040 When this option is listed, pgloader issues \fBDROP INDEX\fR commands against all the indexes defined on the target table before copying the data, then \fBCREATE INDEX\fR commands once the \fBCOPY\fR is done\.
1043 In order to get the best performances possible, all the indexes are created in parallel and when done the primary keys are built again from the unique indexes just created\. This two step process allows creating the primary key index in parallel with the other indexes, as only the \fBALTER TABLE\fR command needs an \fIaccess exclusive lock\fR on the target table\.
1046 \fIdisable triggers\fR
1049 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1052 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1058 Takes a numeric value as argument\. Instruct pgloader to skip that many lines at the beginning of the input file\.
1064 Use the first line read after \fIskip header\fR as the list of csv field names to be found in the CSV file, using the same CSV parameters as for the CSV data\.
1067 \fItrim unquoted blanks\fR
1070 When reading unquoted values in the \fBCSV\fR file, remove the blanks found in between the separator and the value\. That behaviour is the default\.
1073 \fIkeep unquoted blanks\fR
1076 When reading unquoted values in the \fBCSV\fR file, keep blanks found in between the separator and the value\.
1079 \fIfields optionally enclosed by\fR
1082 Takes a single character as argument, which must be found inside single quotes, and might be given as the printable character itself, the special value \et to denote a tabulation character, or \fB0x\fR then an hexadecimal value read as the ASCII code for the character\.
1085 This character is used as the quoting character in the \fBCSV\fR file, and defaults to double\-quote\.
1088 \fIfields not enclosed\fR
1091 By default, pgloader will use the double\-quote character as the enclosing character\. If you have a CSV file where fields are not enclosed and are using double\-quote as an expected ordinary character, then use the option \fIfields not enclosed\fR for the CSV parser to accept those values\.
1094 \fIfields escaped by\fR
1097 Takes either the special value \fIbackslash\-quote\fR or \fIdouble\-quote\fR, or any value supported by the \fIfields terminated by\fR option (see below)\. This value is used to recognize escaped field separators when they are to be found within the data fields themselves\. Defaults to \fIdouble\-quote\fR\.
1100 \fIcsv escape mode\fR
1103 Takes either the special value \fIquote\fR (the default) or \fIfollowing\fR and allows the CSV parser to parse either only escaped field separator or any character (including CSV data) when using the \fIfollowing\fR value\.
1106 \fIfields terminated by\fR
1109 Takes a single character as argument, which must be found inside single quotes, and might be given as the printable character itself, the special value \et to denote a tabulation character, or \fB0x\fR then an hexadecimal value read as the ASCII code for the character\.
1112 This character is used as the \fIfield separator\fR when reading the \fBCSV\fR data\.
1115 \fIlines terminated by\fR
1118 Takes a single character as argument, which must be found inside single quotes, and might be given as the printable character itself, the special value \et to denote a tabulation character, or \fB0x\fR then an hexadecimal value read as the ASCII code for the character\.
1121 This character is used to recognize \fIend\-of\-line\fR condition when reading the \fBCSV\fR data\.
1128 .SH "LOAD FIXED COLS"
1129 This command instructs pgloader to load data from a text file containing columns arranged in a \fIfixed size\fR manner\. Here\'s an example:
1141 d from 26 for 17 [null if blanks, trim right whitespace]
1143 INTO postgresql:///pgloader?fixed
1146 c time using (time\-with\-no\-separator c),
1152 SET work_mem to \'14MB\',
1153 standard_conforming_strings to \'on\'
1156 $$ drop table if exists fixed; $$,
1157 $$ create table fixed (
1165 01234567892008052011431250firstline
1166 01234562008052115182300left blank\-padded
1167 12345678902008052208231560another line
1168 2345609872014092914371500
1169 2345678902014092914371520
1176 The \fBfixed\fR format command accepts the following clauses and options:
1182 Filename where to load the data from\. Accepts an \fIENCODING\fR option\. Use the \fB\-\-list\-encodings\fR option to know which encoding names are supported\.
1185 The filename may be enclosed by single quotes, and could be one of the following special values:
1191 The data is found after the end of the parsed commands\. Any number of empty lines between the end of the commands and the beginning of the data is accepted\.
1197 Reads the data from the standard input stream\.
1202 The \fIFROM\fR option also supports an optional comma separated list of \fIfield\fR names describing what is expected in the \fBFIXED\fR data file\.
1205 Each field name is composed of the field name followed with specific reader options for that field\. Supported per\-field reader options are the following, where only \fIstart\fR and \fIlength\fR are required\.
1211 Position in the line where to start reading that field\'s value\. Can be entered with decimal digits or \fB0x\fR then hexadecimal digits\.
1217 How many bytes to read from the \fIstart\fR position to read that field\'s value\. Same format as \fIstart\fR\.
1222 Those optional parameters must be enclosed in square brackets and comma\-separated:
1228 See the description of \fIfield terminated by\fR below\.
1231 The processing of this option is not currently implemented\.
1237 When the field is expected of the date type, then this option allows to specify the date format used in the file\.
1240 Date format string are template strings modeled against the PostgreSQL \fBto_char\fR template strings support, limited to the following patterns:
1243 YYYY, YYY, YY for the year part
1246 MM for the numeric month part
1249 DD for the numeric day part
1252 HH, HH12, HH24 for the hour part
1255 am, AM, a\.m\., A\.M\.
1258 pm, PM, p\.m\., P\.M\.
1261 MI for the minutes part
1264 SS for the seconds part
1267 MS for the milliseconds part (4 digits)
1270 US for the microseconds part (6 digits)
1273 unparsed punctuation signs: \- \. * # @ T / \e and space
1278 Here\'s an example of a \fIdate format\fR specification:
1284 column\-name [date format \'YYYY\-MM\-DD HH24\-MI\-SS\.US\']
1295 This option takes an argument which is either the keyword \fIblanks\fR or a double\-quoted string\.
1298 When \fIblanks\fR is used and the field value that is read contains only space characters, then it\'s automatically converted to an SQL \fBNULL\fR value\.
1301 When a double\-quoted string is used and that string is read as the field value, then the field value is automatically converted to an SQL \fBNULL\fR value\.
1304 \fItrim both whitespace\fR, \fItrim left whitespace\fR, \fItrim right whitespace\fR
1307 This option allows to trim whitespaces in the read data, either from both sides of the data, or only the whitespace characters found on the left of the streaing, or only those on the right of the string\.
1316 When loading from a \fBFIXED\fR file, the following options are supported:
1322 When this option is listed, pgloader issues a \fBTRUNCATE\fR command against the PostgreSQL target table before reading the data file\.
1325 \fIdisable triggers\fR
1328 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1331 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1337 Takes a numeric value as argument\. Instruct pgloader to skip that many lines at the beginning of the input file\.
1344 .SH "LOAD COPY FORMATTED FILES"
1345 This commands instructs pgloader to load from a file containing COPY TEXT data as described in the PostgreSQL documentation\. Here\'s an example:
1352 FROM copy://\./data/track\.copy
1354 trackid, track, album, media, genre, composer,
1355 milliseconds, bytes, unitprice
1357 INTO postgresql:///pgloader?track_full
1361 SET work_mem to \'14MB\',
1362 standard_conforming_strings to \'on\'
1365 $$ drop table if exists track_full; $$,
1366 $$ create table track_full (
1373 milliseconds bigint,
1384 The \fBCOPY\fR format command accepts the following clauses and options:
1390 Filename where to load the data from\. This support local files, HTTP URLs and zip files containing a single dbf file of the same name\. Fetch such a zip file from an HTTP address is of course supported\.
1396 When loading from a \fBCOPY\fR file, the following options are supported:
1402 Takes a single character as argument, which must be found inside single quotes, and might be given as the printable character itself, the special value \et to denote a tabulation character, or \fB0x\fR then an hexadecimal value read as the ASCII code for the character\.
1405 This character is used as the \fIdelimiter\fR when reading the data, in a similar way to the PostgreSQL \fBCOPY\fR option\.
1411 Takes a quoted string as an argument (quotes can be either double quotes or single quotes) and uses that string as the \fBNULL\fR representation in the data\.
1414 This is similar to the \fInull\fR \fBCOPY\fR option in PostgreSQL\.
1420 When this option is listed, pgloader issues a \fBTRUNCATE\fR command against the PostgreSQL target table before reading the data file\.
1423 \fIdisable triggers\fR
1426 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1429 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1435 Takes a numeric value as argument\. Instruct pgloader to skip that many lines at the beginning of the input file\.
1443 This command instructs pgloader to load data from a \fBDBF\fR file\. Here\'s an example:
1450 FROM http://www\.insee\.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/reg2013\.dbf
1451 INTO postgresql://user@localhost/dbname
1452 WITH truncate, create table;
1459 The \fBdbf\fR format command accepts the following clauses and options:
1465 Filename where to load the data from\. This support local files, HTTP URLs and zip files containing a single dbf file of the same name\. Fetch such a zip file from an HTTP address is of course supported\.
1471 When loading from a \fBDBF\fR file, the following options are supported:
1477 When this option is listed, pgloader issues a \fBTRUNCATE\fR command against the PostgreSQL target table before reading the data file\.
1480 \fIdisable triggers\fR
1483 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1486 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1492 When this option is listed, pgloader creates the table using the meta data found in the \fBDBF\fR file, which must contain a list of fields with their data type\. A standard data type conversion from DBF to PostgreSQL is done\.
1498 This options expects as its value the possibly qualified name of the table to create\.
1506 This command instructs pgloader to load data from an IBM \fBIXF\fR file\. Here\'s an example:
1513 FROM data/nsitra\.test1\.ixf
1514 INTO postgresql:///pgloader?nsitra\.test1
1515 WITH truncate, create table, timezone UTC
1518 $$ create schema if not exists nsitra; $$,
1519 $$ drop table if exists nsitra\.test1; $$;
1526 The \fBixf\fR format command accepts the following clauses and options:
1532 Filename where to load the data from\. This support local files, HTTP URLs and zip files containing a single ixf file of the same name\. Fetch such a zip file from an HTTP address is of course supported\.
1538 When loading from a \fBIXF\fR file, the following options are supported:
1544 When this option is listed, pgloader issues a \fBTRUNCATE\fR command against the PostgreSQL target table before reading the data file\.
1547 \fIdisable triggers\fR
1550 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1553 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1559 When this option is listed, pgloader creates the table using the meta data found in the \fBDBF\fR file, which must contain a list of fields with their data type\. A standard data type conversion from DBF to PostgreSQL is done\.
1565 This options expects as its value the possibly qualified name of the table to create\.
1571 This options allows to specify which timezone is used when parsing timestamps from an IXF file, and defaults to \fIUTC\fR\. Expected values are either \fBUTC\fR, \fBGMT\fR or a single quoted location name such as \fB\'Universal\'\fR or \fB\'Europe/Paris\'\fR\.
1579 This command instructs pgloader to load data from one or more files contained in an archive\. Currently the only supported archive format is \fIZIP\fR, and the archive might be downloaded from an \fIHTTP\fR URL\.
1589 FROM /Users/dim/Downloads/GeoLiteCity\-latest\.zip
1590 INTO postgresql:///ip4r
1593 DO $$ create extension if not exists ip4r; $$,
1594 $$ create schema if not exists geolite; $$,
1596 EXECUTE \'geolite\.sql\'
1599 FROM FILENAME MATCHING ~/GeoLiteCity\-Location\.csv/
1600 WITH ENCODING iso\-8859\-1
1604 region null if blanks,
1605 city null if blanks,
1606 postalCode null if blanks,
1609 metroCode null if blanks,
1610 areaCode null if blanks
1612 INTO postgresql:///ip4r?geolite\.location
1614 locid,country,region,city,postalCode,
1615 location point using (format nil "(~a,~a)" longitude latitude),
1618 WITH skip header = 2,
1619 fields optionally enclosed by \'"\',
1620 fields escaped by double\-quote,
1621 fields terminated by \',\'
1624 FROM FILENAME MATCHING ~/GeoLiteCity\-Blocks\.csv/
1625 WITH ENCODING iso\-8859\-1
1627 startIpNum, endIpNum, locId
1629 INTO postgresql:///ip4r?geolite\.blocks
1631 iprange ip4r using (ip\-range startIpNum endIpNum),
1634 WITH skip header = 2,
1635 fields optionally enclosed by \'"\',
1636 fields escaped by double\-quote,
1637 fields terminated by \',\'
1640 $$ create index blocks_ip4r_idx on geolite\.blocks using gist(iprange); $$;
1647 The \fBarchive\fR command accepts the following clauses and options:
1653 Filename or HTTP URI where to load the data from\. When given an HTTP URL the linked file will get downloaded locally before processing\.
1656 If the file is a \fBzip\fR file, the command line utility \fBunzip\fR is used to expand the archive into files in \fB$TMPDIR\fR, or \fB/tmp\fR if \fB$TMPDIR\fR is unset or set to a non\-existing directory\.
1659 Then the following commands are used from the top level directory where the archive has been expanded\.
1662 command [ \fIAND\fR command \.\.\. ]
1665 A series of commands against the contents of the archive, at the moment only \fBCSV\fR,\fB\'FIXED\fR and \fBDBF\fR commands are supported\.
1668 Note that commands are supporting the clause \fIFROM FILENAME MATCHING\fR which allows the pgloader command not to depend on the exact names of the archive directories\.
1671 The same clause can also be applied to several files with using the spelling \fIFROM ALL FILENAMES MATCHING\fR and a regular expression\.
1674 The whole \fImatching\fR clause must follow the following rule:
1680 FROM [ ALL FILENAMES | [ FIRST ] FILENAME ] MATCHING
1691 SQL Queries to run once the data is loaded, such as \fBCREATE INDEX\fR\.
1695 .SH "LOAD MYSQL DATABASE"
1696 This command instructs pgloader to load data from a database connection\. The only supported database source is currently \fIMySQL\fR, and pgloader supports dynamically converting the schema of the source database and the indexes building\.
1699 A default set of casting rules are provided and might be overloaded and appended to by the command\.
1709 FROM mysql://root@localhost/sakila
1710 INTO postgresql://localhost:54393/sakila
1712 WITH include drop, create tables, create indexes, reset sequences,
1713 workers = 8, concurrency = 1
1715 SET maintenance_work_mem to \'128MB\',
1716 work_mem to \'12MB\',
1717 search_path to \'sakila\'
1719 CAST type datetime to timestamptz drop default drop not null using zero\-dates\-to\-null,
1720 type date drop not null drop default using zero\-dates\-to\-null,
1721 \-\- type tinyint to boolean using tinyint\-to\-boolean,
1722 type year to integer
1724 MATERIALIZE VIEWS film_list, staff_list
1726 \-\- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, \'actor\'
1727 \-\- EXCLUDING TABLE NAMES MATCHING ~<ory>
1728 \-\- DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf8
1731 $$ create schema if not exists sakila; $$;
1738 The \fBdatabase\fR command accepts the following clauses and options:
1744 Must be a connection URL pointing to a MySQL database\. At the moment only MySQL is supported as a pgloader source\.
1747 If the connection URI contains a table name, then only this table is migrated from MySQL to PostgreSQL\.
1753 When loading from a \fBMySQL\fR database, the following options are supported, and the efault \fIWITH\fR clause is: \fIno truncate\fR, \fIcreate tables\fR, \fIinclude drop\fR, \fIcreate indexes\fR, \fIreset sequences\fR, \fIforeign keys\fR, \fIdowncase identifiers\fR\.
1762 When this option is listed, pgloader drops all the tables in the target PostgreSQL database whose names appear in the SQLite database\. This option allows for using the same command several times in a row until you figure out all the options, starting automatically from a clean environment\. Please note that \fBCASCADE\fR is used to ensure that tables are dropped even if there are foreign keys pointing to them\. This is precisely what \fBinclude drop\fR is intended to do: drop all target tables and recreate them\.
1765 Great care needs to be taken when using \fBinclude drop\fR, as it will cascade to \fIall\fR objects referencing the target tables, possibly including other tables that are not being loaded from the source DB\.
1768 \fIinclude no drop\fR
1771 When this option is listed, pgloader will not include any \fBDROP\fR statement when loading the data\.
1777 When this option is listed, pgloader issue the \fBTRUNCATE\fR command against each PostgreSQL table just before loading data into it\.
1783 When this option is listed, pgloader issues no \fBTRUNCATE\fR command\.
1786 \fIdisable triggers\fR
1789 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
1792 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
1798 When this option is listed, pgloader creates the table using the meta data found in the \fBMySQL\fR file, which must contain a list of fields with their data type\. A standard data type conversion from DBF to PostgreSQL is done\.
1801 \fIcreate no tables\fR
1804 When this option is listed, pgloader skips the creation of table before lading data, target tables must then already exist\.
1807 \fIcreate indexes\fR
1810 When this option is listed, pgloader gets the definitions of all the indexes found in the MySQL database and create the same set of index definitions against the PostgreSQL database\.
1813 \fIcreate no indexes\fR
1816 When this option is listed, pgloader skips the creating indexes\.
1819 \fIuniquify index names\fR, \fIpreserve index names\fR
1822 MySQL index names are unique per\-table whereas in PostgreSQL index names have to be unique per\-schema\. The default for pgloader is to change the index name by prefixing it with \fBidx_OID\fR where \fBOID\fR is the internal numeric identifier of the table the index is built against\.
1825 In somes cases like when the DDL are entirely left to a framework it might be sensible for pgloader to refrain from handling index unique names, that is achieved by using the \fIpreserve index names\fR option\.
1828 The default is to \fIuniquify index names\fR\.
1831 Even when using the option \fIpreserve index names\fR, MySQL primary key indexes named "PRIMARY" will get their names uniquified\. Failing to do so would prevent the primary keys to be created again in PostgreSQL where the index names must be unique per schema\.
1837 When this option is listed, pgloader gets the definitions of all the foreign keys found in the MySQL database and create the same set of foreign key definitions against the PostgreSQL database\.
1840 \fIno foreign keys\fR
1843 When this option is listed, pgloader skips creating foreign keys\.
1846 \fIreset sequences\fR
1849 When this option is listed, at the end of the data loading and after the indexes have all been created, pgloader resets all the PostgreSQL sequences created to the current maximum value of the column they are attached to\.
1852 The options \fIschema only\fR and \fIdata only\fR have no effects on this option\.
1855 \fIreset no sequences\fR
1858 When this option is listed, pgloader skips resetting sequences after the load\.
1861 The options \fIschema only\fR and \fIdata only\fR have no effects on this option\.
1864 \fIdowncase identifiers\fR
1867 When this option is listed, pgloader converts all MySQL identifiers (table names, index names, column names) to \fIdowncase\fR, except for PostgreSQL \fIreserved\fR keywords\.
1870 The PostgreSQL \fIreserved\fR keywords are determined dynamically by using the system function \fBpg_get_keywords()\fR\.
1873 \fIquote identifiers\fR
1876 When this option is listed, pgloader quotes all MySQL identifiers so that their case is respected\. Note that you will then have to do the same thing in your application code queries\.
1882 When this option is listed pgloader refrains from migrating the data over\. Note that the schema in this context includes the indexes when the option \fIcreate indexes\fR has been listed\.
1888 When this option is listed pgloader only issues the \fBCOPY\fR statements, without doing any other processing\.
1897 The cast clause allows to specify custom casting rules, either to overload the default casting rules or to amend them with special cases\.
1900 A casting rule is expected to follow one of the forms:
1906 type <mysql\-type\-name> [ <guard> \.\.\. ] to <pgsql\-type\-name> [ <option> \.\.\. ]
1907 column <table\-name>\.<column\-name> [ <guards> ] to \.\.\.
1914 It\'s possible for a \fIcasting rule\fR to either match against a MySQL data type or against a given \fIcolumn name\fR in a given \fItable name\fR\. That flexibility allows to cope with cases where the type \fBtinyint\fR might have been used as a \fBboolean\fR in some cases but as a \fBsmallint\fR in others\.
1917 The \fIcasting rules\fR are applied in order, the first match prevents following rules to be applied, and user defined rules are evaluated first\.
1920 The supported guards are:
1923 \fIwhen default \'value\'\fR
1926 The casting rule is only applied against MySQL columns of the source type that have given \fIvalue\fR, which must be a single\-quoted or a double\-quoted string\.
1929 \fIwhen typemod expression\fR
1932 The casting rule is only applied against MySQL columns of the source type that have a \fItypemod\fR value matching the given \fItypemod expression\fR\. The \fItypemod\fR is separated into its \fIprecision\fR and \fIscale\fR components\.
1935 Example of a cast rule using a \fItypemod\fR guard:
1941 type char when (= precision 1) to char keep typemod
1948 This expression casts MySQL \fBchar(1)\fR column to a PostgreSQL column of type \fBchar(1)\fR while allowing for the general case \fBchar(N)\fR will be converted by the default cast rule into a PostgreSQL type \fBvarchar(N)\fR\.
1951 \fIwith extra auto_increment\fR
1954 The casting rule is only applied against MySQL columns having the \fIextra\fR column \fBauto_increment\fR option set, so that it\'s possible to target e\.g\. \fBserial\fR rather than \fBinteger\fR\.
1957 The default matching behavior, when this option isn\'t set, is to match both columns with the extra definition and without\.
1960 This means that if you want to implement a casting rule that target either \fBserial\fR or \fBinteger\fR from a \fBsmallint\fR definition depending on the \fIauto_increment\fR extra bit of information from MySQL, then you need to spell out two casting rules as following:
1966 type smallint with extra auto_increment
1967 to serial drop typemod keep default keep not null,
1969 to integer drop typemod keep default keep not null
1979 The supported casting options are:
1982 \fIdrop default\fR, \fIkeep default\fR
1985 When the option \fIdrop default\fR is listed, pgloader drops any existing default expression in the MySQL database for columns of the source type from the \fBCREATE TABLE\fR statement it generates\.
1988 The spelling \fIkeep default\fR explicitly prevents that behaviour and can be used to overload the default casting rules\.
1991 \fIdrop not null\fR, \fIkeep not null\fR
1994 When the option \fIdrop not null\fR is listed, pgloader drops any existing \fBNOT NULL\fR constraint associated with the given source MySQL datatype when it creates the tables in the PostgreSQL database\.
1997 The spelling \fIkeep not null\fR explicitly prevents that behaviour and can be used to overload the default casting rules\.
2000 \fIdrop typemod\fR, \fIkeep typemod\fR
2003 When the option \fIdrop typemod\fR is listed, pgloader drops any existing \fItypemod\fR definition (e\.g\. \fIprecision\fR and \fIscale\fR) from the datatype definition found in the MySQL columns of the source type when it created the tables in the PostgreSQL database\.
2006 The spelling \fIkeep typemod\fR explicitly prevents that behaviour and can be used to overload the default casting rules\.
2012 This option takes as its single argument the name of a function to be found in the \fBpgloader\.transforms\fR Common Lisp package\. See above for details\.
2015 It\'s possible to augment a default cast rule (such as one that applies against \fBENUM\fR data type for example) with a \fItransformation function\fR by omitting entirely the \fBtype\fR parts of the casting rule, as in the following example:
2021 column enumerate\.foo using empty\-string\-to\-null
2032 \fIMATERIALIZE VIEWS\fR
2035 This clause allows you to implement custom data processing at the data source by providing a \fIview definition\fR against which pgloader will query the data\. It\'s not possible to just allow for plain \fBSQL\fR because we want to know a lot about the exact data types of each column involved in the query output\.
2038 This clause expect a comma separated list of view definitions, each one being either the name of an existing view in your database or the following expression:
2041 \fIname\fR \fBAS\fR \fB$$\fR \fIsql query\fR \fB$$\fR
2044 The \fIname\fR and the \fIsql query\fR will be used in a \fBCREATE VIEW\fR statement at the beginning of the data loading, and the resulting view will then be dropped at the end of the data loading\.
2047 \fIMATERIALIZE ALL VIEWS\fR
2050 Same behaviour as \fIMATERIALIZE VIEWS\fR using the dynamic list of views as returned by MySQL rather than asking the user to specify the list\.
2053 \fIINCLUDING ONLY TABLE NAMES MATCHING\fR
2056 Introduce a comma separated list of table names or \fIregular expression\fR used to limit the tables to migrate to a sublist\.
2065 INCLUDING ONLY TABLE NAMES MATCHING ~/film/, \'actor\'
2073 \fIEXCLUDING TABLE NAMES MATCHING\fR
2076 Introduce a comma separated list of table names or \fIregular expression\fR used to exclude table names from the migration\. This filter only applies to the result of the \fIINCLUDING\fR filter\.
2082 EXCLUDING TABLE NAMES MATCHING ~<ory>
2090 \fIDECODING TABLE NAMES MATCHING\fR
2093 Introduce a comma separated list of table names or \fIregular expressions\fR used to force the encoding to use when processing data from MySQL\. If the data encoding known to you is different from MySQL\'s idea about it, this is the option to use\.
2099 DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf8
2106 You can use as many such rules as you need, all with possibly different encodings\.
2111 The \fBdatabase\fR command currently only supports MySQL source database and has the following limitations:
2114 Views are not migrated,
2117 Supporting views might require implementing a full SQL parser for the MySQL dialect with a porting engine to rewrite the SQL against PostgreSQL, including renaming functions and changing some constructs\.
2120 While it\'s not theoretically impossible, don\'t hold your breath\.
2123 Triggers are not migrated
2126 The difficulty of doing so is not yet assessed\.
2129 \fBON UPDATE CURRENT_TIMESTAMP\fR is currently not migrated
2132 It\'s simple enough to implement, just not on the priority list yet\.
2135 Of the geometric datatypes, only the \fBPOINT\fR database has been covered\. The other ones should be easy enough to implement now, it\'s just not done yet\.
2139 .SS "DEFAULT MySQL CASTING RULES"
2140 When migrating from MySQL the following Casting Rules are provided:
2146 type int with extra auto_increment to serial when (< precision 10)
2149 type int with extra auto_increment to bigserial when (<= 10 precision)
2152 type int to int when (< precision 10)
2155 type int to bigint when (<= 10 precision)
2158 type tinyint with extra auto_increment to serial
2161 type smallint with extra auto_increment to serial
2164 type mediumint with extra auto_increment to serial
2167 type bigint with extra auto_increment to bigserial
2170 type tinyint to boolean when (= 1 precision) using tinyint\-to\-boolean
2173 type tinyint to smallint drop typemod
2176 type smallint to smallint drop typemod
2179 type mediumint to integer drop typemod
2182 type integer to integer drop typemod
2185 type float to float drop typemod
2188 type bigint to bigint drop typemod
2191 type double to double precision drop typemod
2194 type numeric to numeric keep typemod
2197 type decimal to decimal keep typemod
2205 type char to varchar keep typemod using remove\-null\-characters
2208 type varchar to text using remove\-null\-characters
2211 type tinytext to text using remove\-null\-characters
2214 type text to text using remove\-null\-characters
2217 type mediumtext to text using remove\-null\-characters
2220 type longtext to text using remove\-null\-characters
2228 type binary to bytea
2231 type varbinary to bytea
2234 type tinyblob to bytea
2240 type mediumblob to bytea
2243 type longblob to bytea
2251 type datetime when default "0000\-00\-00 00:00:00" and not null to timestamptz drop not null drop default using zero\-dates\-to\-null
2254 type datetime when default "0000\-00\-00 00:00:00" to timestamptz drop default using zero\-dates\-to\-null
2257 type timestamp when default "0000\-00\-00 00:00:00" and not null to timestamptz drop not null drop default using zero\-dates\-to\-null
2260 type timestamp when default "0000\-00\-00 00:00:00" to timestamptz drop default using zero\-dates\-to\-null
2263 type date when default "0000\-00\-00" to date drop default using zero\-dates\-to\-null
2269 type datetime to timestamptz
2272 type timestamp to timestamptz
2275 type year to integer drop typemod
2283 type point to point using pgloader\.transforms::convert\-mysql\-point
2288 Enum types are declared inline in MySQL and separately with a \fBCREATE TYPE\fR command in PostgreSQL, so each column of Enum Type is converted to a type named after the table and column names defined with the same labels in the same order\.
2291 When the source type definition is not matched in the default casting rules nor in the casting rules provided in the command, then the type name with the typemod is used\.
2293 .SH "LOAD SQLite DATABASE"
2294 This command instructs pgloader to load data from a SQLite file\. Automatic discovery of the schema is supported, including build of the indexes\.
2304 from sqlite:///Users/dim/Downloads/lastfm_tags\.db
2305 into postgresql:///tags
2307 with include drop, create tables, create indexes, reset sequences
2309 set work_mem to \'16MB\', maintenance_work_mem to \'512 MB\';
2316 The \fBsqlite\fR command accepts the following clauses and options:
2322 Path or HTTP URL to a SQLite file, might be a \fB\.zip\fR file\.
2328 When loading from a \fBSQLite\fR database, the following options are supported:
2331 When loading from a \fBSQLite\fR database, the following options are supported, and the default \fIWITH\fR clause is: \fIno truncate\fR, \fIcreate tables\fR, \fIinclude drop\fR, \fIcreate indexes\fR, \fIreset sequences\fR, \fIdowncase identifiers\fR, \fIencoding \'utf\-8\'\fR\.
2337 When this option is listed, pgloader drops all the tables in the target PostgreSQL database whose names appear in the SQLite database\. This option allows for using the same command several times in a row until you figure out all the options, starting automatically from a clean environment\. Please note that \fBCASCADE\fR is used to ensure that tables are dropped even if there are foreign keys pointing to them\. This is precisely what \fBinclude drop\fR is intended to do: drop all target tables and recreate them\.
2340 Great care needs to be taken when using \fBinclude drop\fR, as it will cascade to \fIall\fR objects referencing the target tables, possibly including other tables that are not being loaded from the source DB\.
2343 \fIinclude no drop\fR
2346 When this option is listed, pgloader will not include any \fBDROP\fR statement when loading the data\.
2352 When this option is listed, pgloader issue the \fBTRUNCATE\fR command against each PostgreSQL table just before loading data into it\.
2358 When this option is listed, pgloader issues no \fBTRUNCATE\fR command\.
2361 \fIdisable triggers\fR
2364 When this option is listed, pgloader issues an \fBALTER TABLE \.\.\. DISABLE TRIGGER ALL\fR command against the PostgreSQL target table before copying the data, then the command \fBALTER TABLE \.\.\. ENABLE TRIGGER ALL\fR once the \fBCOPY\fR is done\.
2367 This option allows loading data into a pre\-existing table ignoring the \fIforeign key constraints\fR and user defined triggers and may result in invalid \fIforeign key constraints\fR once the data is loaded\. Use with care\.
2373 When this option is listed, pgloader creates the table using the meta data found in the \fBSQLite\fR file, which must contain a list of fields with their data type\. A standard data type conversion from DBF to PostgreSQL is done\.
2376 \fIcreate no tables\fR
2379 When this option is listed, pgloader skips the creation of table before lading data, target tables must then already exist\.
2382 \fIcreate indexes\fR
2385 When this option is listed, pgloader gets the definitions of all the indexes found in the SQLite database and create the same set of index definitions against the PostgreSQL database\.
2388 \fIcreate no indexes\fR
2391 When this option is listed, pgloader skips the creating indexes\.
2394 \fIreset sequences\fR
2397 When this option is listed, at the end of the data loading and after the indexes have all been created, pgloader resets all the PostgreSQL sequences created to the current maximum value of the column they are attached to\.
2400 \fIreset no sequences\fR
2403 When this option is listed, pgloader skips resetting sequences after the load\.
2406 The options \fIschema only\fR and \fIdata only\fR have no effects on this option\.
2412 When this option is listed pgloader will refrain from migrating the data over\. Note that the schema in this context includes the indexes when the option \fIcreate indexes\fR has been listed\.
2418 When this option is listed pgloader only issues the \fBCOPY\fR statements, without doing any other processing\.
2424 This option allows to control which encoding to parse the SQLite text data with\. Defaults to UTF\-8\.
2433 The cast clause allows to specify custom casting rules, either to overload the default casting rules or to amend them with special cases\.
2436 Please refer to the MySQL CAST clause for details\.
2439 \fIINCLUDING ONLY TABLE NAMES LIKE\fR
2442 Introduce a comma separated list of table name patterns used to limit the tables to migrate to a sublist\.
2451 INCLUDING ONLY TABLE NAMES LIKE \'Invoice%\'
2459 \fIEXCLUDING TABLE NAMES LIKE\fR
2462 Introduce a comma separated list of table name patterns used to exclude table names from the migration\. This filter only applies to the result of the \fIINCLUDING\fR filter\.
2468 EXCLUDING TABLE NAMES LIKE \'appointments\'
2477 .SS "DEFAULT SQLite CASTING RULES"
2478 When migrating from SQLite the following Casting Rules are provided:
2484 type tinyint to smallint
2487 type integer to bigint
2490 type float to float using float\-to\-string
2493 type real to real using float\-to\-string
2496 type double to double precision using float\-to\-string
2499 type numeric to numeric using float\-to\-string
2507 type character to text drop typemod
2510 type varchar to text drop typemod
2513 type nvarchar to text drop typemod
2516 type char to text drop typemod
2519 type nchar to text drop typemod
2522 type nvarchar to text drop typemod
2525 type clob to text drop typemod
2541 type datetime to timestamptz using sqlite\-timestamp\-to\-timestamp
2544 type timestamp to timestamptz using sqlite\-timestamp\-to\-timestamp
2547 type timestamptz to timestamptz using sqlite\-timestamp\-to\-timestamp
2551 .SH "LOAD MS SQL DATABASE"
2552 This command instructs pgloader to load data from a MS SQL database\. Automatic discovery of the schema is supported, including build of the indexes, primary and foreign keys constraints\.
2562 from mssql://user@host/dbname
2563 into postgresql:///dbname
2565 including only table names like \'GlobalAccount\' in schema \'dbo\'
2567 set work_mem to \'16MB\', maintenance_work_mem to \'512 MB\'
2569 before load do $$ drop schema if exists dbo cascade; $$;
2576 The \fBmssql\fR command accepts the following clauses and options:
2582 Connection string to an existing MS SQL database server that listens and welcome external TCP/IP connection\. As pgloader currently piggybacks on the FreeTDS driver, to change the port of the server please export the \fBTDSPORT\fR environment variable\.
2588 When loading from a \fBMS SQL\fR database, the same options as when loading a \fBMySQL\fR database are supported\. Please refer to the MySQL section\. The following options are added:
2591 \fIcreate schemas\fR
2594 When this option is listed, pgloader creates the same schemas as found on the MS SQL instance\. This is the default\.
2597 \fIcreate no schemas\fR
2600 When this option is listed, pgloader refrains from creating any schemas at all, you must then ensure that the target schema do exist\.
2609 The cast clause allows to specify custom casting rules, either to overload the default casting rules or to amend them with special cases\.
2612 Please refer to the MySQL CAST clause for details\.
2615 \fIINCLUDING ONLY TABLE NAMES LIKE \'\.\.\.\' [, \'\.\.\.\'] IN SCHEMA \'\.\.\.\'\fR
2618 Introduce a comma separated list of table name patterns used to limit the tables to migrate to a sublist\. More than one such clause may be used, they will be accumulated together\.
2627 including only table names lile \'GlobalAccount\' in schema \'dbo\'
2635 \fIEXCLUDING TABLE NAMES LIKE \'\.\.\.\' [, \'\.\.\.\'] IN SCHEMA \'\.\.\.\'\fR
2638 Introduce a comma separated list of table name patterns used to exclude table names from the migration\. This filter only applies to the result of the \fIINCLUDING\fR filter\.
2644 EXCLUDING TABLE NAMES MATCHING \'LocalAccount\' in schema \'dbo\'
2653 .SS "DEFAULT MS SQL CASTING RULES"
2654 When migrating from MS SQL the following Casting Rules are provided:
2660 type tinyint to smallint
2663 type float to float using float\-to\-string
2666 type real to real using float\-to\-string
2669 type double to double precision using float\-to\-string
2672 type numeric to numeric using float\-to\-string
2675 type decimal to numeric using float\-to\-string
2678 type money to numeric using float\-to\-string
2681 type smallmoney to numeric using float\-to\-string
2689 type char to text drop typemod
2692 type nchat to text drop typemod
2695 type varchar to text drop typemod
2698 type nvarchar to text drop typemod
2701 type xml to text drop typemod
2709 type binary to bytea using byte\-vector\-to\-bytea
2712 type varbinary to bytea using byte\-vector\-to\-bytea
2720 type datetime to timestamptz
2723 type datetime2 to timestamptz
2734 type hierarchyid to bytea
2737 type geography to bytea
2740 type uniqueidentifier to uuid using sql\-server\-uniqueidentifier\-to\-uuid
2744 .SH "TRANSFORMATION FUNCTIONS"
2745 Some data types are implemented in a different enough way that a transformation function is necessary\. This function must be written in \fBCommon lisp\fR and is searched in the \fBpgloader\.transforms\fR package\.
2748 Some default transformation function are provided with pgloader, and you can use the \fB\-\-load\fR command line option to load and compile your own lisp file into pgloader at runtime\. For your functions to be found, remember to begin your lisp file with the following form:
2754 (in\-package #:pgloader\.transforms)
2761 The provided transformation functions are:
2764 \fIzero\-dates\-to\-null\fR
2767 When the input date is all zeroes, return \fBnil\fR, which gets loaded as a PostgreSQL \fBNULL\fR value\.
2770 \fIdate\-with\-no\-separator\fR
2773 Applies \fIzero\-dates\-to\-null\fR then transform the given date into a format that PostgreSQL will actually process:
2779 In: "20041002152952"
2780 Out: "2004\-10\-02 15:29:52"
2788 \fItime\-with\-no\-separator\fR
2791 Transform the given time into a format that PostgreSQL will actually process:
2806 \fItinyint\-to\-boolean\fR
2809 As MySQL lacks a proper boolean type, \fItinyint\fR is often used to implement that\. This function transforms \fB0\fR to \fB\'false\'\fR and anything else to \fB\'true\fR\'\.
2812 \fIbits\-to\-boolean\fR
2815 As MySQL lacks a proper boolean type, \fIBIT\fR is often used to implement that\. This function transforms 1\-bit bit vectors from \fB0\fR to \fBf\fR and any other value to \fBt\fR\.\.
2821 Convert an integer into a dotted representation of an ip4\.
2828 Out: "1\.25\.78\.177"
2839 Converts a couple of integers given as strings into a range of ip4\.
2845 In: "16825344" "16825599"
2846 Out: "1\.0\.188\.0\-1\.0\.188\.255"
2854 \fIconvert\-mysql\-point\fR
2857 Converts from the \fBastext\fR representation of points in MySQL to the PostgreSQL representation\.
2863 In: "POINT(48\.5513589 7\.6926827)"
2864 Out: "(48\.5513589,7\.6926827)"
2872 \fIfloat\-to\-string\fR
2875 Converts a Common Lisp float into a string suitable for a PostgreSQL float:
2890 \fIset\-to\-enum\-array\fR
2893 Converts a string representing a MySQL SET into a PostgreSQL Array of Enum values from the set\.
2908 \fIempty\-string\-to\-null\fR
2911 Convert an empty string to a null\.
2917 Remove whitespace at end of string\.
2920 \fIremove\-null\-characters\fR
2923 Remove \fBNUL\fR characters (\fB0x0\fR) from given strings\.
2926 \fIbyte\-vector\-to\-bytea\fR
2929 Transform a simple array of unsigned bytes to the PostgreSQL bytea Hex Format representation as documented at http://www\.postgresql\.org/docs/9\.3/interactive/datatype\-binary\.html
2932 \fIsqlite\-timestamp\-to\-timestamp\fR
2935 SQLite type system is quite interesting, so cope with it here to produce timestamp literals as expected by PostgreSQL\. That covers year only on 4 digits, 0 dates to null, and proper date strings\.
2938 \fIsql\-server\-uniqueidentifier\-to\-uuid\fR
2941 The SQL Server driver receives data fo type uniqueidentifier as byte vector that we then need to convert to an UUID string for PostgreSQL COPY input format to process\.
2944 \fIunix\-timestamp\-to\-timestamptz\fR
2947 Converts a unix timestamp (number of seconds elapsed since beginning of 1970) into a proper PostgreSQL timestamp format\.
2952 This command is still experimental and allows receiving messages via UDP using a syslog like format, and, depending on rule matching, loads named portions of the data stream into a destination table\.
2959 FROM syslog://localhost:10514/
2961 WHEN MATCHES rsyslog\-msg IN apache
2962 REGISTERING timestamp, ip, rest
2963 INTO postgresql://localhost/db?logs\.apache
2964 SET guc_1 = \'value\', guc_2 = \'other value\'
2966 WHEN MATCHES rsyslog\-msg IN others
2967 REGISTERING timestamp, app\-name, data
2968 INTO postgresql://localhost/db?logs\.others
2969 SET guc_1 = \'value\', guc_2 = \'other value\'
2971 WITH apache = rsyslog
2973 IP = 1*3DIGIT "\." 1*3DIGIT "\."1*3DIGIT "\."1*3DIGIT
2976 WITH others = rsyslog;
2983 As the command is still experimental the options might be changed in the future and the details are not documented\.
2986 Dimitri Fontaine \fIdimitri@2ndQuadrant\.fr\fR
2989 .\" Oracle has added the ARC stability level to this manual page
2993 for descriptions of the following attributes:
2999 ATTRIBUTE TYPE ATTRIBUTE VALUE
3001 Availability database/postgres/pgloader
3003 Stability Uncommitted
3007 PostgreSQL COPY documentation at \fIhttp://www\.postgresql\.org/docs/9\.3/static/sql\-copy\.html\fR\.
3010 The pgloader source code, binary packages, documentation and examples may be downloaded from \fIhttp://pgloader\.io/\fR\.
3015 .\" Oracle has added source availability information to this manual page
3016 This software was built from source available at https://openindiana.org/. The original community source was downloaded from https://github.com/dimitri/pgloader/archive/v3.3.0.50.zip
3018 Further information about this software can be found on the open source community website at http://pgloader.io/.