amazon-redshift-utils
amazon-redshift-utils copied to clipboard
v_generate_tbl_ddl incorrectly pulls comments on tables with same name in different schema
v_generate_tbl_ddl pulls comments for tables with the same name in different schemas as the join to information_schema."columns" is only joining on table name. Correct this by adding a condition to join on schema as well as shown below:
OLD Line 273: ON cl.ordinal_position::integer = des.objsubid AND cl.table_name::NAME = c.relname
NEW Line 273: ON cl.ordinal_position::integer = des.objsubid AND cl.table_name::NAME = c.relname AND cl.table_schema = n.nspname