Skip to content

Commit

Permalink
check if poi is fine to be generated by us
Browse files Browse the repository at this point in the history
  • Loading branch information
zorancv committed Jan 13, 2025
1 parent 714c931 commit 0abd901
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion store/postgres/src/relational/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Table {
Ok(cols)
}

let vid_type = if self.object.is_poi() || !self.object.is_object_type() {
let vid_type = if !self.object.is_object_type() {
"bigserial"
} else {
"bigint"
Expand Down
22 changes: 5 additions & 17 deletions store/postgres/src/relational_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2541,8 +2541,6 @@ impl<'a> QueryFragment<Pg> for InsertQuery<'a> {
let out = &mut out;
out.unsafe_to_cache_prepared();

let not_poi = !self.table.object.is_poi();

// Construct a query
// insert into schema.table(column, ...)
// values
Expand All @@ -2568,9 +2566,7 @@ impl<'a> QueryFragment<Pg> for InsertQuery<'a> {
out.push_sql(CAUSALITY_REGION_COLUMN);
};

if not_poi {
out.push_sql(", vid");
}
out.push_sql(", vid");
out.push_sql(") values\n");

for (i, row) in self.rows.iter().enumerate() {
Expand All @@ -2588,10 +2584,8 @@ impl<'a> QueryFragment<Pg> for InsertQuery<'a> {
out.push_sql(", ");
out.push_bind_param::<Integer, _>(&row.causality_region)?;
};
if not_poi {
out.push_sql(", ");
out.push_bind_param::<BigInt, _>(&row.vid)?;
}
out.push_sql(", ");
out.push_bind_param::<BigInt, _>(&row.vid)?;
out.push_sql(")");
}

Expand Down Expand Up @@ -5089,8 +5083,6 @@ impl<'a> QueryFragment<Pg> for CopyEntityBatchQuery<'a> {
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, Pg>) -> QueryResult<()> {
out.unsafe_to_cache_prepared();

let not_poi = !self.dst.object.is_poi();

// Construct a query
// insert into {dst}({columns})
// select {columns} from {src}
Expand All @@ -5111,9 +5103,7 @@ impl<'a> QueryFragment<Pg> for CopyEntityBatchQuery<'a> {
out.push_sql(", ");
out.push_sql(CAUSALITY_REGION_COLUMN);
};
if not_poi {
out.push_sql(", vid");
}
out.push_sql(", vid");

out.push_sql(")\nselect ");
for column in &self.columns {
Expand Down Expand Up @@ -5179,9 +5169,7 @@ impl<'a> QueryFragment<Pg> for CopyEntityBatchQuery<'a> {
));
}
}
if not_poi {
out.push_sql(", vid");
}
out.push_sql(", vid");

out.push_sql(" from ");
out.push_sql(self.src.qualified_name.as_str());
Expand Down

0 comments on commit 0abd901

Please sign in to comment.