Fix import/export to work as expected with TSV data. Fixes #1934
parent
33e75d24f8
commit
0ab637c7ab
|
@ -23,7 +23,7 @@ define([
|
|||
encoding: undefined,
|
||||
oid: undefined,
|
||||
header: undefined,
|
||||
delimiter: ';',
|
||||
delimiter: '',
|
||||
quote: '\"',
|
||||
escape: '\'',
|
||||
null_string: undefined,
|
||||
|
@ -490,8 +490,8 @@ define([
|
|||
this.view.model.on('change', function() {
|
||||
if (!_.isUndefined(this.get('filename')) && this.get('filename') !== '') {
|
||||
this.errorModel.clear();
|
||||
if (!_.isUndefined(this.get('delimiter')) && this.get('delimiter') !== '' &&
|
||||
(this.get('delimiter').length == 1 || this.get('delimiter') == '[tab]')) {
|
||||
if (!_.isUndefined(this.get('delimiter')) && !_.isNull(this.get('delimiter'))
|
||||
) {
|
||||
this.errorModel.clear();
|
||||
if (!_.isUndefined(this.get('quote')) && this.get('quote') !== '' &&
|
||||
this.get('quote').length == 1) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
\copy {{ conn|qtIdent(data.schema, data.table) }} {% if columns %} {{ columns }} {% endif %} {% if data.is_import %}FROM{% else %}TO{% endif %} {{ data.filename|qtLiteral }} {% if data.oid %} OIDS {% endif %}{% if data.delimiter and data.format != 'binary' and data.delimiter == '[tab]' %} DELIMITER E'\\t' {% elif data.format != 'binary' and data.delimiter %} DELIMITER {{ data.delimiter|qtLiteral }}{% endif %}{% if data.format == 'csv' %} CSV {% endif %} {% if data.header %} HEADER {% endif %}{% if data.encoding %} ENCODING {{ data.encoding|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.quote %} QUOTE {{ data.quote|qtLiteral }}{% endif %}{% if data.format != 'binary' and data.null_string %} NULL {{ data.null_string|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.escape %} ESCAPE {{ data.escape|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.is_import and ignore_column_list %} FORCE_NOT_NULL {{ ignore_column_list }} {% endif %};
|
||||
\copy {{ conn|qtIdent(data.schema, data.table) }} {% if columns %} {{ columns }} {% endif %} {% if data.is_import %}FROM{% else %}TO{% endif %} {{ data.filename|qtLiteral }} {% if data.oid %} OIDS {% endif %}{% if data.delimiter is defined and data.delimiter == '' and (data.format == 'csv' or data.format == 'text') %} {% elif data.delimiter and data.format != 'binary' and data.delimiter == '[tab]' %} DELIMITER E'\t' {% elif data.format != 'binary' and data.delimiter %} DELIMITER {{ data.delimiter|qtLiteral }}{% endif %}{% if data.format == 'csv' %} CSV {% endif %} {% if data.header %} HEADER {% endif %}{% if data.encoding %} ENCODING {{ data.encoding|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.quote %} QUOTE {{ data.quote|qtLiteral }}{% endif %}{% if data.format != 'binary' and data.null_string %} NULL {{ data.null_string|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.escape %} ESCAPE {{ data.escape|qtLiteral }}{% endif %}{% if data.format == 'csv' and data.is_import and ignore_column_list %} FORCE_NOT_NULL {{ ignore_column_list }} {% endif %};
|
||||
|
|
Loading…
Reference in New Issue