1
Vote

Comments not generated in DBModel Reverse Engineering from PostgresSQL

description

DBModel wasn't able to generate the Comments and Column Label from the POSTGRESQL , when i look up into the code seems like the implementation was missing.
However , i have fixed this issue and added the SQL Query to get the Comments for the Column .
Request to review and apply changes on the actual Source Code .

ClassModules --> clsImportProviderPostgreSQL --> RenderColumn Method

Change the Query to below
syntax = " SELECT c.oid" _
& Line & "        , a.attnum" _
& Line & "        , a.attname as column_name" _
& Line & "        , not a.attnotnull as is_nullable" _
& Line & "        , t.typname as data_type" _
& Line & "        , a.atttypmod - 4 as character_maximum_length" _
& Line & "        , a.atttypmod / 65536  as numeric_precision" _
& Line & "        , a.atttypmod % 65535 - a.atttypmod / 65536 - 4 as numeric_scale" _
& Line & "        , ad.adsrc as column_default" _
& Line & "        , pgd.description as column_comment" _
& Line & "     FROM pg_namespace AS nsp" _
& Line & "     JOIN pg_class AS c" _
& Line & "       ON c.relnamespace = nsp.oid" _
& Line & "      AND c.relname = '{0:table name}'" _
& Line & "     JOIN pg_attribute a" _
& Line & "       ON a.attrelid = c.oid AND a.attnum > 0" _
& Line & "     JOIN pg_type t ON t.oid = a.atttypid" _
& Line & "LEFT JOIN pg_catalog.pg_description AS pgd" _
& Line & "       ON pgd.objoid = c.oid AND pgd.objsubid = a.attnum" _
& Line & "LEFT JOIN pg_attrdef ad" _
& Line & "       ON ad.adrelid = c.oid" _
& Line & "      AND ad.adnum = a.attnum" _
& Line & "    WHERE nsp.nspname = current_schema()" _
& Line & " ORDER BY c.oid" _
& Line & "        , a.attnum"
and Put the below code after the commentend line TODO : objColumn.Comment = oRs("column_comment") & ""

If Not IsNull(oRs("column_comment")) Then
        objColumn.DBDescription = oRs("column_comment")
    Else
        objColumn.DBDescription = ""
    End If
Regards
Raj

comments