#protocol #postgresql #postgres #database

yanked pg_wire

Server Side implementation of PostgreSQL Wire Protocol

10 releases (breaking)

0.8.1 Apr 11, 2021
0.7.0 Mar 19, 2021
0.5.0 Nov 7, 2020

#18 in #postgresql

Download history 52/week @ 2021-01-01 16/week @ 2021-01-08 53/week @ 2021-01-15 27/week @ 2021-01-22 129/week @ 2021-01-29 156/week @ 2021-02-05 191/week @ 2021-02-12 8/week @ 2021-02-19 51/week @ 2021-02-26 61/week @ 2021-03-05 42/week @ 2021-03-12 91/week @ 2021-03-19 16/week @ 2021-03-26 17/week @ 2021-04-02 67/week @ 2021-04-09 40/week @ 2021-04-16

288 downloads per month

Apache-2.0

165KB
3.5K SLoC

PostgreSQL Wire Protocol

ci Coverage Status

The crate supports:

  • tokio runtime,
  • smol runtimes. Actually, it depends on async-io on which smol is based.

Add this to you Cargo.toml if you want to use it with tokio runtime

pg_wire = { version = "0.9.0", features = ["tokio_net"] }

Add this to you Cargo.toml if you want to enable smol runtime support

pg_wire = { version = "0.9.0", features = ["async_io"] }

Examples

Using smol runtime

Open your terminal and run the following command:

cargo run --example smol_server --features async_io

Open another terminal window and run:

psql -h 127.0.0.1 -U postgres -p 5432 -W

Enter any password The server always handles select 1 SQL query

Using tokio runtime

Open your terminal and run the following command:

cargo run --example tokio_server --features tokio_net

Open another terminal window and run:

psql -h 127.0.0.1 -U postgres -p 5432 -W

Enter any password The server always handles select 1 SQL query

Secured smol runtime

Open your terminal and run the following command:

cargo run --example secured_smol_server --features async_io

Open another terminal window and run:

psql -h 127.0.0.1 -U postgres -p 5432 -W

Enter any password After that in the console you should see something like

psql (13.2, server 12.4)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

postgres=> select 3;
 col1
------
    1
(1 row)

postgres=>

The server always handles select 1 SQL query

Dependencies

~0.8–2MB
~36K SLoC