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

Can't copy without headers #3586

Open
tedstriker2 opened this issue Oct 3, 2019 · 8 comments

Comments

@tedstriker2
Copy link

commented Oct 3, 2019

Details

In the context menu for a query result, there's an option to "Copy", and an option to "Copy with headers" (the column name). I don't want to copy the header, but it's happening anyway.

Steps to reproduce

Run a query, then try to copy a cell without headers.

Operating system

Windows 10

SQLiteStudio version

3.2.1

@pawelsalawa

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2019

I just did. Works here.
Try selecting a single cell and copy only it. Is header included anyway?
I did it for both single cell and for all cells - in both cases works correctly for me.

If you still have problem - can you please record how you do it? Usually in cases like this (works for me but not for someone else) there is some important piece missing and misunderstanding. Recording should resolve it.

In Windows 10 you can record easily with Win+g -> then record button. After recording is done you can find your record file in "My Videos".

@tedstriker2

This comment has been minimized.

Copy link
Author

commented Oct 3, 2019

SQLiteStudio (3.2.1) - [SQL editor 1] 2019-10-03 10-43-15.mp4.zip

I recorded a video as you requested where I selected a single cell, brought up the context menu with a right mouse click, and chose "Copy". Unfortunately, the video did not capture the context menu, but I did not select "Copy with headers". You can see from the video that the header was included anyway.

@pawelsalawa

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2019

From what I see, the "insert_sql" (supposed header, right?) is pasted at the end, so it cannot be header.

If you copy header, it is pasted as first.

I'm suspecting that you actually have "insert_sql" word at the end of your cell value. Switch to "Form View" tab and see the whole value there.

@tedstriker2

This comment has been minimized.

Copy link
Author

commented Oct 3, 2019

"insert_sql" is the header, and it is not part of the cell value that I'm generating, but yes - I see it is showing up in "form view" also!

Note that the same query works fine in version 3.0.6 of SQLiteStudio, which I'll go back to using now.

@pawelsalawa

This comment has been minimized.

Copy link
Owner

commented Oct 4, 2019

Is it possible, that you share the SQL query you're executing here?

@tedstriker2

This comment has been minimized.

Copy link
Author

commented Oct 7, 2019

Yes, here's the SQL query:

/* DO NOT "INSERT OR"! The primary key will increase no matter what! */
SELECT
    data_content,
    data_category,
    max_valid_target,
    data_len,
    max_freq_rank,
    'INSERT INTO dmz_txt (data_content, data_category, max_valid_target, data_len, max_freq_rank) VALUES ('
    ||quote(data_content)
    ||', '
    ||quote(data_category)
    ||', '
    ||max_valid_target
    ||', '
    ||data_len
    ||', '
    ||max_freq_rank
    ||');' insert_sql,
    1 severity
FROM
(
SELECT
    dta.abbv_txt data_content,
    dta.data_category,
    MAX(ifnull(dtmt.valid_target, 0)) max_valid_target,
    LENGTH(dta.abbv_txt) data_len,
    MAX(
        round(CAST(LENGTH(dta.abbv_txt) - 2 AS REAL) * 0.5),
        CAST(3 AS REAL)
        ) max_freq_rank
FROM dmz_txt_attr dta
LEFT JOIN dmz_txt_match_tgt dtmt
ON
    dtmt.orig_source = dta.orig_source
WHERE
    dta.abbv_txt IS NOT NULL
    AND (
        dta.orig_source LIKE 'IMPORT/%'
        OR dtmt.valid_target IS NOT NULL
    )
/* Make sure no data_keys are created for duplicate content */
GROUP BY
    dta.abbv_txt,
    dta.data_category
) ld
WHERE
    NOT EXISTS (
        SELECT
            1
        FROM dmz_txt cd
        WHERE
            cd.data_content = ld.data_content
            AND cd.data_category = ld.data_category
            AND cd.max_valid_target >= ld.max_valid_target
    )
ORDER BY
    max_valid_target,
    data_category,
    data_content
    --RANDOM()
;
@pawelsalawa

This comment has been minimized.

Copy link
Owner

commented Oct 8, 2019

Okay, I got it reproduced. Even with this significantly simplified query:

SELECT a, b,
    'INSERT INTO dmz_txt (data_content, data_category, max_valid_target, data_len, max_freq_rank) VALUES ('
    ||a
    ||', '
    ||b
    ||');' insert_sql,
    1 severity
FROM (SELECT * from test3) ld;

There is some problem with interpreting string concatenations, apparently.

@pawelsalawa pawelsalawa added the bug label Oct 8, 2019
@tedstriker2

This comment has been minimized.

Copy link
Author

commented Oct 8, 2019

I'm glad you were able to reproduce the issue. Thanks for looking into it.

@pawelsalawa pawelsalawa added this to the 3.2.2 milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.