linjianchang commented on code in PR #4233:
URL: https://github.com/apache/flink-cdc/pull/4233#discussion_r2740336329
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-postgres/src/main/java/org/apache/flink/cdc/connectors/postgres/utils/PostgresSchemaUtils.java:
##########
@@ -100,6 +102,55 @@ public static Schema getTableSchema(PostgresSourceConfig
sourceConfig, TableId t
}
}
+ public static Map<String,Integer> getColumnOids(PostgresSourceConfig
sourceConfig, TableId tableId,List<String> columns) {
+ try (PostgresConnection jdbc =
getPostgresDialect(sourceConfig).openJdbcConnection()) {
+ Map<String,Integer> oidMaps = new HashMap<>();
+ String inClause = columns.stream()
+ .map(column -> "'" + column.replace("'", "''") + "'")
+ .collect(Collectors.joining(",", "in (", ")"));
+ try {
+ jdbc.query(
+ "SELECT a.attname attname,a.attnum AS age_oid \n" +
+ "FROM pg_attribute a\n" +
+ "JOIN pg_class c ON a.attrelid = c.oid\n" +
Review Comment:
> Is the official recommended way to obtain history schema of a Postgres
table ?
Here, we are only obtaining the OID of the schema field in the current state
of the Postgres table, and determining whether the field has undergone a rename
operation based on whether the OID remains consistent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]