Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

filtering result set in grid by unnamed column fails / and there is an inefficient subquery

See original GitHub issue

System information:

  • Operating system (distribution) and version: Windows 10
  • DBeaver version: 21.3.3

Connection specification:

  • Database name and version: SQL Server 2016

Describe the problem you’re observing:

When I have a grid with unnamed columns and try filtering on those columns, it fails. ezgif-6-969eb532c8 And the reason it fails is that the grid dataset is filtered using a subquery! This is not efficient.

I want to filter an already retrieved dataset without re-running the original query as subquery.

Please look at Toad for SQL Server as example: as soon as data is loaded, you can filter it like an Excel table, and there are no additional queries sent to the server.

Steps to reproduce, if exist:

I use SQL server but I guess it will fail in other DB types. Run any query that returns unnamed columns. E.g.

select object_schema_name(object_id), object_name(object_id) from sys.all_objects;

Try filtering on the column.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

igorzhilincommented, Mar 15, 2022

Still reproducible in

  1. Run this query: select object_schema_name(object_id), object_name(object_id) from sys.all_objects; in any DB in SQL Server.
  2. Filter any column with any value. image
serge-ridercommented, Mar 16, 2022

Unfortunately it is not possible to filter by columns with empty name. Generally SQL restricts columns with empty names, it is SQL Server-specific issue.

Workaround: add column aliases:

select object_schema_name(object_id) schema_name, object_name(object_id) object_name from sys.all_objects
Read more comments on GitHub >

github_iconTop Results From Across the Web

Join/Subquery is fast/slow depending on which column I filter ...
I guess, in Query B, it is running those subqueries first without filtering, but I don't know how to fix it. The problem...
Read more >
Some Top SQL Query Mistakes - Part 1 - Navicat
As a result, all rows are filtered out and the query returns zero rows. This issue can also surface if requirements change, and...
Read more >
Invalid sub-query filter. Either data cannot be retrieved (null) or ...
The query contains an invalid sub-query. Either data cannot be retrieved or no result objects are defined. Action. Modify the sub-query.
Read more >
Error conditions in Databricks
Databricks Runtime and Databricks SQL. AMBIGUOUS_COLUMN_OR_FIELD. Column or field <name> is ambiguous and has <n> matches. AMBIGUOUS_CONSTRAINT.
Read more >
Release notes for SQL Server Management Studio (SSMS)
There is a known problem due to incorrect data in msdb. ... issue where the reordering of XML columns in the "Result Grid"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found