Skip to content

Commit 1ca1167

Browse files
committed
grammar: Fix some bogus parent references.
1 parent 2549c97 commit 1ca1167

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

expr.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ shared_ptr<bool_expr> bool_expr::factory(prod *p)
5555

5656
exists_predicate::exists_predicate(prod *p) : bool_expr(p)
5757
{
58-
subquery = make_shared<query_spec>(p, scope);
58+
subquery = make_shared<query_spec>(this, scope);
5959
}
6060

6161
void exists_predicate::accept(prod_visitor *v)
@@ -71,9 +71,9 @@ void exists_predicate::out(std::ostream &out)
7171

7272
distinct_pred::distinct_pred(prod *p) : bool_binop(p)
7373
{
74-
lhs = make_shared<column_reference>(p);
74+
lhs = make_shared<column_reference>(this);
7575
retry:
76-
rhs = make_shared<column_reference>(p);
76+
rhs = make_shared<column_reference>(this);
7777
if (lhs->type != rhs->type)
7878
{ retries++; goto retry; }
7979
}

grammar.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ table_subquery::table_subquery(prod *p, bool lateral)
3737
: table_ref(p), is_lateral(lateral) {
3838
ostringstream r;
3939
r << "subq_" << instances++;
40-
query = make_shared<query_spec>(p, scope);
40+
query = make_shared<query_spec>(this, scope);
4141
string alias = r.str();
4242
relation *aliased_rel = &query->select_list->derived_table;
4343
refs.push_back(make_shared<aliased_relation>(alias, aliased_rel));
@@ -121,7 +121,7 @@ from_clause::from_clause(prod *p) : prod(p) {
121121

122122
while (d6() > 5) {
123123
// add a lateral subquery
124-
reflist.push_back(make_shared<table_subquery>(p, true));
124+
reflist.push_back(make_shared<table_subquery>(this, true));
125125
for (auto r : reflist.back()->refs)
126126
scope->refs.push_back(&*r);
127127
}

0 commit comments

Comments
 (0)