goutamadwant opened a new issue, #12586:
URL: https://github.com/apache/seatunnel/issues/12586

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   A table with a PostgreSQL enum column cannot be read by Postgres-CDC or by 
the JDBC source with `table_path`. Both build the schema from 
`PostgresCatalog`, which passes the enum's type name (`mood`) to 
`PostgresTypeConverter` without a `sqlType`, so it fails with COMMON-20/21 at 
submit.
   
   #9835 reported this for `table_path`. It was closed by #11232, which maps 
unknown types to STRING only for `Types.OTHER`. The catalog path never sets 
that, and pgjdbc 42.4.3 (the shipped driver) and Debezium report enums as 
`Types.VARCHAR`, so the JDBC `query` path and CDC `schema-changes.enabled` 
still fail too.
   
   **Steps**
   
   1. `CREATE SCHEMA inv; CREATE TYPE inv.mood AS ENUM ('sad','ok','happy'); 
CREATE TYPE public.status AS ENUM ('new','done');`
   2. `CREATE TABLE inv.products (id int PRIMARY KEY, name varchar(50), m 
inv.mood, s status NOT NULL DEFAULT 'new'); INSERT INTO inv.products VALUES 
(1,'a','sad','new'), (2,'b','happy','done'), (3,'c',NULL,'new');`
   3. Run the job below.
   
   **Before / After** (dev, Zeta, pgjdbc 42.4.3, PostgreSQL 18.6 and 17.9)
   
   | Case | dev | with fix |
   |---|---|---|
   | Postgres-CDC snapshot + INSERT/UPDATE/DELETE | COMMON-21 at submit | 
source == sink |
   | CDC with `schema-changes.enabled = true` | COMMON-21 at submit; with only 
the catalog fixed, COMMON-17 on the first streamed change | source == sink |
   | JDBC `table_path` | COMMON-21 at submit | source == sink |
   | JDBC `query = "select * from inv.products"` | COMMON-21 | source == sink |
   | 27 common column types | — | mapping unchanged |
   
   ### SeaTunnel Version
   
   dev (4c4fd615d), 3.0.0
   
   ### SeaTunnel Config
   
   ```conf
   env { parallelism = 1, job.mode = "STREAMING", checkpoint.interval = 5000 }
   source { Postgres-CDC { url = "jdbc:postgresql://localhost:5432/cdc", 
username = "postgres", password = "***",
     database-names = ["cdc"], schema-names = ["inv"], table-names = 
["cdc.inv.products"], slot.name = "st_enum" } }
   sink { Console {} }
   ```
   
   ### Running Command
   
   ```shell
   bin/seatunnel.sh --config pg_cdc_enum.conf
   ```
   
   ### Error Exception
   
   ```log
   ErrorCode:[COMMON-21], ErrorDescription:['Postgres' tables unsupported get 
catalog table,the corresponding field types in the following tables are not 
supported: '{"cdc.inv.products":{"m":"mood","s":"status"}}']
   
   # JDBC query mode
   ErrorCode:[COMMON-21], ErrorDescription:['Postgres' tables unsupported get 
catalog table,the corresponding field types in the following tables are not 
supported: '{"select * from 
inv.products":{"m":"\"inv\".\"mood\"","s":"status"}}']
   
   # CDC with schema-changes.enabled = true, once the catalog path is fixed
   ErrorCode:[COMMON-17], ErrorDescription:['Postgres' unsupported convert type 
'mood' of 'm' to SeaTunnel data type.]
   ```
   
   ### Zeta or Flink or Spark Version
   
   Zeta
   
   ### Java or Scala Version
   
   Java 8, Java 11
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to