Skip to content
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

"Execute SQL" strips newlines #1334

Closed
6 of 14 tasks
remisture opened this issue Mar 5, 2018 · 11 comments
Closed
6 of 14 tasks

"Execute SQL" strips newlines #1334

remisture opened this issue Mar 5, 2018 · 11 comments
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@remisture
Copy link

remisture commented Mar 5, 2018

Details for the issue

There seems to be an issue with newlines in the "Execute SQL" feature. If I have more than one, they get stripped out. It seems to work as expected when going through "Browse data" -> "New record".

Any idea how I can get around this problem until a fix is released? (I have hundreds of thousands records I need to import, so manual typing is not an option).

skjermbilde 2018-03-05 kl 12 15 07
skjermbilde 2018-03-05 kl 12 18 37

Useful extra information

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.10.1
  • 3.10.0
  • 3.9.1
  • Other: 3.10.99

I have also:

@chrisjlocke
Copy link
Member

chrisjlocke commented Mar 5, 2018

Have you tried the latest nightly version? I see you've ticked the 'I've tried the nightly version', but in my nightly version, this works OK...

image

I suspect its more of an OS related thingy though, which is never a good sign...
But before we trundled down that road, just wanted to make sure.

@remisture
Copy link
Author

Yes, the same issue is in the nightly version.

MacOS 10.13.4 Beta. I know this has worked ok before, so it sure sounds like an OS related thingy.

@chrisjlocke
Copy link
Member

Thanks for replying back and confirming.

@mgrojo
Copy link
Member

mgrojo commented Mar 5, 2018

I can reproduce it under Ubuntu 16.04.

This is probably related to issue #1270

In fact, this:

INSERT INTO "Manuel's"("my column") VALUES ('
-- Hello
-- World
');

becomes:

Query executed successfully: INSERT INTO "Manuel's"("my column") VALUES ('
') (took 0ms, 1 rows affected)

@mgrojo mgrojo added the bug Confirmed bugs or reports that are very likely to be bugs. label Mar 5, 2018
@mgrojo
Copy link
Member

mgrojo commented Mar 5, 2018

@remisture Is this a workaround for you?

INSERT INTO "Manuel's"("my column") VALUES ('This is some text:
' || '
- List item
- This is another item
' || '
More text here');

Just placing a space at the empty lines would also work.

I hope it helps.

mgrojo added a commit that referenced this issue Mar 5, 2018
In order to avoid removing multiple line breaks inside strings, the
replacement is only done when removeCommentsFromQuery has performed some
substitution. Otherwise the query is left as is.

This will improve the problem described in issue #1334 for simple cases.
There will be still problems when the query has comments and multiple line
breaks inside strings.
@mgrojo
Copy link
Member

mgrojo commented Mar 5, 2018

@remisture I've made a change that should fix at least the simple cases like the one you have reported. If there are comments, or something that we mistake with comments, in the query, it might still remove your line breaks. Could you try with the next nightly build, when it is available, and report your results?

@remisture
Copy link
Author

@mgrojo Thank you, I will try the next nightly build :)

Sadly I'm not able to use your workaround, as I don't control the queries (exported from another system). Thanks anyway.

@remisture
Copy link
Author

I can confirm that Version 3.10.99 (Mar 6 2018) works. Thank you very much!

@MKleusberg
Copy link
Member

Going to close this issue then because the original problem was solved a while ago and the more complex problem behind it was solved in #1455 a few days ago. If you feel like I closed this issue to early, feel free to reopen it anytime with some details on what still needs be improved 😄

@remisture
Copy link
Author

remisture commented Jul 14, 2018

When is this released? I'm in a situation now where the stable version has this bug, and the nightly version can't export to SQL file :/ Well, I guess I can import with the nightly and export with the stable 💃

Ref. #1476

@justinclift
Copy link
Member

As a thought, if you grab the nightly from Mar 6, that might not have this crash bug with the SQL export.

The multi-threading stuff we've been working on, which might be behind this crash, was added in May with 51dbe72. If that does turn out to be the cause, then grabbing one of the builds before that should do the trick too. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

No branches or pull requests

5 participants