Skip to content

Commit

Permalink
fix parse message encode (#219)
Browse files Browse the repository at this point in the history
currently when try encode parse message it return incorrect message length because miss to count Int16 len of type_oids array

for example for `SELECT 7`, we got next body:

[80, 0, 0, 0, 16, 115, 48, 0, 83, 69, 76, 69, 67, 84, 32, 55, 0, 0, 0]

but expected:

[80, 0, 0, 0, 18, 115, 48, 0, 83, 69, 76, 69, 67, 84, 32, 55, 0, 0, 0]
  • Loading branch information
tbicr authored Nov 27, 2024
1 parent 9a4aa0e commit a033265
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/messages/extendedquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Message for Parse {
fn message_length(&self) -> usize {
4 + codec::option_string_len(&self.name) // name
+ (1 + self.query.len()) // query
+ (4 * self.type_oids.len()) // type oids
+ 2 + (4 * self.type_oids.len()) // type oids
}

fn encode_body(&self, buf: &mut bytes::BytesMut) -> PgWireResult<()> {
Expand Down

0 comments on commit a033265

Please sign in to comment.