Skip to content

Commit e8ef14d

Browse files
author
Zoran Cvetkov
committed
not to duplicate VID
1 parent 2674b53 commit e8ef14d

File tree

2 files changed

+8
-2
lines changed
  • graph/src/data/store
  • store/postgres/src/relational

2 files changed

+8
-2
lines changed

graph/src/data/store/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ where
735735
lazy_static! {
736736
/// The name of the id attribute, `"id"`
737737
pub static ref ID: Word = Word::from("id");
738+
/// The name of the vid attribute, `"vid"`
739+
pub static ref VID: Word = Word::from("vid");
738740
}
739741

740742
/// An entity is represented as a map of attribute names to values.

store/postgres/src/relational/dsl.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use diesel::sql_types::{
2222
use diesel::{AppearsOnTable, Expression, QueryDsl, QueryResult, SelectableExpression};
2323
use diesel_dynamic_schema::DynamicSelectClause;
2424
use graph::components::store::{AttributeNames, BlockNumber, StoreError, BLOCK_NUMBER_MAX};
25-
use graph::data::store::{Id, IdType, ID};
25+
use graph::data::store::{Id, IdType, ID, VID};
2626
use graph::data_source::CausalityRegion;
2727
use graph::prelude::{lazy_static, ENV_VARS};
2828

@@ -260,7 +260,10 @@ impl<'a> Table<'a> {
260260
AttributeNames::Select(names) => {
261261
let pk = self.meta.primary_key();
262262
cols.push(pk);
263-
let mut names: Vec<_> = names.iter().filter(|name| *name != &*ID).collect();
263+
let mut names: Vec<_> = names
264+
.iter()
265+
.filter(|name| *name != &*ID && *name != &*VID)
266+
.collect();
264267
names.sort();
265268
for name in names {
266269
let column = self.meta.column_for_field(&name)?;
@@ -283,6 +286,7 @@ impl<'a> Table<'a> {
283286
}
284287

285288
cols.push(&*VID_COL);
289+
286290
if T::WITH_SYSTEM_COLUMNS {
287291
if self.meta.immutable {
288292
cols.push(&*BLOCK_COL);

0 commit comments

Comments
 (0)