SELECT
    r.RDB$FIELD_POSITION AS "Pos",
    r.RDB$FIELD_NAME AS "Field",
    CASE f.RDB$FIELD_TYPE
       WHEN 261 THEN 'BLOB'
       WHEN 14 THEN 'CHAR'
       WHEN 40 THEN 'CSTRING'
       WHEN 11 THEN 'D_FLOAT'
       WHEN 27 THEN 'DOUBLE'
       WHEN 10 THEN 'FLOAT'
       WHEN 16 THEN 'INT64'
       WHEN 8 THEN 'INTEGER'
       WHEN 9 THEN 'QUAD'
       WHEN 7 THEN 'SMALLINT'
       WHEN 12 THEN 'DATE'
       WHEN 13 THEN 'TIME'
       WHEN 35 THEN 'TIMESTAMP'
       WHEN 37 THEN 'VARCHAR'
       ELSE 'UNKNOWN'
     END AS "Type",
     f.RDB$FIELD_LENGTH AS "Length",
     f.RDB$FIELD_PRECISION AS "Precision",
     f.RDB$FIELD_SCALE AS "Scale",
     CASE WHEN r.RDB$NULL_FLAG = 1 THEN 'NO' ELSE 'YES' END AS "Null"
     FROM RDB$RELATION_FIELDS r
     LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME
     LEFT JOIN RDB$INDEX_SEGMENTS s ON s.RDB$FIELD_NAME=r.RDB$FIELD_NAME
     LEFT JOIN RDB$INDICES i ON i.RDB$INDEX_NAME = s.RDB$INDEX_NAME
          AND i.RDB$RELATION_NAME=r.RDB$RELATION_NAME
     LEFT JOIN RDB$RELATION_CONSTRAINTS rc ON rc.RDB$INDEX_NAME = s.RDB$INDEX_NAME
          AND rc.RDB$INDEX_NAME = i.RDB$INDEX_NAME
          AND rc.RDB$RELATION_NAME = i.RDB$RELATION_NAME
     LEFT JOIN RDB$REF_CONSTRAINTS refc ON rc.RDB$CONSTRAINT_NAME = refc.RDB$CONSTRAINT_NAME
     WHERE r.RDB$RELATION_NAME='CARGO'
     GROUP BY
        "Pos",
        "Field",
        "Type",
        "Length",
        "Precision",
        "Scale",
        "Null"
     ORDER BY "Pos";