LittleBobbyTables
LittleBobbyTables

Reputation: 4473

SQL to querying a table with a dollar sign

I'm using the Looker Dashboarding software (see: looker.com). It creates temporary tables in your database's looker_scratch schema with long names, each containing a dollar symbol.

These are straightforward to query using the "SQL Runner" in Looker itself, which somehow is able to escape the dollar symbol, but I can't query them using a 3rd-party SQL client.

I'm trying to query this table:

SELECT *
FROM looker_scratch.LR$5UA5D3XQDBPAYU0Q9FLFE_test

but get the error:

the # of binded parameters < the # of parameter markers

How can I query the table?

I've tried:

Upvotes: 3

Views: 1654

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51456

try selecting exact identifier by pattern:

select oid::regclass from pg_class where relname ilike '%5ua5d%';

E.g:

so=# create table t."WeirdMix$" ();
CREATE TABLE
Time: 55.750 ms
so=# select oid::regclass from pg_class where relname ilike '%mix%';
      oid
---------------
 t."WeirdMix$"
(1 row)

Time: 90.814 ms

Upvotes: 4

Related Questions