#6494: Fix enum name and add some SQL