I have a table called relevant_tables
that resembles:
schema_name table_name
AAA AA
AAA AB
AAA AC
BBB BA
I came across the information_schema.columns
table which will allow me to get the list of columns for tables if I specify WHERE table_name = 'my_table' AND table_schema = 'my_schema'
.
I want to get all the columns for all the tables specifically in my relevant_tables
table, as in the below intended output:
schema_name table_name column_name
AAA AA A
AAA AA B
AAA AA C
AAA AB A
AAA AC A
BBB BA A
So I tried to join the schema_name
and table_name
as follows:
SELECT
c.table_schema,
c.table_name,
column_name
FROM information_schema.columns c
JOIN relevant_tables r
ON c.table_schema = r.schema_name
AND c.table_name = r.table_name
However, I'm getting the following error:
[0A000] ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables.
Why am I getting this error and how do I achieve my intended output?