awslabs/amazon-redshift-utils

v_generate_tbl_ddl creates columns in the incorrect order

josephbrownskilljar opened this issue · 0 comments

v_generate_tbl_ddl returns columns in the order of the length of the column name, ascending rather than in the ordinal position order.

expected: the column order should be the same in these queries:

select ddl
from admin.v_generate_tbl_ddl
where schemaname = '<source_schema>'
and tablename = '<source_table>'
;
select *
from information_schema.columns
WHERE table_schema = '<source_schema>'
and table_name = '<source_table>'
order by ordinal_position
;