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

postgresql_commands

PostgreSQL commands for interacting with a PostgreSQL server

40 releases

Uses new Rust 2024

0.20.0 Aug 31, 2025
0.19.0 Jun 24, 2025
0.18.7 Jun 20, 2025
0.18.2 Mar 21, 2025
0.14.2 Jul 17, 2024

#400 in Database interfaces

Download history 22812/week @ 2025-08-19 19198/week @ 2025-08-26 25591/week @ 2025-09-02 21914/week @ 2025-09-09 31200/week @ 2025-09-16 25009/week @ 2025-09-23 29997/week @ 2025-09-30 26807/week @ 2025-10-07 34194/week @ 2025-10-14 33209/week @ 2025-10-21 28162/week @ 2025-10-28 33699/week @ 2025-11-04 28129/week @ 2025-11-11 36704/week @ 2025-11-18 23318/week @ 2025-11-25 29699/week @ 2025-12-02

123,818 downloads per month
Used in 23 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.5–4MB
~77K SLoC