Copy to Clipboard to type SQL doesn't work

494 views
Skip to first unread message

Richard Czech

unread,
May 28, 2021, 6:50:55 AM5/28/21
to SQL Workbench/J - DBMS independent SQL tool
Hello,

I use the "copy to clipboard" functionality very often.
This function changed in the last version and now comes up with the complex menu known from the file export.

I want to copy query result data into SQL INSERT format. However, it doesn't work.
The results are strange... Most times the clipboard is empty.
Sometimes it contains content from a previous copy operation...

Is this functionality tested?
Should it work as expected?

Regards
Richard

Richard Czech

unread,
May 28, 2021, 6:56:47 AM5/28/21
to SQL Workbench/J - DBMS independent SQL tool
Forget to mention my setup...

SQL Workbench/J, Build 127.5 (2021-05-15 15:42) 
Java version=15.0.2, java.home=C:\Program Files\RedHat\java-15-openjdk-jre-15.0.2-1, vendor=Red Hat, Inc., name=OpenJDK 64-Bit Server VM 
Operating System=Windows 10, version=10.0, platform=amd64 
Available memory: 10448MB 
Loaded look and feel: WindowsLookAndFeel 


Thomas Kellerer

unread,
May 28, 2021, 7:54:14 AM5/28/21
to sql-wo...@googlegroups.com
I had too many requests that wanted more control over the format when copying to the clipboard e.g. INSERTs with and without multi-row syntax, text with or without markdown formatting and so on.

So I decided to offer the same configuration options for copying to clipboard as for exporting data.

As the dialog remembers your last selection, the number of clicks isn't really that much different to before (except when you want to only export _some_ columns, which requires one click more).

This works without problems for me.

Do you invoke this from the context menu of the result (i.e. right click in the table then choose "Copy to clipboard") or from the main menu or through a Keyboard shortcut?

But if you only need SQL INSERT statements you can still use "Copy as SQL -> INSERT"

Regards
Thomas

Marison Parreiras

unread,
May 28, 2021, 11:47:55 AM5/28/21
to sql-wo...@googlegroups.com
I loved the new Ctrl + Y menu.

What do you think of the following functionality.

A way to select some columns and rows, perhaps Alt + cursor keys or Alt + left mouse click.

With a shortcut key or menu option we could copy to the clipboard only the rows and columns highlighted in this way.

You could have another menu option for the same data without a header too.

All copy and paste above will work with the last settings from Ctrl + Y option and/or we could have settings in Tools/Options menu to make it possible to choose a new separator for the data, if strings are wrapped in quotes etc.

I hope you can forgive my lack of image editing and English skills, but the following image should help to illustrate.

image.png

Is it better if I send the same thing in another email?

--
You received this message because you are subscribed to the Google Groups "SQL Workbench/J - DBMS independent SQL tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sql-workbenc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sql-workbench/79548acd-fadb-5a86-6076-84a5c1c68f7f%40sql-workbench.net.

Richard Czech

unread,
May 31, 2021, 4:41:06 AM5/31/21
to SQL Workbench/J - DBMS independent SQL tool
I like the new Copy-Data-to-Clipboard dialog (and get used to it).
However, I have severe problems to copy query results as SQL inserts.

I start the dialogue using the keyboard shortcut CTRL-Y.
I tested it with RedHat OpenJDK JRE 15.0.2.7.1 and 11.0.11.9.1.
The Java Memory is set to 4 GB.

Copying data as SQL insert works *once* for a smaller result set.
When I try to copy again it won't work.
Sometimes (not every time) an error message pops up saying "Array index out of range: 14".
When SQL Workbench is in this state I exit and restart the program...

When I copy smaller results sets containing less than 100 lines, I receive error messages.
In the clipboard I don't get the current results, but the results from the previous call...
It's all pretty strange.

I also tried the "Copy Data as SQL"  dialogue from the data grid.
It also works only for smaller result sets.
When I try to copy a bigger result set (12000 row) there's a "busy spinner" in the result grid.
The copy process doesn't finish. In the clipboard there's still the old result.
On exiting the program it displays an out of index error again (only visible for a split second...).

BTW: "Copy as SQL -> Insert" doesn't really help me for my problem.
I want to quickly copy a table from an IBM i DB2 to an Oracle database.
However, the "Copy as SQL -> insert" creates DB2 syntax, which won't work in Oracle...

Which JRE do you use for testing? 
I always use RedHat OpenJDK, but I can test another one...

Richard

Thomas Kellerer

unread,
May 31, 2021, 4:47:03 AM5/31/21
to sql-wo...@googlegroups.com
> Sometimes (not every time) an error message pops up saying "Array index out of range: 14".
> When SQL Workbench is in this state I exit and restart the program...

That shouldn't happen.

When this happens the next time, please send me the (complete) logfile.
You can send it directly to the support address, there is no need to go through Google Groups for that.

Regards
Thomas
> To unsubscribe from this group and stop receiving emails from it, send an email to sql-workbenc...@googlegroups.com <mailto:sql-workbenc...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sql-workbench/79b41881-75f6-44d4-8694-0ad587af1f59n%40googlegroups.com <https://groups.google.com/d/msgid/sql-workbench/79b41881-75f6-44d4-8694-0ad587af1f59n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Chris Young

unread,
Jun 15, 2021, 3:30:38 PM6/15/21
to SQL Workbench/J - DBMS independent SQL tool
Thomas,

One more suggestion in the new Copy to clipboard dialog.

When rows are selected, then ctrl-Y is pressed, the dialog correctly shows Selected rows checked.  And the filter is applied when selecting OK.

For a new result, with no rows selected, Selected rows remains checked and is not enabled so I can't remove the check.  Selecting OK results in no rows copied to the clipboard.  To get the correct behavior, I must cancel out of the dialog, then select a row, enter the dialog and then uncheck Selected rows.

It would be great if no rows were selected, then either a) Selected rows is defaulted to unchecked or b) the Selected rows filter is not applied when copying rows to the clipboard.

Thanks,
Chris

Thomas Kellerer

unread,
Jun 17, 2021, 2:55:34 PM6/17/21
to sql-wo...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages