-
Notifications
You must be signed in to change notification settings - Fork 98
fix: location and add support for create publication #94
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
Conversation
NodeEnum::PublicationObjSpec(n) => { | ||
match &n.pubtable { | ||
Some(pubtable) => match &pubtable.relation { | ||
Some(range_var) => Some(range_var.location), | ||
None => Some(n.location), | ||
}, | ||
None => Some(n.location), | ||
} | ||
}, | ||
NodeEnum::BooleanTest(n) => { | ||
if n.arg.is_some() { | ||
get_location_internal(&n.arg.as_ref().unwrap().node.as_ref().unwrap()) | ||
} else { | ||
Some(n.location) | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cvng fixed location here
if let Some(n) = n.pubobjects.first() { | ||
tokens.push(TokenProperty::from(Token::For)); | ||
if let Some(NodeEnum::PublicationObjSpec(n)) = &n.node { | ||
match n.pubobjtype() { | ||
protobuf::PublicationObjSpecType::PublicationobjTable => { | ||
tokens.push(TokenProperty::from(Token::Table)); | ||
}, | ||
protobuf::PublicationObjSpecType::PublicationobjTablesInSchema => { | ||
tokens.push(TokenProperty::from(Token::Tables)); | ||
tokens.push(TokenProperty::from(Token::InP)); | ||
tokens.push(TokenProperty::from(Token::Schema)); | ||
}, | ||
_ => panic!("Unknown CreatePublicationStmt {:#?}", n.pubobjtype()) | ||
} | ||
} | ||
} | ||
if let Some(n) = n.pubobjects.last() { | ||
if let Some(NodeEnum::PublicationObjSpec(n)) = &n.node { | ||
match n.pubobjtype() { | ||
protobuf::PublicationObjSpecType::PublicationobjTablesInSchema => { | ||
tokens.push(TokenProperty::from(Token::Tables)); | ||
tokens.push(TokenProperty::from(Token::InP)); | ||
tokens.push(TokenProperty::from(Token::Schema)); | ||
}, | ||
_ => {} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be implemented safer. we should do .find() for all types and add the respective tokens if at least one can be found. feel free to fix this @cvng
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, let's have this in a next PR with a test_create_publication
test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
includes #92