Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Redshift Error - ERROR: 0A000: Specified types or functions (one per INFO message) not supported on Redshift tables

When running the below query:

WITH sublevels AS (
SELECT 1 UNION ALL 
SELECT 1 UNION ALL
SELECT 1), FIELDA AS (SELECT (ROW_NUMBER() OVER ())::INT sublevel 
FROM sublevels sl1, sublevels sl2, sublevels sl3)
SELECT TOP 10 
FIELDB, 
sublevel, REPLACE(REGEXP_REPLACE(REGEXP_SUBSTR(UPPER(FIELDC), 'FROM \\S+', 1, sublevel), 'FROM ', ''),')','') ALIASA
FROM TABLEA
JOIN FIELDA ON sublevel <= REGEXP_COUNT(UPPER(FIELDC), 'FROM ')
WHERE ALIASA != 'ABC'
AND lower(split_part(ALIASA, '.', 2)) IN (
SELECT DISTINCT lower(t.table_name)
FROM information_schema.tables t
INNER JOIN information_schema.columns c on c.table_name = t.table_name AND c.table_schema = t.table_schema
WHERE lower(column_name) similar TO '%(aaa|bbb|ccc)%')

I am getting the following error:

ERROR: 0A000: Specified types or functions (one per INFO message) not supported on Redshift tables.

I have no idea why, if I run the queries individually they work fine:

Query1

WITH sublevels AS (
SELECT 1 UNION ALL 
SELECT 1 UNION ALL
SELECT 1), FIELDA AS (SELECT (ROW_NUMBER() OVER ())::INT sublevel 
FROM sublevels sl1, sublevels sl2, sublevels sl3)
SELECT TOP 10 
FIELDB, 
sublevel, REPLACE(REGEXP_REPLACE(REGEXP_SUBSTR(UPPER(FIELDC), 'FROM \\S+', 1, sublevel), 'FROM ', ''),')','') ALIASA
FROM TABLEA
JOIN FIELDA ON sublevel <= REGEXP_COUNT(UPPER(FIELDC), 'FROM ')
WHERE ALIASA != 'ABC'

Query2

SELECT DISTINCT lower(t.table_name)
FROM information_schema.tables t
INNER JOIN information_schema.columns c on c.table_name = t.table_name AND c.table_schema = t.table_schema
WHERE lower(column_name) similar TO '%(aaa|bbb|ccc)%'
like image 556
Matt Avatar asked Dec 31 '22 18:12

Matt


1 Answers

In Redshift:

  1. queries against information_schema run on the leader node only
  2. queries against any "normal" tables run on compute nodes only

You cannot mix and match 1. and 2.

like image 51
Jon Scott Avatar answered Jan 05 '23 02:01

Jon Scott