Skip to content

Error in SQL lab using RLS for dataset on PostgreSQL #32564

Open
@propellerjet

Description

@propellerjet

Bug description

The bug is reproduced for datasets on PostgreSQL with columns containing capital letters.
Steps:

  1. Create RLS
    Image
  2. Run select query for this dataset
    Image

Identifiers (including column names) that are not double-quoted are folded to lower case in PostgreSQL.
Identifiers created with double quotes retain upper case letters.

Analyzing the log we've found that even we are using double quotes for column name in RLS, query that are send to DB from SQL lab doesn't contain double quotes.

This bug is not reproduced on chart
Image
The query is generated correctly

Screenshots/recordings

No response

Superset version

4.1.1

Python version

3.9

Node version

16

Browser

Chrome

Additional context

flag RLS_IN_SQLLAB is applied


Worker container log
[2025-03-10 16:44:05,738: INFO/ForkPoolWorker-7] Task sql_lab.get_sql_results[28448e7f-351f-45c4-9624-441718fa923a] succeeded in 0.19986815191805363s: {'query_id': 12018, 'status': 'failed', 'error': 'postgresql error: column flights.airline does not exist

LINE 3: FROM (SELECT * FROM public.flights WHERE (flights.AIRLINE li...

                                              ^', 'errors': [{'message': 'postgresql error: column flights.airline does not exist

LINE 3: FROM (SELECT * FROM public.flights WHERE (flights.AIRLINE li...

                                              ^

', 'error_type': 'GENERIC_DB_ENGINE_ERROR', 'level': 'error', 'extra': {...}}]}


DB container log:
2025-03-10 16:44:05.720 [27282] ERROR: column flights.airline does not exist at character 54
2025-03-10 16:44:05.720 [27282] STATEMENT: SELECT
*
FROM (SELECT * FROM public.flights WHERE (flights.AIRLINE like 'A%')) AS flights
LIMIT 101

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions