Skip to content

Commit 646dde3

Browse files
authored
feat: cursor and fetch support (#339)
* feat: cursor and fetch support * feat: update cursor to support extended query * feat: use pgwire 0.40 fetch api * test: update tests for empty fetch * test: add an integration test for foreign data wrapper * ci: install podman * test: refactor integration test to use flake environment * ci: remove podman info * chore: add back podman info
1 parent 6aaf9b3 commit 646dde3

12 files changed

Lines changed: 778 additions & 51 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,12 @@ jobs:
7474
needs: [test]
7575
steps:
7676
- uses: actions/checkout@v6
77-
- uses: actions-rs/toolchain@v1
78-
with:
79-
toolchain: stable
80-
override: true
81-
- run: |
82-
pip install psycopg
77+
- uses: cachix/install-nix-action@v31
78+
- name: Initialize podman
79+
run: nix develop --command podman info >/dev/null 2>&1 || true
8380
- run: |
8481
cd tests-integration
85-
./test.sh
82+
nix develop --command bash test.sh
8683
8784
msrv:
8885
name: MSRV

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bytes = "1.11.1"
1919
chrono = { version = "0.4", features = ["std"] }
2020
datafusion = { version = "53" }
2121
futures = "0.3"
22-
pgwire = { version = "0.39", default-features = false }
22+
pgwire = { version = "0.40", default-features = false }
2323
postgres-types = "0.2"
2424
rust_decimal = { version = "1.42", features = ["db-postgres"] }
2525
tokio = { version = "1", default-features = false }

arrow-pg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ datafusion = { workspace = true, optional = true }
2727
futures.workspace = true
2828
geoarrow = { version = "0.8", optional = true }
2929
geoarrow-schema = { version = "0.8", optional = true }
30-
pg_interval = { version = "0.5.1", package = "pg_interval_2" }
30+
pg_interval = { version = "0.5.0" }
3131
pgwire = { workspace = true, default-features = false, features = ["server-api", "pg-ext-types"] }
3232
postgres-types.workspace = true
3333
rust_decimal.workspace = true

datafusion-pg-catalog/src/sql/parser.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::sync::Arc;
22

33
use datafusion::sql::sqlparser::ast::Statement;
44
use datafusion::sql::sqlparser::dialect::PostgreSqlDialect;
5+
use datafusion::sql::sqlparser::keywords::Keyword;
56
use datafusion::sql::sqlparser::parser::Parser;
67
use datafusion::sql::sqlparser::parser::ParserError;
78
use datafusion::sql::sqlparser::tokenizer::Token;
@@ -247,10 +248,19 @@ impl PostgresCompatibilityParser {
247248

248249
// Get token values (without spans) and filter out only whitespace
249250
// Keep semicolons as they separate statements
251+
// Also rewrite ABORT to ROLLBACK for postgres compatibility
252+
// remove this when https://github.com/apache/datafusion-sqlparser-rs/pull/2332 is ready
250253
let filtered_tokens: Vec<Token> = tokens
251254
.iter()
252255
.map(|t| t.token.clone())
253256
.filter(|t| !matches!(t, Token::Whitespace(_)))
257+
.map(|t| {
258+
if matches!(&t, Token::Word(w) if w.keyword == Keyword::ABORT) {
259+
Token::make_keyword("ROLLBACK")
260+
} else {
261+
t
262+
}
263+
})
254264
.collect();
255265

256266
// Handle empty input

0 commit comments

Comments
 (0)