I will give you the context behind this request. This is related to this post Redshift cursor doesn't exist after creating a stored procedure. I have a workaround for this by using for loop with row_num window function. In order to do that I need to get the list of table names from PG_TABLE_DEF and store it in a temp table for processing through LOOP within Stored Proc. The challenge is we cannot run certain operations against table like PG_TABLE_DEF where it runs only on LEADER node. Hence I am getting this below error when i tried to copy data from PG_TABLE_DEF into a new temp table through CTAS.
ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables.
Could someone please help to overcome this scenario.