Closed cvng closed 10 months ago
after inspection, it looks like the location (Some(0)
) of the first PublicationObjSpec
from the AST is wrong
EDIT: it turns out the PublicationObjSpec
has an inner RangeVar
where the location (Some(43)
) is indeed correct
CREATE PUBLICATION mypublication FOR TABLE users, departments;
Node {
node: Some(
PublicationObjSpec(
PublicationObjSpec {
pubobjtype: PublicationobjTable,
name: "",
pubtable: Some(
PublicationTable {
relation: Some(
RangeVar {
catalogname: "",
schemaname: "",
relname: "users",
inh: true,
relpersistence: "p",
alias: None,
location: 43, // <-
},
),
where_clause: None,
columns: [],
},
),
location: 0, // <-
},
),
),
},
thread 'valid_statements' panicked at crates/parser/src/parse/libpg_query_node.rs:373:13:
assertion `left == right` failed: Tried to start node Node {
kind: PublicationObjSpec,
depth: 2,
properties: [],
location: Some(
0,
),
} with location 0 but current location is 43
left: 0
right: 43
cc @psteinroe
Included in #94
What kind of change does this PR introduce?
Bug fix, feature, docs update, ...
What is the current behavior?
Please link any relevant issues here.
What is the new behavior?
panics
View log
```rust Parsing node CreatePublicationStmt( CreatePublicationStmt { pubname: "mypublication", options: [], pubobjects: [ Node { node: Some( PublicationObjSpec( PublicationObjSpec { pubobjtype: PublicationobjTable, name: "", pubtable: Some( PublicationTable { relation: Some( RangeVar { catalogname: "", schemaname: "", relname: "users", inh: true, relpersistence: "p", alias: None, location: 43, }, ), where_clause: None, columns: [], }, ), location: 0, }, ), ), }, Node { node: Some( PublicationObjSpec( PublicationObjSpec { pubobjtype: PublicationobjTable, name: "", pubtable: Some( PublicationTable { relation: Some( RangeVar { catalogname: "", schemaname: "", relname: "departments", inh: true, relpersistence: "p", alias: None, location: 50, }, ), where_clause: None, columns: [], }, ), location: 50, }, ), ), }, ], for_all_tables: false, }, ) thread 'valid_statements' panicked at crates/parser/src/parse/libpg_query_node.rs:373:13: assertion `left == right` failed: Tried to start node Node { kind: PublicationObjSpec, depth: 2, properties: [], location: Some( 0, ), } with location 0 but current location is 43 left: 0 right: 43 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'valid_statements' panicked at crates/parser/tests/statement_parser_test.rs:36:17: Failed to parse statement 0050: CREATE PUBLICATION mypublication FOR TABLE users, departments; ```Additional context
failing case:
NOTE: adding aPublicationObjSpec
inget_node_properties
did not help but I have to check again