-
-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy_out with BINARY on ltree type has a single hex char prefix #960
Comments
That is part of the binary encoding of the ltree type. https://github.com/sfackler/rust-postgres/blob/master/postgres-protocol/src/types/mod.rs#L1063-L1080 |
I see. Could there be a Postgres Type Ltree in the |
It can already be converted to and from Rust strings. |
Please correct me if I'm wrong. Base on my understanding, Is there anything that I'm missing? The code for getting the printed value |
I can't reproduce that behavior. This test: #[test]
fn binary_copy_ltree() {
let mut client = Client::connect("host=localhost port=5433 user=postgres", NoTls).unwrap();
client
.batch_execute(
"
CREATE TEMPORARY TABLE foo (a ltree);
INSERT INTO foo (a) VALUES ('A.B.C.D'), ('A.B.E'), ('A');
",
)
.unwrap();
let stmt = client.prepare("SELECT a FROM foo").unwrap();
let reader = client.copy_out("COPY foo TO STDOUT BINARY").unwrap();
let mut it = BinaryCopyOutIter::new(reader, &[stmt.columns()[0].type_().clone()]);
while let Some(row) = it.next().unwrap() {
println!("{:?}", row.get::<Option<&str>>(0));
}
} Prints this when run:
|
The return value using


copy_out
withBINARY
has this single hex char prefix for ltree type:which does not happen in
copy_out
withCSV
orquery_raw
Notice here:
sfu-db/connector-x#382 (comment)
Thanks to @wangxiaoying
The text was updated successfully, but these errors were encountered: