Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
2c83be7
Document type conversion fix for WHERE...IN clauses
Jun 12, 2020
6de0fce
Add jiff support
allan2 Jul 22, 2024
df2f37d
Remove unecessary alias for Timestamp
allan2 Jul 23, 2024
f00d208
Update impl for Timestamp
allan2 Jul 23, 2024
815a5d3
Remove impl for `Zoned`
allan2 Jul 23, 2024
e19b3dc
Rename PG_EPOCH
allan2 Aug 14, 2024
c96342d
Fix ToSql
allan2 Aug 14, 2024
afef88e
Add jiff tests and overflow checks
allan2 Aug 15, 2024
bc9102c
Remove `Zoned` from docs
allan2 Aug 15, 2024
5b26b5d
Fix `chrono::DateTime<Utc>` tests
allan2 Aug 15, 2024
2e6b7df
Merge pull request #1170 from allan2/chrono-test
sfackler Aug 16, 2024
6fd0444
Merge pull request #1164 from allan2/jiff
sfackler Aug 18, 2024
b1ace91
Release postgres-derive v0.4.6
sfackler Sep 16, 2024
776ea30
Release postgres-types v0.2.8
sfackler Sep 16, 2024
8d08adb
Release tokio-postgres v0.7.12
sfackler Sep 16, 2024
6ae17e0
Release postgres v0.19.9
sfackler Sep 16, 2024
60c1182
feat: add ssl_negotiation option
sunng87 Jul 5, 2024
6a6fdb9
test: updte tests for direct tls
sunng87 Jul 6, 2024
9441ce1
feat: provide built-in functions for setting ALPN
sunng87 Jul 6, 2024
cfdc66f
refactor: pub use sslnegotiation
sunng87 Jul 6, 2024
db308ef
refactor: apply review comments
sunng87 Jul 7, 2024
331e968
chore: update postgres for ci
sunng87 Sep 27, 2024
eea7f13
Add support for cidr 0.3 under separate feature
rs-sac Oct 25, 2024
113d410
fix fromsql for domains
zacknewman Nov 20, 2024
cc17f8e
add test for composite in domain in composite
zacknewman Nov 22, 2024
7eb6f8e
add `load_balance_hosts` to `Debug` impl for `Config`
Dec 18, 2024
d7ccc7e
Merge pull request #1195 from kamulos/master
sfackler Dec 18, 2024
76a1637
Fix time 0.3 infinity panics
allan2 Jan 20, 2025
24d3234
Fix clippy needless_lifetimes
allan2 Jan 20, 2025
7046518
Fix clippy extra_unused_lifetimes
allan2 Jan 20, 2025
b13052a
Fix for Rust 2024 match ergonomics
allan2 Jan 20, 2025
4d03ed8
Fix another needless_lifetimes
allan2 Jan 20, 2025
7490e51
Fix clippy needless_borrowed_reference
allan2 Jan 20, 2025
852ae49
Bump CI Rust version to 1.75.0
allan2 Jan 20, 2025
66622f3
Bump actions/checkout
allan2 Jan 20, 2025
07b6878
Merge pull request #1199 from allan2/ci-update-rust-version
sfackler Jan 20, 2025
0a25fd1
Empty commit (re-run CI)
allan2 Jan 20, 2025
e00ceb1
Update rand requirement from 0.8 to 0.9
dependabot[bot] Jan 28, 2025
96f2347
refactor: address review comments
sunng87 Jan 30, 2025
02463b1
chore: addressed rand 0.9's deprecations
kristof-mattei Feb 1, 2025
14a1216
fix build
sfackler Feb 2, 2025
720ffe8
fix clippy
sfackler Feb 2, 2025
c104b23
Merge pull request #1151 from sunng87/feature/ssl-negotiation
sfackler Feb 2, 2025
778611c
Merge remote-tracking branch 'origin/master' into fix-rand-0.9-deprec…
sfackler Feb 2, 2025
acd17ed
fix wasm build
sfackler Feb 2, 2025
0d18b95
bump getrandom
sfackler Feb 2, 2025
f1c5c4f
Merge pull request #1205 from kristof-mattei/fix-rand-0.9-deprecations
sfackler Feb 2, 2025
1a9abac
Merge remote-tracking branch 'origin/master' into time-overflow
sfackler Feb 2, 2025
9754f13
Revert time 0.2 change
sfackler Feb 2, 2025
924d0e5
Merge pull request #1197 from allan2/time-overflow
sfackler Feb 2, 2025
263fb90
Merge pull request #1198 from allan2/clippy
sfackler Feb 2, 2025
0785381
Merge pull request #1183 from rs-sac/upstream
sfackler Feb 2, 2025
89b91b4
Propagate features
sfackler Feb 2, 2025
bfb35b2
add docs
sfackler Feb 2, 2025
a5eaea1
fix ci
sfackler Feb 2, 2025
7ee61f3
Merge pull request #1207 from sfackler/cidr-fixes
sfackler Feb 2, 2025
14f3b9e
Release postgres-native-tls v0.5.1
sfackler Feb 2, 2025
1ed6365
Release postgres-openssl v0.5.1
sfackler Feb 2, 2025
966724c
Release postgres-protocol v0.6.8
sfackler Feb 2, 2025
43c7049
Release postgres-types v0.2.9
sfackler Feb 2, 2025
ad68abf
Release tokio-postgres v0.7.13
sfackler Feb 2, 2025
bfe5b9d
Release postgres v0.19.10
sfackler Feb 2, 2025
5c56e5e
Fix typo in version in postgres’s changelog
charmander Feb 3, 2025
1e1f6bf
Merge pull request #1208 from charmander/patch-2
sfackler Feb 3, 2025
c867352
Only call set_tcp_user_timeout when enabled
sfackler Feb 12, 2025
cd8a341
feat: support jiff v0.2
Feb 12, 2025
3469ab0
WIP
Feb 12, 2025
4c2ded1
Merge pull request #1215 from sfackler/wsl1
sfackler Feb 14, 2025
ddea059
WIP
Feb 15, 2025
7fe6797
WIP
Feb 15, 2025
0e1d04c
WIP
Feb 15, 2025
e26ebf5
WIP
Feb 15, 2025
3d3705c
WIP
Feb 16, 2025
7b8d796
WIP
Feb 16, 2025
490c485
Merge pull request #1217 from NOBLES5E/master
sfackler Feb 17, 2025
a23036e
Add support for bit-vec 0.7 & 0.8
crusopaul Feb 22, 2025
20f19f3
docs([tokio-]postgres/config): fix examples for unix socket paths
transcaffeine Mar 2, 2025
8488a46
fix: properly announce connection closure during error
conradludgate Mar 25, 2025
720897d
feat: add support for quick active health checks on connections
conradludgate Mar 25, 2025
e4be50d
feat: add is_really_closed feature to non-async postgres lib
conradludgate Mar 26, 2025
7d52522
expose sync rollback as a private api method
fredr Apr 2, 2025
20f6bc5
Fix latest clippy warnings
paolobarbolini Apr 11, 2025
2098ac2
Merge pull request #1234 from paolobarbolini/clippy
sfackler Apr 11, 2025
377d84b
fix test - call the correct method
MustardForBreakfast May 2, 2025
e89059f
add missing documentation for the with-cidr-0_3 feature flag
MustardForBreakfast May 2, 2025
ecd7a9f
Remove random `dbg!`s
SabrinaJewson May 19, 2025
9dad65e
Merge pull request #1241 from SabrinaJewson/remove-dbg
sfackler May 19, 2025
9ca90fe
Update criterion requirement from 0.5 to 0.6
dependabot[bot] May 19, 2025
e1cd6be
Merge pull request #1242 from sfackler/dependabot/cargo/criterion-0.6
sfackler May 19, 2025
236a791
Remove mentions of require-full and require-ca
maxammann Jun 25, 2025
ad78c1d
Update criterion requirement from 0.6 to 0.7
dependabot[bot] Jul 25, 2025
e9fcd3e
Update to socket2 v0.6
Thomasdezeeuw Sep 17, 2025
afb0546
Merge pull request #619 from AndiDog/where-in-clause
paolobarbolini Sep 20, 2025
75503c8
Merge pull request #1252 from maxammann/patch-2
paolobarbolini Sep 20, 2025
9d65461
style: fix broken rustfmt
paolobarbolini Sep 20, 2025
5d5b890
Merge pull request #1237 from MustardForBreakfast/jw/test-doc-fix
paolobarbolini Sep 20, 2025
97ec60d
Merge pull request #1221 from crusopaul/master
paolobarbolini Sep 20, 2025
b4707a9
Replace parts of `futures-util` with std APIs
paolobarbolini Apr 11, 2025
406b932
Merge pull request #1233 from paolobarbolini/less-futures-crate
paolobarbolini Sep 20, 2025
2f29071
Disable default features of `futures-util`
paolobarbolini Jun 1, 2025
f81adfa
Merge pull request #1243 from paolobarbolini/futures-util-no-default-…
paolobarbolini Sep 20, 2025
d7eed3b
Upgrade `phf*` to v0.12
paolobarbolini Jun 19, 2025
0bf9358
Upgrade `phf*` to v0.13
paolobarbolini Aug 23, 2025
3836ca8
Merge pull request #1247 from paolobarbolini/phf-bump
paolobarbolini Sep 20, 2025
e2cc7be
style: fix latest clippy warnings
paolobarbolini Jul 2, 2025
13f394f
style: remove 3 manual checked `i64` -> `i32` conversions
paolobarbolini Jul 2, 2025
028a3c7
style: remove unnecessary use of `format_args!`
paolobarbolini Jul 2, 2025
01bbb5d
Merge pull request #1255 from Thomasdezeeuw/update-socket2
paolobarbolini Sep 20, 2025
2d4f12a
Merge pull request #1254 from paolobarbolini/clippy
paolobarbolini Sep 20, 2025
9e6dd65
fix(derive): add `dyn` to boxed trait object
paolobarbolini Jun 1, 2025
7e741da
build: upgrade to 2021 edition
paolobarbolini Jun 1, 2025
d82fe80
build: stop importing types that are part of the 2021 edition prelude
paolobarbolini Jun 1, 2025
6e09cac
Merge pull request #1244 from paolobarbolini/2021-edition
paolobarbolini Sep 20, 2025
48f2ec4
Derive `Serialize` and `Deserialize` for `JSON`
die-herdplatte Sep 15, 2025
c137cf4
Merge pull request #1268 from die-herdplatte/json-derives
paolobarbolini Sep 20, 2025
56e0e44
build(tokio-postgres): drop unused `serde` dev-dependency
paolobarbolini Sep 20, 2025
7d1b4bc
build(postgres-types): switch `serde` to `serde_core`
paolobarbolini Sep 20, 2025
2bcdfd6
Merge pull request #1270 from paolobarbolini/small-serde
paolobarbolini Sep 20, 2025
735ae5b
build: improve -Zminimal-versions support
paolobarbolini Sep 20, 2025
862a29c
Merge pull request #1271 from paolobarbolini/improve-z-minimal-versions
paolobarbolini Sep 20, 2025
2ad76a8
Merge pull request #1260 from rust-postgres/dependabot/cargo/criterio…
paolobarbolini Sep 20, 2025
805ddb7
chore(ci): upgrade actions/checkout to v5 and actions/cache to v4
paolobarbolini Sep 20, 2025
96ef3d8
chore: update GitHub links to rust-postgres org
paolobarbolini Sep 20, 2025
25c169e
style: replace manual bounds checks with `slice::split_at_checked`
paolobarbolini Sep 20, 2025
ddb3e43
style: replace intermediate array and `copy_from_slice` with direct a…
paolobarbolini Sep 20, 2025
b0ac0a2
chore: add rust-version field to Cargo.toml
paolobarbolini Sep 20, 2025
861736e
chore: remove circle-ci badges
paolobarbolini Sep 20, 2025
dd291a4
Merge pull request #1189 from zacknewman/master
paolobarbolini Sep 21, 2025
a6fd520
Merge pull request #1272 from paolobarbolini/chores
paolobarbolini Sep 21, 2025
bb7e0d0
Merge pull request #1225 from transcaffeine/master
paolobarbolini Sep 21, 2025
f4edb08
reorder private api functions
fredr Sep 22, 2025
fc27042
Merge pull request #1230 from fredr/sync-rollback
paolobarbolini Sep 22, 2025
1ea9938
Use #[project(!Unpin)] instead of PhantomPinned
goffrie Jun 27, 2025
2cd684c
Merge pull request #1253 from goffrie/unpin
paolobarbolini Sep 22, 2025
4c3390f
Re-export FallibleIterator from tokio-postgres
duarten Jun 19, 2025
dfcb6af
Merge pull request #1248 from duarten/duarte/fallible-rexport
paolobarbolini Sep 22, 2025
6811c01
chore(tokio-postgres): regenerate `SQLSTATE_MAP`
paolobarbolini Sep 24, 2025
8364bb2
Merge pull request #1274 from rust-postgres/paolobarbolini/regen-sql-…
paolobarbolini Sep 24, 2025
6add4c2
chore(ci): switch to dtolnay/rust-toolchain
paolobarbolini Sep 25, 2025
429b76b
Merge pull request #1275 from rust-postgres/paolobarbolini/switch-to-…
paolobarbolini Sep 25, 2025
a6a0d53
Release postgres-derive v0.4.7
paolobarbolini Sep 24, 2025
cb2ba1c
Release postgres-protocol v0.6.9
paolobarbolini Sep 24, 2025
683a306
Release postgres-types v0.2.10
paolobarbolini Sep 24, 2025
53a929e
Release tokio-postgres v0.7.14
paolobarbolini Sep 24, 2025
6226d7c
Release postgres-openssl v0.5.2
paolobarbolini Sep 24, 2025
b209505
Release postgres-native-tls v0.5.2
paolobarbolini Sep 24, 2025
d2c4cde
Release postgres v0.19.11
paolobarbolini Sep 24, 2025
aca40b5
feat(postgres-types): disable default features of `jiff`
paolobarbolini Sep 25, 2025
a7a49a9
Merge pull request #1276 from rust-postgres/paolobarbolini/jiff-no-de…
paolobarbolini Sep 25, 2025
74385b8
Update client.rs
razein97 Oct 1, 2025
65920b8
Merge pull request #1229 from neondatabase/fix-connection-closure
paolobarbolini Oct 5, 2025
f46e0e0
doc: improve `check_connection` doc comment
paolobarbolini Oct 5, 2025
2393b34
chore: start testing with PostgreSQL 18
paolobarbolini Oct 5, 2025
e128d4c
feat: disable default features of `futures-util` for `postgres`
paolobarbolini Oct 5, 2025
153b86e
Merge pull request #1281 from rust-postgres/paolobarbolini/pg-18
paolobarbolini Oct 5, 2025
bbd1301
Merge pull request #1282 from rust-postgres/paolobarbolini/futures-ut…
paolobarbolini Oct 5, 2025
c5d3442
fix an Error/Display impl
CobaltCause Aug 16, 2025
f34ed1b
Merge pull request #1262 from CobaltCause/push-sswwslomtkmm
paolobarbolini Oct 7, 2025
628a696
Merge pull request #1280 from rust-postgres/paolobarbolini/check_conn…
paolobarbolini Oct 7, 2025
87ef8ad
Merge pull request #1278 from razein97/master
paolobarbolini Oct 8, 2025
6ed4781
Release postgres-types v0.2.11
paolobarbolini Oct 8, 2025
4737438
Release tokio-postgres v0.7.15
paolobarbolini Oct 8, 2025
81d39c5
Release postgres v0.19.12
paolobarbolini Oct 8, 2025
9bbe5ae
chore: fix generic-array deprecation warning
paolobarbolini Oct 15, 2025
6dc46a3
add public method to get the raw row size in bytes
tom-eon Oct 15, 2025
1c0c1bd
Merge pull request #1286 from tom-eon/row-raw-size
paolobarbolini Oct 27, 2025
3d12163
Implement ToSql for Box<T: ToSql>
jonasrichard Nov 13, 2025
cdf0187
Merge pull request #1293 from jonasrichard/tosql-boxed-t
paolobarbolini Nov 16, 2025
008595f
chore(ci): upgrade actions/checkout to v6
paolobarbolini Nov 21, 2025
ebdaa0b
chore: reflect with-jiff-0_2 feature in docs
JakubKoralewski Nov 22, 2025
df41772
Merge pull request #1297 from JakubKoralewski/patch-2
paolobarbolini Nov 22, 2025
8efd8bd
Merge remote-tracking branch 'origin/master' into HEAD
petrosagg Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,90 +17,95 @@ jobs:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sfackler/actions/rustup@master
- uses: sfackler/actions/rustfmt@master
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sfackler/actions/rustup@master
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
id: rust-version
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/index
key: index-${{ runner.os }}-${{ github.run_number }}
restore-keys: |
index-${{ runner.os }}-
- run: cargo generate-lockfile
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/cache
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: target
key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo clippy --all --all-targets

check-wasm32:
name: check-wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sfackler/actions/rustup@master
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
id: rust-version
- run: rustup target add wasm32-unknown-unknown
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/index
key: index-${{ runner.os }}-${{ github.run_number }}
restore-keys: |
index-${{ runner.os }}-
- run: cargo generate-lockfile
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/cache
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: target
key: check-wasm32-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo check --target wasm32-unknown-unknown --manifest-path tokio-postgres/Cargo.toml --no-default-features --features js
env:
RUSTFLAGS: --cfg getrandom_backend="wasm_js"

test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- run: docker compose up -d
- uses: sfackler/actions/rustup@master
with:
version: 1.77.0
- uses: dtolnay/rust-toolchain@1.81.0
- run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
id: rust-version
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/index
key: index-${{ runner.os }}-${{ github.run_number }}
restore-keys: |
index-${{ runner.os }}-
- run: cargo generate-lockfile
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cargo/registry/cache
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: target
key: test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
key: test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo test --all
- run: cargo test --manifest-path tokio-postgres/Cargo.toml --no-default-features
- run: cargo test --manifest-path tokio-postgres/Cargo.toml --all-features
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Steven Fackler <sfackler@gmail.com>"]

[dependencies]
phf_codegen = "0.11"
phf_codegen = "0.13"
regex = "1.0"
marksman_escape = "0.1"
linked-hash-map = "0.5"
8 changes: 2 additions & 6 deletions codegen/src/sqlstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn make_code(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<Fi
file,
r#"
Inner::E{code} => "{code}","#,
code = code,
)
.unwrap();
}
Expand All @@ -97,8 +96,6 @@ fn make_consts(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<
/// {code}
pub const {name}: SqlState = SqlState(Inner::E{code});
"#,
name = name,
code = code,
)
.unwrap();
}
Expand All @@ -121,8 +118,7 @@ enum Inner {{"#,
write!(
file,
r#"
E{},"#,
code,
E{code},"#,
)
.unwrap();
}
Expand All @@ -139,7 +135,7 @@ enum Inner {{"#,
fn make_map(codes: &LinkedHashMap<String, Vec<String>>, file: &mut BufWriter<File>) {
let mut builder = phf_codegen::Map::new();
for (code, names) in codes {
builder.entry(&**code, &format!("SqlState::{}", &names[0]));
builder.entry(&**code, format!("SqlState::{}", &names[0]));
}
write!(
file,
Expand Down
10 changes: 5 additions & 5 deletions codegen/src/type_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,18 @@ fn parse_types() -> BTreeMap<u32, Type> {
let doc_name = array_re.replace(&name, "$1[]").to_ascii_uppercase();
let mut doc = doc_name.clone();
if let Some(descr) = raw_type.get("descr") {
write!(doc, " - {}", descr).unwrap();
write!(doc, " - {descr}").unwrap();
}
let doc = Escape::new(doc.as_bytes().iter().cloned()).collect();
let doc = String::from_utf8(doc).unwrap();

if let Some(array_type_oid) = raw_type.get("array_type_oid") {
let array_type_oid = array_type_oid.parse::<u32>().unwrap();

let name = format!("_{}", name);
let variant = format!("{}Array", variant);
let doc = format!("{}&#91;&#93;", doc_name);
let ident = format!("{}_ARRAY", ident);
let name = format!("_{name}");
let variant = format!("{variant}Array");
let doc = format!("{doc_name}&#91;&#93;");
let ident = format!("{ident}_ARRAY");

let type_ = Type {
name,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
postgres:
image: postgres:14
image: docker.io/postgres:18
ports:
- 5433:5433
volumes:
Expand Down
2 changes: 1 addition & 1 deletion postgres-derive-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "postgres-derive-test"
version = "0.1.0"
authors = ["Steven Fackler <sfackler@gmail.com>"]
edition = "2018"
edition = "2021"

[dev-dependencies]
trybuild = "1.0"
Expand Down
33 changes: 33 additions & 0 deletions postgres-derive-test/src/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,36 @@ fn domain_in_composite() {
)],
);
}

#[test]
fn composite_in_domain_in_composite() {
#[derive(FromSql, ToSql, Debug, PartialEq)]
#[postgres(name = "leaf_composite")]
struct LeafComposite {
prim: i32,
}

#[derive(FromSql, ToSql, Debug, PartialEq)]
#[postgres(name = "domain")]
struct Domain(LeafComposite);

#[derive(FromSql, ToSql, Debug, PartialEq)]
#[postgres(name = "root_composite")]
struct RootComposite {
domain: Domain,
}

let mut conn = Client::connect("user=postgres host=localhost port=5433", NoTls).unwrap();
conn.batch_execute("CREATE TYPE leaf_composite AS (prim integer); CREATE DOMAIN domain AS leaf_composite; CREATE TYPE root_composite AS (domain domain);").unwrap();

test_type(
&mut conn,
"root_composite",
&[(
RootComposite {
domain: Domain(LeafComposite { prim: 1 }),
},
"ROW(ROW(1))",
)],
);
}
4 changes: 2 additions & 2 deletions postgres-derive-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ where
let result = conn.query_one(&stmt, &[]).unwrap().get(0);
assert_eq!(val, &result);

let stmt = conn.prepare(&format!("SELECT $1::{}", sql_type)).unwrap();
let stmt = conn.prepare(&format!("SELECT $1::{sql_type}")).unwrap();
let result = conn.query_one(&stmt, &[val]).unwrap().get(0);
assert_eq!(val, &result);
}
Expand All @@ -45,7 +45,7 @@ pub fn test_type_asymmetric<T, F, S, C>(
let result: F = conn.query_one(&stmt, &[]).unwrap().get(0);
assert!(cmp(val, &result));

let stmt = conn.prepare(&format!("SELECT $1::{}", sql_type)).unwrap();
let stmt = conn.prepare(&format!("SELECT $1::{sql_type}")).unwrap();
let result: F = conn.query_one(&stmt, &[val]).unwrap().get(0);
assert!(cmp(val, &result));
}
Expand Down
21 changes: 21 additions & 0 deletions postgres-derive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Change Log

## v0.4.7 - 2025-09-25

### Added

* Added support for nested domains containing composite types to `FromSql`

### Fixed

* Added `dyn` keyword to boxed trait objects.

### Changed

* Updated repository links to use `rust-postgres` organization.
* Upgraded to Rust 2021 edition.

## v0.4.6 - 2024-09-15

### Changed

* Upgraded `heck`.

## v0.4.5 - 2023-08-19

### Added
Expand Down
7 changes: 4 additions & 3 deletions postgres-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "postgres-derive"
version = "0.4.5"
version = "0.4.7"
authors = ["Steven Fackler <sfackler@palantir.com>"]
license = "MIT OR Apache-2.0"
edition = "2018"
edition = "2021"
description = "An internal crate used by postgres-types"
repository = "https://github.com/sfackler/rust-postgres"
repository = "https://github.com/rust-postgres/rust-postgres"
rust-version = "1.81"

[lib]
proc-macro = true
Expand Down
5 changes: 4 additions & 1 deletion postgres-derive/src/fromsql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ fn domain_accepts_body(name: &str, field: &syn::Field) -> TokenStream {
fn domain_body(ident: &Ident, field: &syn::Field) -> TokenStream {
let ty = &field.ty;
quote! {
<#ty as postgres_types::FromSql>::from_sql(_type, buf).map(#ident)
<#ty as postgres_types::FromSql>::from_sql(match *_type.kind() {
postgres_types::Kind::Domain(ref _type) => _type,
_ => _type
}, buf).map(#ident)
}
}

Expand Down
2 changes: 1 addition & 1 deletion postgres-derive/src/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Overrides {
"invalid rename_all rule, expected one of: {}",
RENAME_RULES
.iter()
.map(|rule| format!("\"{}\"", rule))
.map(|rule| format!("\"{rule}\""))
.collect::<Vec<_>>()
.join(", ")
),
Expand Down
6 changes: 3 additions & 3 deletions postgres-derive/src/tosql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ pub fn expand_derive_tosql(input: DeriveInput) -> Result<TokenStream, Error> {
let generics = append_generic_bound(input.generics.to_owned(), &new_tosql_bound());
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
let out = quote! {
impl#impl_generics postgres_types::ToSql for #ident#ty_generics #where_clause {
impl #impl_generics postgres_types::ToSql for #ident #ty_generics #where_clause {
fn to_sql(&self,
_type: &postgres_types::Type,
buf: &mut postgres_types::private::BytesMut)
-> std::result::Result<postgres_types::IsNull,
std::boxed::Box<std::error::Error +
std::boxed::Box<dyn std::error::Error +
std::marker::Sync +
std::marker::Send>> {
#to_sql_body
Expand Down Expand Up @@ -196,7 +196,7 @@ fn composite_body(fields: &[Field]) -> TokenStream {
postgres_types::IsNull::Yes => -1,
postgres_types::IsNull::No => {
let len = buf.len() - base - 4;
if len > i32::max_value() as usize {
if len > i32::MAX as usize {
return std::result::Result::Err(
std::convert::Into::into("value too large to transmit"));
}
Expand Down
13 changes: 13 additions & 0 deletions postgres-native-tls/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## v0.5.2 - 2025-09-25

### Changed

* Updated repository links to use `rust-postgres` organization.
* Upgraded to Rust 2021 edition.

## v0.5.1 - 2025-02-02

### Added

* Added `set_postgresql_alpn`.

## v0.5.0 - 2020-12-25

### Changed
Expand Down
Loading