Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Postgres 17 and libpg_query 6.0.0 #47

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion libpg_query
Submodule libpg_query updated 632 files
34 changes: 33 additions & 1 deletion src/node_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,22 @@ impl NodeEnum {
NodeEnum::JsonObjectAgg(n) => NodeRef::JsonObjectAgg(n),
NodeEnum::JsonArrayAgg(n) => NodeRef::JsonArrayAgg(n),
NodeEnum::RtepermissionInfo(n) => NodeRef::RtepermissionInfo(n),
NodeEnum::WindowFuncRunCondition(n) => NodeRef::WindowFuncRunCondition(n),
NodeEnum::MergeSupportFunc(n) => NodeRef::MergeSupportFunc(n),
NodeEnum::JsonBehavior(n) => NodeRef::JsonBehavior(n),
NodeEnum::JsonExpr(n) => NodeRef::JsonExpr(n),
NodeEnum::JsonTablePath(n) => NodeRef::JsonTablePath(n),
NodeEnum::JsonTablePathScan(n) => NodeRef::JsonTablePathScan(n),
NodeEnum::JsonTableSiblingJoin(n) => NodeRef::JsonTableSiblingJoin(n),
NodeEnum::SinglePartitionSpec(n) => NodeRef::SinglePartitionSpec(n),
NodeEnum::JsonArgument(n) => NodeRef::JsonArgument(n),
NodeEnum::JsonFuncExpr(n) => NodeRef::JsonFuncExpr(n),
NodeEnum::JsonTablePathSpec(n) => NodeRef::JsonTablePathSpec(n),
NodeEnum::JsonTable(n) => NodeRef::JsonTable(n),
NodeEnum::JsonTableColumn(n) => NodeRef::JsonTableColumn(n),
NodeEnum::JsonParseExpr(n) => NodeRef::JsonParseExpr(n),
NodeEnum::JsonScalarExpr(n) => NodeRef::JsonScalarExpr(n),
NodeEnum::JsonSerializeExpr(n) => NodeRef::JsonSerializeExpr(n),
}
}

Expand Down Expand Up @@ -1332,7 +1348,7 @@ impl NodeEnum {
NodeEnum::CreateStatsStmt(n) => NodeMut::CreateStatsStmt(n as *mut _),
NodeEnum::AlterCollationStmt(n) => NodeMut::AlterCollationStmt(n as *mut _),
NodeEnum::CallStmt(n) => NodeMut::CallStmt(&mut **n as *mut _),
NodeEnum::AlterStatsStmt(n) => NodeMut::AlterStatsStmt(n as *mut _),
NodeEnum::AlterStatsStmt(n) => NodeMut::AlterStatsStmt(&mut **n as *mut _),
NodeEnum::AExpr(n) => NodeMut::AExpr(&mut **n as *mut _),
NodeEnum::ColumnRef(n) => NodeMut::ColumnRef(n as *mut _),
NodeEnum::ParamRef(n) => NodeMut::ParamRef(n as *mut _),
Expand Down Expand Up @@ -1420,6 +1436,22 @@ impl NodeEnum {
NodeEnum::JsonObjectAgg(n) => NodeMut::JsonObjectAgg(&mut **n as *mut _),
NodeEnum::JsonArrayAgg(n) => NodeMut::JsonArrayAgg(&mut **n as *mut _),
NodeEnum::RtepermissionInfo(n) => NodeMut::RtepermissionInfo(&mut *n as *mut _),
NodeEnum::WindowFuncRunCondition(n) => NodeMut::WindowFuncRunCondition(&mut **n as *mut _),
NodeEnum::MergeSupportFunc(n) => NodeMut::MergeSupportFunc(&mut **n as *mut _),
NodeEnum::JsonBehavior(n) => NodeMut::JsonBehavior(&mut **n as *mut _),
NodeEnum::JsonExpr(n) => NodeMut::JsonExpr(&mut **n as *mut _),
NodeEnum::JsonTablePath(n) => NodeMut::JsonTablePath(&mut *n as *mut _),
NodeEnum::JsonTablePathScan(n) => NodeMut::JsonTablePathScan(&mut **n as *mut _),
NodeEnum::JsonTableSiblingJoin(n) => NodeMut::JsonTableSiblingJoin(&mut **n as *mut _),
NodeEnum::SinglePartitionSpec(n) => NodeMut::SinglePartitionSpec(&mut *n as *mut _),
NodeEnum::JsonArgument(n) => NodeMut::JsonArgument(&mut **n as *mut _),
NodeEnum::JsonFuncExpr(n) => NodeMut::JsonFuncExpr(&mut **n as *mut _),
NodeEnum::JsonTablePathSpec(n) => NodeMut::JsonTablePathSpec(&mut **n as *mut _),
NodeEnum::JsonTable(n) => NodeMut::JsonTable(&mut **n as *mut _),
NodeEnum::JsonTableColumn(n) => NodeMut::JsonTableColumn(&mut **n as *mut _),
NodeEnum::JsonParseExpr(n) => NodeMut::JsonParseExpr(&mut **n as *mut _),
NodeEnum::JsonScalarExpr(n) => NodeMut::JsonScalarExpr(&mut **n as *mut _),
NodeEnum::JsonSerializeExpr(n) => NodeMut::JsonSerializeExpr(&mut **n as *mut _),
}
}
}
34 changes: 33 additions & 1 deletion src/node_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ pub enum NodeMut {
JsonObjectAgg(*mut protobuf::JsonObjectAgg),
JsonArrayAgg(*mut protobuf::JsonArrayAgg),
RtepermissionInfo(*mut protobuf::RtePermissionInfo),
WindowFuncRunCondition(*mut protobuf::WindowFuncRunCondition),
MergeSupportFunc(*mut protobuf::MergeSupportFunc),
JsonBehavior(*mut protobuf::JsonBehavior),
JsonExpr(*mut protobuf::JsonExpr),
JsonTablePath(*mut protobuf::JsonTablePath),
JsonTablePathScan(*mut protobuf::JsonTablePathScan),
JsonTableSiblingJoin(*mut protobuf::JsonTableSiblingJoin),
SinglePartitionSpec(*mut protobuf::SinglePartitionSpec),
JsonArgument(*mut protobuf::JsonArgument),
JsonFuncExpr(*mut protobuf::JsonFuncExpr),
JsonTablePathSpec(*mut protobuf::JsonTablePathSpec),
JsonTable(*mut protobuf::JsonTable),
JsonTableColumn(*mut protobuf::JsonTableColumn),
JsonParseExpr(*mut protobuf::JsonParseExpr),
JsonScalarExpr(*mut protobuf::JsonScalarExpr),
JsonSerializeExpr(*mut protobuf::JsonSerializeExpr),
}

impl NodeMut {
Expand Down Expand Up @@ -432,7 +448,7 @@ impl NodeMut {
NodeMut::CreateStatsStmt(n) => Ok(NodeEnum::CreateStatsStmt(n.as_ref().ok_or(err)?.clone())),
NodeMut::AlterCollationStmt(n) => Ok(NodeEnum::AlterCollationStmt(n.as_ref().ok_or(err)?.clone())),
NodeMut::CallStmt(n) => Ok(NodeEnum::CallStmt(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::AlterStatsStmt(n) => Ok(NodeEnum::AlterStatsStmt(n.as_ref().ok_or(err)?.clone())),
NodeMut::AlterStatsStmt(n) => Ok(NodeEnum::AlterStatsStmt(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::AExpr(n) => Ok(NodeEnum::AExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::ColumnRef(n) => Ok(NodeEnum::ColumnRef(n.as_ref().ok_or(err)?.clone())),
NodeMut::ParamRef(n) => Ok(NodeEnum::ParamRef(n.as_ref().ok_or(err)?.clone())),
Expand Down Expand Up @@ -520,6 +536,22 @@ impl NodeMut {
NodeMut::JsonObjectAgg(n) => Ok(NodeEnum::JsonObjectAgg(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonArrayAgg(n) => Ok(NodeEnum::JsonArrayAgg(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::RtepermissionInfo(n) => Ok(NodeEnum::RtepermissionInfo(n.as_ref().ok_or(err)?.clone())),
NodeMut::WindowFuncRunCondition(n) => Ok(NodeEnum::WindowFuncRunCondition(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::MergeSupportFunc(n) => Ok(NodeEnum::MergeSupportFunc(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonBehavior(n) => Ok(NodeEnum::JsonBehavior(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonExpr(n) => Ok(NodeEnum::JsonExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonTablePath(n) => Ok(NodeEnum::JsonTablePath(n.as_ref().ok_or(err)?.clone())),
NodeMut::JsonTablePathScan(n) => Ok(NodeEnum::JsonTablePathScan(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonTableSiblingJoin(n) => Ok(NodeEnum::JsonTableSiblingJoin(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::SinglePartitionSpec(n) => Ok(NodeEnum::SinglePartitionSpec(n.as_ref().ok_or(err)?.clone())),
NodeMut::JsonArgument(n) => Ok(NodeEnum::JsonArgument(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonFuncExpr(n) => Ok(NodeEnum::JsonFuncExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonTablePathSpec(n) => Ok(NodeEnum::JsonTablePathSpec(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonTable(n) => Ok(NodeEnum::JsonTable(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonTableColumn(n) => Ok(NodeEnum::JsonTableColumn(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonParseExpr(n) => Ok(NodeEnum::JsonParseExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonScalarExpr(n) => Ok(NodeEnum::JsonScalarExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
NodeMut::JsonSerializeExpr(n) => Ok(NodeEnum::JsonSerializeExpr(Box::new(n.as_ref().ok_or(err)?.clone()))),
}
}
}
Expand Down
34 changes: 33 additions & 1 deletion src/node_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ pub enum NodeRef<'a> {
JsonObjectAgg(&'a protobuf::JsonObjectAgg),
JsonArrayAgg(&'a protobuf::JsonArrayAgg),
RtepermissionInfo(&'a protobuf::RtePermissionInfo),
WindowFuncRunCondition(&'a protobuf::WindowFuncRunCondition),
MergeSupportFunc(&'a protobuf::MergeSupportFunc),
JsonBehavior(&'a protobuf::JsonBehavior),
JsonExpr(&'a protobuf::JsonExpr),
JsonTablePath(&'a protobuf::JsonTablePath),
JsonTablePathScan(&'a protobuf::JsonTablePathScan),
JsonTableSiblingJoin(&'a protobuf::JsonTableSiblingJoin),
SinglePartitionSpec(&'a protobuf::SinglePartitionSpec),
JsonArgument(&'a protobuf::JsonArgument),
JsonFuncExpr(&'a protobuf::JsonFuncExpr),
JsonTablePathSpec(&'a protobuf::JsonTablePathSpec),
JsonTable(&'a protobuf::JsonTable),
JsonTableColumn(&'a protobuf::JsonTableColumn),
JsonParseExpr(&'a protobuf::JsonParseExpr),
JsonScalarExpr(&'a protobuf::JsonScalarExpr),
JsonSerializeExpr(&'a protobuf::JsonSerializeExpr),
}

impl<'a> NodeRef<'a> {
Expand Down Expand Up @@ -431,7 +447,7 @@ impl<'a> NodeRef<'a> {
NodeRef::CreateStatsStmt(n) => NodeEnum::CreateStatsStmt((*n).clone()),
NodeRef::AlterCollationStmt(n) => NodeEnum::AlterCollationStmt((*n).clone()),
NodeRef::CallStmt(n) => NodeEnum::CallStmt(Box::new((*n).clone())),
NodeRef::AlterStatsStmt(n) => NodeEnum::AlterStatsStmt((*n).clone()),
NodeRef::AlterStatsStmt(n) => NodeEnum::AlterStatsStmt(Box::new((*n).clone())),
NodeRef::AExpr(n) => NodeEnum::AExpr(Box::new((*n).clone())),
NodeRef::ColumnRef(n) => NodeEnum::ColumnRef((*n).clone()),
NodeRef::ParamRef(n) => NodeEnum::ParamRef((*n).clone()),
Expand Down Expand Up @@ -519,6 +535,22 @@ impl<'a> NodeRef<'a> {
NodeRef::JsonObjectAgg(n) => NodeEnum::JsonObjectAgg(Box::new((*n).clone())),
NodeRef::JsonArrayAgg(n) => NodeEnum::JsonArrayAgg(Box::new((*n).clone())),
NodeRef::RtepermissionInfo(n) => NodeEnum::RtepermissionInfo((*n).clone()),
NodeRef::WindowFuncRunCondition(n) => NodeEnum::WindowFuncRunCondition(Box::new((*n).clone())),
NodeRef::MergeSupportFunc(n) => NodeEnum::MergeSupportFunc(Box::new((*n).clone())),
NodeRef::JsonBehavior(n) => NodeEnum::JsonBehavior(Box::new((*n).clone())),
NodeRef::JsonExpr(n) => NodeEnum::JsonExpr(Box::new((*n).clone())),
NodeRef::JsonTablePath(n) => NodeEnum::JsonTablePath((*n).clone()),
NodeRef::JsonTablePathScan(n) => NodeEnum::JsonTablePathScan(Box::new((*n).clone())),
NodeRef::JsonTableSiblingJoin(n) => NodeEnum::JsonTableSiblingJoin(Box::new((*n).clone())),
NodeRef::SinglePartitionSpec(n) => NodeEnum::SinglePartitionSpec((*n).clone()),
NodeRef::JsonArgument(n) => NodeEnum::JsonArgument(Box::new((*n).clone())),
NodeRef::JsonFuncExpr(n) => NodeEnum::JsonFuncExpr(Box::new((*n).clone())),
NodeRef::JsonTablePathSpec(n) => NodeEnum::JsonTablePathSpec(Box::new((*n).clone())),
NodeRef::JsonTable(n) => NodeEnum::JsonTable(Box::new((*n).clone())),
NodeRef::JsonTableColumn(n) => NodeEnum::JsonTableColumn(Box::new((*n).clone())),
NodeRef::JsonParseExpr(n) => NodeEnum::JsonParseExpr(Box::new((*n).clone())),
NodeRef::JsonScalarExpr(n) => NodeEnum::JsonScalarExpr(Box::new((*n).clone())),
NodeRef::JsonSerializeExpr(n) => NodeEnum::JsonSerializeExpr(Box::new((*n).clone())),
}
}
}
4 changes: 2 additions & 2 deletions tests/data/plpgsql_query.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"PLpgSQL_var": {
"datatype": {
"PLpgSQL_type": {
"typname": "UNKNOWN"
"typname": "pg_catalog.int4"
}
},
"refname": "input"
Expand All @@ -58,7 +58,7 @@
"PLpgSQL_var": {
"datatype": {
"PLpgSQL_type": {
"typname": "UNKNOWN"
"typname": "pg_catalog.\"boolean\""
}
},
"refname": "found"
Expand Down
6 changes: 3 additions & 3 deletions tests/data/plpgsql_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"PLpgSQL_var": {
"datatype": {
"PLpgSQL_type": {
"typname": "UNKNOWN"
"typname": "pg_catalog.\"varchar\""
}
},
"refname": "v_name"
Expand All @@ -58,7 +58,7 @@
"PLpgSQL_var": {
"datatype": {
"PLpgSQL_type": {
"typname": "UNKNOWN"
"typname": "pg_catalog.\"varchar\""
}
},
"refname": "v_version"
Expand All @@ -68,7 +68,7 @@
"PLpgSQL_var": {
"datatype": {
"PLpgSQL_type": {
"typname": "UNKNOWN"
"typname": "pg_catalog.\"boolean\""
}
},
"refname": "found"
Expand Down
2 changes: 1 addition & 1 deletion tests/fingerprint_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn it_works() {
assert_eq!(result.hex, "d8a65a814fbc5f95");

let result = fingerprint("DEALLOCATE ALL").unwrap();
assert_eq!(result.hex, "d8a65a814fbc5f95");
assert_eq!(result.hex, "2debfb8745df64a7");

let result = fingerprint("EXPLAIN ANALYZE SELECT a").unwrap();
assert_eq!(result.hex, "82845c1b5c6102e5");
Expand Down
7 changes: 4 additions & 3 deletions tests/parse_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ fn it_parses_ALTER_TABLE() {
conname: "",
deferrable: false,
initdeferred: false,
location: 21,
skip_validation: false,
initially_valid: false,
is_no_inherit: false,
raw_expr: None,
cooked_expr: "",
generated_when: "",
inhcount: 0,
nulls_not_distinct: false,
keys: [
Node {
Expand Down Expand Up @@ -159,8 +161,7 @@ fn it_parses_ALTER_TABLE() {
fk_del_set_cols: [],
old_conpfeqop: [],
old_pktable_oid: 0,
skip_validation: false,
initially_valid: false,
location: 21,
},
),
),
Expand Down
Loading