                         SELECT
                             study_name,
                             lower(
-                                    item_group_oid
+                                item_group_oid
                             ) AS item_group_oid,
                             item_oid,
                             lower(
-                                    item_name
+                                item_name
                             ) AS item_name,
                             lower(
-                                    CASE
-                                    WHEN length(
-                                                 item_name_hint
-                                         ) > 57
-                                    THEN substr(
-                                            item_name_hint,
-                                            1,
-                                            57
-                                    )
-                                    ELSE item_name_hint
-                                    END
+                                CASE
+                                WHEN length(
+                                         item_name_hint
+                                     ) > 57
+                                THEN substr(
+                                    item_name_hint,
+                                    1,
+                                    57
+                                )
+                                ELSE item_name_hint
+                                END
                             ) AS item_name_hint,
                             item_data_type,
                             max(
-                                    item_form_order
+                                item_form_order
                             ) AS item_form_order,
                             max(
-                                    item_response_set_label
+                                item_response_set_label
                             ) AS item_response_set_label,
                             crf_null_values
                         FROM

                                        THEN item_oid
                                        ELSE
                                            lower(
                                                    FORMAT(
                                                            $$%1$s_%2$s$$,
                                                            substr(
                                                                    dm_clean_name_string(
                                                                            dm_meta.item_name),
                                                                    1,
                                                                    12
                                                            ),
                                                            substr(
                                                                    dm_clean_name_string(
                                                                            dm_meta.item_description),
                                                                    1,
                                                                    45
                                                            )
                                                    )
                                            )
                                        END
                                    ) AS item_name_hint,

                                    LEFT JOIN
                                    crf_nulls
                                    USING (study_name, item_group_oid)
                                    INNER JOIN dm.metadata_study AS dmms
                                    USING (study_name)
                                WHERE
                                    EXISTS(
                                        SELECT n.nspname
                                        FROM
                                            pg_namespace AS n
                                        WHERE
                                            n.nspname = dmms.study_name_clean
                                    )
                                    AND NOT EXISTS(
                                        SELECT n.nspname AS schemaname
                                        FROM
                                            pg_class AS c
                                            LEFT JOIN
                                            pg_namespace AS n
                                                ON n.oid = c.relnamespace
                                        WHERE
                                            c.relkind = (
                                                CASE WHEN alias_views
                                                THEN $$v$$
                                                ELSE $$m$$
                                                END
                                            )
                                            AND dmms.study_name_clean = n.nspname
                                            AND lower(dm_meta.item_group_oid) = c.relname
                                        ORDER BY
                                            c.oid
                                    )
                                    AND
                                    (
                                        CASE
                                        WHEN length(
                                                 filter_study_name
                                             ) > 0
                                        THEN dm_meta.study_name =
                                             filter_study_name
