Skip to content

Commit 14d2b71

Browse files
committed
rebase
1 parent 7629895 commit 14d2b71

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2323
let source_paths = vec![
2424
build_path.join("pg_query").with_extension("h"),
2525
build_path.join("pg_query_raw.h"),
26+
build_path.join("postgres_deparse").with_extension("h"),
2627
build_path.join("Makefile"),
2728
build_path.join("src"),
2829
build_path.join("protobuf"),

src/ast/convert.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ impl From<protobuf::GroupingSet> for GroupingSet {
977977
impl From<protobuf::MergeWhenClause> for MergeWhenClause {
978978
fn from(pb: protobuf::MergeWhenClause) -> Self {
979979
MergeWhenClause {
980-
matched: pb.matched,
980+
match_kind: pb.match_kind.into(),
981981
command_type: pb.command_type.into(),
982982
override_: pb.r#override.into(),
983983
condition: pb.condition.map(|n| n.into()),
@@ -1041,6 +1041,7 @@ impl From<protobuf::Constraint> for Constraint {
10411041
raw_expr: pb.raw_expr.map(|n| n.into()),
10421042
cooked_expr: pb.cooked_expr,
10431043
generated_when: pb.generated_when,
1044+
inhcount: pb.inhcount,
10441045
nulls_not_distinct: pb.nulls_not_distinct,
10451046
keys: pb.keys.into_iter().map(|n| n.into()).collect(),
10461047
including: pb.including.into_iter().map(|n| n.into()).collect(),
@@ -1634,6 +1635,17 @@ impl From<i32> for CmdType {
16341635
}
16351636
}
16361637

1638+
impl From<i32> for MergeMatchKind {
1639+
fn from(v: i32) -> Self {
1640+
match v {
1641+
1 => MergeMatchKind::Matched,
1642+
2 => MergeMatchKind::NotMatchedBySource,
1643+
3 => MergeMatchKind::NotMatchedByTarget,
1644+
_ => MergeMatchKind::Undefined,
1645+
}
1646+
}
1647+
}
1648+
16371649
impl From<i32> for TransactionStmtKind {
16381650
fn from(v: i32) -> Self {
16391651
match v {

src/ast/nodes.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ pub struct GroupingSet {
814814
/// MERGE WHEN clause
815815
#[derive(Debug, Clone, Default)]
816816
pub struct MergeWhenClause {
817-
pub matched: bool,
817+
pub match_kind: MergeMatchKind,
818818
pub command_type: CmdType,
819819
pub override_: OverridingKind,
820820
pub condition: Option<Node>,
@@ -875,6 +875,7 @@ pub struct Constraint {
875875
pub raw_expr: Option<Node>,
876876
pub cooked_expr: String,
877877
pub generated_when: String,
878+
pub inhcount: i32,
878879
pub nulls_not_distinct: bool,
879880
pub keys: Vec<Node>,
880881
pub including: Vec<Node>,
@@ -1392,6 +1393,16 @@ pub enum CmdType {
13921393
Nothing,
13931394
}
13941395

1396+
/// MERGE match kind
1397+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
1398+
pub enum MergeMatchKind {
1399+
#[default]
1400+
Undefined,
1401+
Matched,
1402+
NotMatchedBySource,
1403+
NotMatchedByTarget,
1404+
}
1405+
13951406
/// Transaction statement kind
13961407
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
13971408
pub enum TransactionStmtKind {

src/raw_parse.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ unsafe fn convert_constraint(c: &bindings_raw::Constraint) -> protobuf::Constrai
849849
raw_expr: convert_node_boxed(c.raw_expr),
850850
cooked_expr: convert_c_string(c.cooked_expr),
851851
generated_when: if c.generated_when == 0 { String::new() } else { String::from_utf8_lossy(&[c.generated_when as u8]).to_string() },
852+
inhcount: c.inhcount,
852853
nulls_not_distinct: c.nulls_not_distinct,
853854
keys: convert_list_to_nodes(c.keys),
854855
including: convert_list_to_nodes(c.including),
@@ -1057,6 +1058,8 @@ unsafe fn convert_execute_stmt(es: &bindings_raw::ExecuteStmt) -> protobuf::Exec
10571058
unsafe fn convert_deallocate_stmt(ds: &bindings_raw::DeallocateStmt) -> protobuf::DeallocateStmt {
10581059
protobuf::DeallocateStmt {
10591060
name: convert_c_string(ds.name),
1061+
isall: ds.isall,
1062+
location: ds.location,
10601063
}
10611064
}
10621065

0 commit comments

Comments
 (0)