Skip to content

Bug: Redshift "cannot cast type text to regclass" when expanding tables in database tree (recent regression) #1136

@aaaaaadrian

Description

@aaaaaadrian

Describe the bug

After updating to the latest version, I can no longer expand any table or view in the left-hand database tree on my Amazon Redshift connection. Clicking to expand a table puts "An error occurred" on the tree node and pops up: ERROR: cannot cast type text to regclass.

The same update also seems to have broken column autocomplete — when I start typing a column name in a SELECT, the suggestion list only shows functions, never the actual columns of the table I'm querying.

Both of these worked perfectly in a previous version, I'm not sure when this exactly stopped working. Nothing changed on my end — same database, same login, same permissions — so it looks like it started with a recent app update.

To Reproduce

  1. Connect to an Amazon Redshift database (Redshift is based on PostgreSQL 8.0.2).
  2. In the left database tree, expand a schema and click to expand any table or view (e.g. myschema.mytable).
  3. Instead of the columns, the node shows "An error occurred" and a popup appears: ERROR: cannot cast type text to regclass.
  4. Separately, in the SQL editor, type something like SELECT col FROM myschema.mytable and wait for autocomplete — it only suggests function names (e.g. array_lower), not the table's actual columns, even though those columns definitely exist.

Expected behavior

Expanding a table should list its columns / indexes / triggers like it used to, and autocomplete should suggest the columns of the table I'm selecting from.

Screenshots

Attaching: the regclass error popup and the tree showing "An error occurred" under several tables (table names redacted).

Additional details

I'm not an engineer, so apologies if I describe any of this clumsily — but I ran a couple of test queries by hand that might save you time:

  • Casting a fully-qualified table name to regclass works fine when I run it directly:
    SELECT 'myschema.mytable'::regclass; → returns a result, no error.
  • The bare name fails, but with a different error:
    SELECT 'mytable'::regclass;relation "mytable" does not exist (expected — it's just not on my search path).

So Redshift itself still supports the regclass cast, as long as the table name is given as a plain text literal. That makes me suspect the app may now be passing the table name into that lookup as a text value (a parameter or built-up expression) rather than as a literal. Redshift is happy to coerce a literal like 'myschema.mytable'::regclass, but it refuses to cast a general text value to regclass — and "cannot cast type text to regclass" is exactly the message it gives in that situation. (A quoting/escaping mistake would instead show "relation … does not exist," not a cast-type error — so it doesn't seem to be that.)

This may relate to #487, where the column-lookup query is shown using '{ESCAPED_TABLE_PATH}'::regclass.

App Version 2026.108 (Build 111232)

Happy to run any test queries or try a debug build against my Redshift connection, like the reporter did in #487 — just send them over.

Image

Product

SQLPro Studio

App version

Version 2026.108 (Build 111232)

Platform

macOS

Installation source

Setapp

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions