#postgresql #database-server #embedded-database #server #embedded

postgresql_commands

PostgreSQL commands for interacting with a PostgreSQL server

33 releases (10 breaking)

Uses new Rust 2024

0.18.2 Mar 21, 2025
0.17.5 Jan 28, 2025
0.17.3 Nov 12, 2024
0.14.2 Jul 17, 2024

#1094 in Database interfaces

Download history 764/week @ 2024-12-07 1571/week @ 2024-12-14 344/week @ 2024-12-21 357/week @ 2024-12-28 1015/week @ 2025-01-04 862/week @ 2025-01-11 979/week @ 2025-01-18 1189/week @ 2025-01-25 1310/week @ 2025-02-01 1646/week @ 2025-02-08 1577/week @ 2025-02-15 2329/week @ 2025-02-22 2241/week @ 2025-03-01 1536/week @ 2025-03-08 1598/week @ 2025-03-15 1534/week @ 2025-03-22

7,318 downloads per month
Used in 15 crates (3 directly)

(Apache-2.0 OR MIT) AND PostgreSQL

405KB
11K SLoC

PostgreSQL Commands

ci Documentation Code Coverage Latest version License Semantic Versioning

A library for executing PostgreSQL command line utilities.

Examples

use postgresql_commands::Result;
use postgresql_commands::psql::PsqlBuilder;

fn main() -> Result<()> {
    let psql = PsqlBuilder::new()
        .command("CREATE DATABASE \"test\"")
        .host("127.0.0.1")
        .port(5432)
        .username("postgresql")
        .pg_password("password")
        .build();

    let (stdout, stderr) = psql.execute()?;
    Ok(())
}

Feature flags

The following features are available:

Name Description Default?
tokio Enables the use of tokio commands No

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.6–7MB
~44K SLoC