Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-9086

Postgres Reselector fails on serial primary keys

XMLWordPrintable

      As part of https://issues.redhat.com/browse/DBZ-8277, the Postgres reselect behavior was changed to explicitly cast the value to the column type (here).

      This has a side effect of breaking the reselector for any tables that use a serial primary key, because it produces queries such as:

      SELECT "toast_column" FROM "public"."my_table" WHERE id=1::serial 

      And as serial is a notational convenience and not a true type, it raises an error:

      org.postgresql.util.PSQLException: ERROR: type "serial" does not exist 

      PostgresReselectColumnsProcessorIT creates tables with integer primary keys such as:

      CREATE TABLE s1.dbz4321_toast (id int primary key, data text, data2 int); 

      which allows tests to pass, but if you change the syntax to use serial instead, the test fails.

      serial, smallserial, and bigserial should be cast to their corresponding types of int4, int2, and int8.

              Unassigned Unassigned
              jasonspeck Jason Speck (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: