diff --git a/src/org/dbflute/erflute/db/impl/postgres/PostgresTableImportManager.java b/src/org/dbflute/erflute/db/impl/postgres/PostgresTableImportManager.java index 41f6735..7f59684 100644 --- a/src/org/dbflute/erflute/db/impl/postgres/PostgresTableImportManager.java +++ b/src/org/dbflute/erflute/db/impl/postgres/PostgresTableImportManager.java @@ -5,6 +5,7 @@ import java.sql.SQLException; import org.dbflute.erflute.editor.model.dbimport.ImportFromDBManagerBase; +import org.eclipse.core.runtime.IProgressMonitor; public class PostgresTableImportManager extends ImportFromDBManagerBase { @@ -131,4 +132,42 @@ return type; } + + @Override + protected void cashTableComment(org.eclipse.core.runtime.IProgressMonitor monitor) throws SQLException, InterruptedException { + PreparedStatement ps = null; + ResultSet rs = null; + + try { + // PostgreSQLのpg_catalogからテーブルコメントを取得 + String sql = "SELECT n.nspname as schema_name, c.relname as table_name, " + + "obj_description(c.oid) as table_comment " + + "FROM pg_class c " + + "JOIN pg_namespace n ON n.oid = c.relnamespace " + + "WHERE c.relkind = 'r' " + + "AND obj_description(c.oid) IS NOT NULL " + + "AND n.nspname NOT IN ('information_schema', 'pg_catalog', 'pg_toast')"; + + ps = con.prepareStatement(sql); + rs = ps.executeQuery(); + + while (rs.next()) { + String schema = rs.getString("schema_name"); + String tableName = rs.getString("table_name"); + String tableComment = rs.getString("table_comment"); + + if (tableComment != null && !tableComment.trim().isEmpty()) { + String tableNameWithSchema = getTableNameWithSchema(schema, tableName); + tableCommentMap.put(tableNameWithSchema, tableComment); + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (ps != null) { + ps.close(); + } + } + } }