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

Subgraph composition rework vid wrap3 #5768

Draft
wants to merge 1 commit into
base: zoran/subgraph-composition-rework-vid-wrap2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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 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