GitHub user Iam-WenYi edited a discussion: Can't use postgresql-service
### Describe the bug The example code gived in postgresql's service markfodown document can't run. <!-- Uploading "微信图片_2025-04-05_190044_247.png"... --> <!-- Uploading "微信图片_2025-04-05_190040_526.png"... --> <!-- Uploading "微信图片_2025-04-05_190036_206.png"... --> <!-- Uploading "微信图片_2025-04-05_190031_271.png"... --> <!-- Uploading "微信图片_2025-04-05_190025_294.png"... --> <!-- Uploading "微信图片_2025-04-05_190016_094.png"... --> ### Steps to Reproduce 1. Make a copy of `ofs` directory, rename to `postgresql-opendal-try/` 2. Chanage Cargo.toml to this: ```toml # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. [package] categories = ["postgresql-service-example"] description = "OpenDAL PostgreSQL Service Example" keywords = ["storage", "data", "postgresql"] name = "postgresql-service-example" version = "0.0.1" authors = ["Wen Yi <[email protected]>"] edition = "2021" homepage = "https://opendal.apache.org/" license = "Apache-2.0" repository = "https://github.com/apache/opendal" rust-version = "1.80" [dependencies] anyhow = { version = "1" } clap = { version = "4.5.21", features = ["derive", "env"] } log = { version = "0.4.22" } logforth = { version = "0.23.1", default-features = false } opendal = { version = "0.53.0", path = "../../core" } tokio = { version = "1.37.0", features = [ "fs", "macros", "rt-multi-thread", "io-std", "signal", ] } url = { version = "2.5.4" } [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))'.dependencies] fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } fuse3_opendal = { version = "0.0.14", path = "../../integrations/fuse3" } libc = "0.2.154" nix = { version = "0.29.0", features = ["user"] } [target.'cfg(target_os = "windows")'.dependencies] cloud-filter = { version = "0.0.5" } cloud_filter_opendal = { version = "0.0.7", path = "../../integrations/cloud_filter" } [features] default = ["services-fs", "services-s3"] services-fs = ["opendal/services-fs"] services-s3 = ["opendal/services-s3"] [dev-dependencies] opendal = { version = "0.53.0", path = "../../core", features = ["tests"] } tempfile = "3.16.0" test-context = "0.4.1" walkdir = "2.5.0" ``` 3. Change main.rs to this: ```rust use anyhow::Result; use opendal::services::Postgresql; use opendal::Operator; #[tokio::main] async fn main() -> Result<()> { let mut builder = Postgresql::default() .root("/") .connection_string("postgresql://you_username:[email protected]:5432/your_database") .table("your_table") // key field type in the table should be compatible with Rust's &str like text .key_field("key") // value field type in the table should be compatible with Rust's Vec<u8> like bytea .value_field("value"); let op = Operator::new(builder)?.finish(); Ok(()) } ``` 4. Cargo build  ### Expected Behavior I want to use the OpenDAL to connect to the postgresql, but I can't ### Additional Context _No response_ ### Are you willing to submit a PR to fix this bug? - [ ] Yes, I would like to submit a PR. GitHub link: https://github.com/apache/opendal/discussions/5961 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
