Skip to content

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

Merged
merged 1 commit into from
Dec 22, 2023
Merged

Conversation

psteinroe
Copy link
Collaborator

@psteinroe psteinroe commented Dec 21, 2023

includes #92

Comment on lines +58 to +73
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)
}
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cvng fixed location here

Comment on lines +706 to +732
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));
},
_ => {}
}
}
Copy link
Collaborator Author

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

Copy link
Contributor

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

Copy link
Contributor

@cvng cvng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@psteinroe psteinroe merged commit 9c694d7 into main Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants