Skip to content

Composite and multi-dim Array Type Support for PG Replication Client #1359

@peterxcli

Description

@peterxcli

Summary

Currently, some pg type for example like Composite and Array Composite will fail cause:

// Fail fast on any type that we are not able to parse in try_from_str.
let typ = Type::from_oid(type_oid).ok_or_else(|| {
ReplicationClientError::UnsupportedType(
name.clone(),
type_oid,
table_name.to_string(),
)
})?;


In addition, the multi-dim Array is also rejected cause the check:

let attndims: i32 = row
.try_get("attndims")?
.ok_or(ReplicationClientError::MissingColumn(
"attndims".to_string(),
"pg_attribute".to_string(),
))?
.parse()
.map_err(|_| ReplicationClientError::TypeModifierColumnNotI32)?;
if matches!(typ.kind(), Kind::Array(_)) && attndims > 1 {
return Err(ReplicationClientError::UnsupportedType(
name.clone(),
type_oid,
table_name.to_string(),
));
}

Context

Why is this issue important? Link any relevant discussions, designs, or documents.

Tasks

  • Composite support
  • Array of Composite support
  • Nested Array in Composite's field
  • Nested Composite
  • Array of Array support (multi-dim array)

Notes

I got a draft patch which aims to add integration testing of pg row parsing and try to make PG Replication Client to support Composite and Array of Composite:
https://github.com/Mooncake-Labs/moonlink/compare/main...peterxcli:feat/support-customize-type-in-pg-replication-client?expand=1

Remember to follow the type matching rule introduced in #1301 or its following...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions