-
-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: text type representation is not always efficient
For this reason, Postgres allows types to have an external binary representation. Also, some clients insist on using binary representation. Solution: introduce SendRecvFuncs trait and `sendrecvfuncs` attribute These are used to specify how external binary representation encoding is accomplished.
- Loading branch information
Showing
13 changed files
with
426 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Portions Copyright 2019-2021 ZomboDB, LLC. | ||
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <[email protected]> | ||
All rights reserved. | ||
Use of this source code is governed by the MIT license that can be found in the LICENSE file. | ||
*/ | ||
|
||
#[cfg(any(test, feature = "pg_test"))] | ||
#[pgx::pg_schema] | ||
mod tests { | ||
#[allow(unused_imports)] | ||
use crate as pgx_tests; | ||
|
||
use pgx::*; | ||
|
||
#[pg_test] | ||
fn test_string_info_read_full() { | ||
let mut string_info = StringInfo::from(vec![1,2,3,4,5]); | ||
assert_eq!(string_info.read(..), Some(&[1,2,3,4,5][..])); | ||
assert_eq!(string_info.read(..), Some(&[][..])); | ||
assert_eq!(string_info.read(..=1), None); | ||
} | ||
|
||
#[pg_test] | ||
fn test_string_info_read_offset() { | ||
let mut string_info = StringInfo::from(vec![1,2,3,4,5]); | ||
assert_eq!(string_info.read(1..), Some(&[2,3,4,5][..])); | ||
assert_eq!(string_info.read(..), Some(&[][..])); | ||
} | ||
|
||
#[pg_test] | ||
fn test_string_info_read_cap() { | ||
let mut string_info = StringInfo::from(vec![1,2,3,4,5]); | ||
assert_eq!(string_info.read(..=1), Some(&[1][..])); | ||
assert_eq!(string_info.read(1..=2), Some(&[3][..])); | ||
assert_eq!(string_info.read(..), Some(&[4,5][..])); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.