New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Import CSV file" with "Client parses file content" adds incorrect value into the last row #329

Closed
fifonik opened this Issue Aug 15, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@fifonik

fifonik commented Aug 15, 2018

Steps to reproduce this issue

  1. Create tables for testing using the script:
DROP TABLE IF EXISTS src;

DROP TABLE IF EXISTS dest;

CREATE TABLE `src` (
	  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
	, `val` VARCHAR(15) NOT NULL
);

CREATE TABLE `dest` (
	  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
	, `val` VARCHAR(15) NOT NULL
);

INSERT INTO src (val) VALUES ('a1'), ('a2'), ('a3'), ('a4'), ('a5');
  1. Select 'src' table, go to Data tab, Right Mouse Button | Export grid rows to file | OK
    export_2

  2. Check the file's content
    file_2

  3. Select 'dest' table, Tools | Import CSV file | Client parses file content, untick 'id' column | Import
    import_2

  4. Notice HeidiSQL issued query with incorrect value for the last row (quote char and \r must not be there), press F5 to refresh 'dest' table Data and have a look at the content:
    INSERT INTOtest.dest(val) VALUES ('a1'), ('a2'), ('a3'), ('a4'), ('a5"\r');
    result_2

Current behavior

Quote char with \r added at the last row's last value

Expected behavior

Quote char and \r should not be added

Possible solution

Environment

  • HeidiSQL version: 9.5.0.5280
  • Database system and version: MySQL 5.7.19
  • Operating system: Windows 10 64-bit
@ansgarbecker

This comment has been minimized.

Show comment
Hide comment
@ansgarbecker

ansgarbecker Aug 19, 2018

Collaborator

I just reproduced that, and can confirm the issue exactly as you described it.

Collaborator

ansgarbecker commented Aug 19, 2018

I just reproduced that, and can confirm the issue exactly as you described it.

@ansgarbecker ansgarbecker added the bug label Aug 19, 2018

@ansgarbecker ansgarbecker added this to the v9.6 milestone Aug 19, 2018

@ansgarbecker

This comment has been minimized.

Show comment
Hide comment
@ansgarbecker

ansgarbecker Aug 19, 2018

Collaborator

The client parser is quite sensitive to line feeds at the end of the file. Previously, there mustn't be any linefeeds at the end to work correctly, now with my modification, there can be one, without confusing the import.

Please verify after updating to the latest build. Thanks!

Collaborator

ansgarbecker commented Aug 19, 2018

The client parser is quite sensitive to line feeds at the end of the file. Previously, there mustn't be any linefeeds at the end to work correctly, now with my modification, there can be one, without confusing the import.

Please verify after updating to the latest build. Thanks!

@fifonik

This comment has been minimized.

Show comment
Hide comment
@fifonik

fifonik Aug 19, 2018

Thanks for prompt fix.
Works as expected now.

fifonik commented Aug 19, 2018

Thanks for prompt fix.
Works as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment