Skip to content

[9.3] Fix PostgreSQL IP address serialization error (#3900)#3903

Merged
Apmats merged 2 commits into9.3from
backport/9.3/pr-3900
Jan 12, 2026
Merged

[9.3] Fix PostgreSQL IP address serialization error (#3900)#3903
Apmats merged 2 commits into9.3from
backport/9.3/pr-3900

Conversation

@github-actions
Copy link

Backports the following commits to 9.3:

## Closes #3879

Problem:

The PostgreSQL connector fails with serialization error because asyncpg
returns PostgreSQL's INET and CIDR columns as Python ipaddress module
objects (IPv4Address, IPv6Address, IPv4Network, etc.) rather than
strings. Our serialization layer doesn't handle these types, causing the
connector to crash when attempting to convert documents to JSON.

Solution:

The implementation converts these objects to strings before calling the
parent serializer, which handles standard types. Recursive serialization
handles nested structures (lists/dicts containing IP addresses).
Followed the same pattern from the MongoDB connector.

Only added plain tests for these changes, not ftest coverage. You,
reviewer!, give me an opinion on this!

<!--Provide a general description of the code changes in your pull
request.
If the change relates to a specific issue, include the link at the top.

If this is an ad-hoc/trivial change and does not have a corresponding
issue, please describe your changes in enough details, so that reviewers
and other team members can understand the reasoning behind the pull
request.-->

## Checklists

<!--You can remove unrelated items from checklists below and/or add new
items that may help during the review.-->

#### Pre-Review Checklist
- [x] this PR does NOT contain credentials of any kind, such as API keys
or username/passwords (double check `config.yml.example`)
- [x] this PR has a meaningful title
- [x] this PR links to all relevant github issues that it fixes or
partially addresses
- [ ] if there is no GH issue, please create it. Each PR should have a
link to an issue
- [x] this PR has a thorough description
- [x] Covered the changes with automated tests
- [x] Tested the changes locally
- [x] Added a label for each target release version (example: `v7.13.2`,
`v7.14.0`, `v8.0.0`)
- [x] For bugfixes: backport safely to all minor branches still
receiving patch releases
- [x] Considered corresponding documentation changes
- [x] Contributed any configuration settings changes to the
configuration reference
- [x] if you added or changed Rich Configurable Fields for a Native
Connector, you made a corresponding PR in
[Kibana](https://github.com/elastic/kibana/blob/main/packages/kbn-search-connectors/types/native_connectors.ts)

#### Changes Requiring Extra Attention

<!--Please call out any changes that require special attention from the
reviewers and/or increase the risk to availability or security of the
system after deployment. Remove the ones that don't apply.-->

- [ ] Security-related changes (encryption, TLS, SSRF, etc)
- [ ] New external service dependencies added.

## Related Pull Requests

<!--List any relevant PRs here or remove the section if this is a
standalone PR.

* https://github.com/elastic/.../pull/123-->

## Release Note

<!--If you think this enhancement/fix should be included in the release
notes,
please write a concise user-facing description of the change here.
You should also label the PR with `release_note` so the release notes
author(s) can easily look it up.-->

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@github-actions github-actions bot requested a review from a team as a code owner January 12, 2026 08:10
@Apmats Apmats merged commit 61d2fcb into 9.3 Jan 12, 2026
2 checks passed
@Apmats Apmats deleted the backport/9.3/pr-3900 branch January 12, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants