Skip to content

Commit f84e939

Browse files
committed
chore: update pgwire to 0.30
1 parent 52f540e commit f84e939

4 files changed

Lines changed: 35 additions & 21 deletions

File tree

nexus/Cargo.lock

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

nexus/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ssh2 = "0.9"
3232
sqlparser = { git = "https://github.com/peerdb-io/sqlparser-rs.git", branch = "main" }
3333
tokio = { version = "1", features = ["full"] }
3434
tracing = "0.1"
35-
pgwire = { version = "0.28", default-features = false, features = [
35+
pgwire = { version = "0.30", default-features = false, features = [
3636
"scram",
3737
"server-api-aws-lc-rs",
3838
] }

nexus/parser/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use analyzer::{
77
use async_trait::async_trait;
88
use catalog::Catalog;
99
use pgwire::{
10-
api::{Type, stmt::QueryParser},
10+
api::{ClientInfo, Type, stmt::QueryParser},
1111
error::{ErrorInfo, PgWireError, PgWireResult},
1212
};
1313
use sqlparser::{ast::Statement, dialect::PostgreSqlDialect, parser::Parser};
@@ -146,7 +146,15 @@ impl NexusQueryParser {
146146
impl QueryParser for NexusQueryParser {
147147
type Statement = NexusParsedStatement;
148148

149-
async fn parse_sql(&self, sql: &str, _types: &[Type]) -> PgWireResult<Self::Statement> {
149+
async fn parse_sql<C>(
150+
&self,
151+
_client: &C,
152+
sql: &str,
153+
_types: &[Type],
154+
) -> PgWireResult<Self::Statement>
155+
where
156+
C: ClientInfo + Unpin + Send + Sync,
157+
{
150158
let mut stmts =
151159
Parser::parse_sql(&DIALECT, sql).map_err(|e| PgWireError::ApiError(Box::new(e)))?;
152160
if stmts.len() > 1 {

nexus/server/src/main.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
collections::{HashMap, HashSet},
3-
fmt::Write,
3+
fmt::{Debug, Write},
44
fs::File,
55
io,
66
sync::Arc,
@@ -15,6 +15,7 @@ use clap::Parser;
1515
use cursor::PeerCursors;
1616
use dashmap::{DashMap, mapref::entry::Entry as DashEntry};
1717
use flow_rs::grpc::{FlowGrpcClient, PeerCreationResult};
18+
use futures::Sink;
1819
use peer_connections::{PeerConnectionTracker, PeerConnections};
1920
use peer_cursor::{
2021
QueryExecutor, QueryOutput, Schema,
@@ -23,7 +24,7 @@ use peer_cursor::{
2324
use peerdb_parser::{NexusParsedStatement, NexusQueryParser, NexusStatement};
2425
use pgwire::{
2526
api::{
26-
ClientInfo, NoopErrorHandler, PgWireServerHandlers, Type,
27+
ClientInfo, ClientPortalStore, NoopErrorHandler, PgWireServerHandlers, Type,
2728
auth::{
2829
AuthSource, LoginInfo, Password, ServerParameterProvider,
2930
scram::{SASLScramAuthStartupHandler, gen_salted_password},
@@ -35,8 +36,10 @@ use pgwire::{
3536
DescribePortalResponse, DescribeResponse, DescribeStatementResponse, Response, Tag,
3637
},
3738
stmt::StoredStatement,
39+
store::PortalStore,
3840
},
3941
error::{ErrorInfo, PgWireError, PgWireResult},
42+
messages::PgWireBackendMessage,
4043
tokio::process_socket,
4144
};
4245
use pt::{
@@ -751,13 +754,11 @@ impl NexusBackend {
751754

752755
#[async_trait]
753756
impl SimpleQueryHandler for NexusBackend {
754-
async fn do_query<'a, C>(
755-
&self,
756-
_client: &mut C,
757-
sql: &'a str,
758-
) -> PgWireResult<Vec<Response<'a>>>
757+
async fn do_query<'a, C>(&self, _client: &mut C, sql: &str) -> PgWireResult<Vec<Response<'a>>>
759758
where
760-
C: ClientInfo + Unpin + Send + Sync,
759+
C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
760+
C::Error: Debug,
761+
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
761762
{
762763
let parsed = self.query_parser.parse_simple_sql(sql).await?;
763764
let nexus_stmt = parsed.statement;
@@ -818,11 +819,14 @@ impl ExtendedQueryHandler for NexusBackend {
818819
async fn do_query<'a, C>(
819820
&self,
820821
_client: &mut C,
821-
portal: &'a Portal<Self::Statement>,
822+
portal: &Portal<Self::Statement>,
822823
_max_rows: usize,
823824
) -> PgWireResult<Response<'a>>
824825
where
825-
C: ClientInfo + Unpin + Send + Sync,
826+
C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
827+
C::PortalStore: PortalStore<Statement = Self::Statement>,
828+
C::Error: Debug,
829+
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
826830
{
827831
let stmt = &portal.statement.statement;
828832
tracing::info!("[eqp] do_query: {}", stmt.query);
@@ -1135,7 +1139,7 @@ pub async fn main() -> anyhow::Result<()> {
11351139
Arc::new(NexusServerParameterProvider),
11361140
);
11371141

1138-
let tls_acceptor = setup_tls(&args)?.map(Arc::new);
1142+
let tls_acceptor = setup_tls(&args)?;
11391143

11401144
let peer_conns = {
11411145
let conn_str = catalog_config.to_pg_connection_string();

0 commit comments

Comments
 (0)