Skip to content

Commit 9b79257

Browse files
committed
fix: use inline format strings and handle INT_MAX for FETCH ALL
- Update build.rs to use Rust 2024 inline format strings - Handle both INT_MAX (2147483647) and LLONG_MAX for FETCH ALL detection to support cross-platform consistency
1 parent 224263a commit 9b79257

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

crates/pgls_pretty_print/src/nodes/fetch_stmt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ pub(super) fn emit_fetch_stmt(e: &mut EventEmitter, n: &FetchStmt) {
2424
// 4: FetchRelative
2525

2626
// Note: PostgreSQL uses LLONG_MAX (9223372036854775807) to represent "ALL"
27-
let is_all = n.how_many == 0 || n.how_many == 9223372036854775807;
27+
// On some platforms/versions, INT_MAX (2147483647) may be used instead
28+
let is_all = n.how_many == 0 || n.how_many == 9223372036854775807 || n.how_many == 2147483647;
2829

2930
// Emit direction and count
3031
match n.direction {

crates/pgls_pretty_print_codegen/build.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2020
}
2121

2222
if !kwlist_path.exists() {
23-
println!(
24-
"cargo:warning=Downloading kwlist.h for libpg_query {}",
25-
version
26-
);
23+
println!("cargo:warning=Downloading kwlist.h for libpg_query {version}");
2724

2825
let kwlist_url = format!(
29-
"https://raw.githubusercontent.com/pganalyze/libpg_query/{}/src/postgres/include/parser/kwlist.h",
30-
version
26+
"https://raw.githubusercontent.com/pganalyze/libpg_query/{version}/src/postgres/include/parser/kwlist.h"
3127
);
3228

3329
let response = ureq::get(&kwlist_url).call()?;
@@ -40,14 +36,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4036
}
4137

4238
if !proto_path.exists() {
43-
println!(
44-
"cargo:warning=Downloading pg_query.proto for libpg_query {}",
45-
version
46-
);
39+
println!("cargo:warning=Downloading pg_query.proto for libpg_query {version}");
4740

4841
let proto_url = format!(
49-
"https://raw.githubusercontent.com/pganalyze/libpg_query/{}/protobuf/pg_query.proto",
50-
version
42+
"https://raw.githubusercontent.com/pganalyze/libpg_query/{version}/protobuf/pg_query.proto"
5143
);
5244

5345
let response = ureq::get(&proto_url).call()?;

0 commit comments

Comments
 (0)