Skip to content

Comments

Add PostgreSQL Wire Protocol (PGWire) layer#2070

Open
seladb wants to merge 11 commits intodevfrom
pgwire-layer
Open

Add PostgreSQL Wire Protocol (PGWire) layer#2070
seladb wants to merge 11 commits intodevfrom
pgwire-layer

Conversation

@seladb
Copy link
Owner

@seladb seladb commented Feb 20, 2026

This PR adds a new PostgreSQL Wire Protocol Layer (PostgresLayer) to PcapPlusPlus, enabling parsing of PostgreSQL network traffic. This is the protocol used by PostgreSQL clients and servers to communicate over TCP.

This PR only parses the Postgres messages. Creating messages will be done in subsequent PRs

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 92.50000% with 66 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.95%. Comparing base (bcc9ffd) to head (eeb6f8c).

Files with missing lines Patch % Lines
Packet++/src/PostgresLayer.cpp 87.08% 55 Missing ⚠️
Packet++/header/PostgresLayer.h 81.35% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2070      +/-   ##
==========================================
+ Coverage   83.81%   83.95%   +0.13%     
==========================================
  Files         313      316       +3     
  Lines       55676    56556     +880     
  Branches    11606    11971     +365     
==========================================
+ Hits        46665    47479     +814     
- Misses       7810     7890      +80     
+ Partials     1201     1187      -14     
Flag Coverage Δ
alpine320 76.62% <92.75%> (+0.22%) ⬆️
fedora42 76.37% <93.14%> (+0.22%) ⬆️
macos-14 82.09% <89.53%> (+0.11%) ⬆️
macos-15 82.08% <89.53%> (+0.11%) ⬆️
mingw32 70.63% <87.41%> (+0.26%) ⬆️
mingw64 70.54% <87.41%> (+0.26%) ⬆️
npcap 85.49% <84.69%> (-0.03%) ⬇️
rhel94 75.97% <92.38%> (+0.21%) ⬆️
ubuntu2004 59.79% <74.83%> (+0.19%) ⬆️
ubuntu2004-zstd 59.89% <74.83%> (+0.16%) ⬆️
ubuntu2204 75.90% <92.38%> (+0.22%) ⬆️
ubuntu2204-icpx 59.14% <60.92%> (+0.07%) ⬆️
ubuntu2404 76.30% <92.72%> (+0.23%) ⬆️
ubuntu2404-arm64 76.29% <92.68%> (+0.24%) ⬆️
unittest 83.95% <92.50%> (+0.13%) ⬆️
windows-2022 85.49% <84.69%> (-0.01%) ⬇️
windows-2025 85.51% <84.69%> (-0.02%) ⬇️
winpcap 85.72% <84.69%> (-0.02%) ⬇️
xdp 52.44% <92.38%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seladb seladb marked this pull request as ready for review February 22, 2026 07:56
Backend_Unknown,
};

PostgresMessageType() : m_Value(Frontend_Unknown)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can also be marked constexpr.


private:
PostgresMessageOrigin m_MessageOrigin;
mutable std::vector<std::unique_ptr<PostgresMessage>> m_Messages;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why not use PointerVector<PostgresMessage>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants