Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit f45abea

Browse files
author
Erik Sargent
committed
Minor edits to bind_node_visitor for not-null boolean flag in tuple value expressions
1 parent e4deb72 commit f45abea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/binder/bind_node_visitor.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include "binder/bind_node_visitor.h"
1414
#include "catalog/catalog.h"
15+
#include "catalog/table_catalog.h"
16+
#include "catalog/column_catalog.h"
1517
#include "expression/expression_util.h"
1618
#include "expression/star_expression.h"
1719
#include "type/type_id.h"
@@ -250,6 +252,20 @@ void BindNodeVisitor::Visit(expression::TupleValueExpression *expr) {
250252
expr->SetColName(col_name);
251253
expr->SetValueType(value_type);
252254
expr->SetBoundOid(col_pos_tuple);
255+
256+
// TODO(esargent): Uncommenting the following code makes AddressSanitizer get mad at me with a
257+
// heap buffer overflow whenever I try a query that references the same non-null attribute multiple
258+
// times (e.g. 'SELECT id FROM t WHERE id < 3 AND id > 1'). Leaving it commented out prevents the
259+
// memory error, but then this prevents the is_not_null flag of a tuple expression from being
260+
// populated in some cases (specifically, when the expression's table name is initially empty).
261+
262+
// if (table_obj == nullptr) {
263+
// BinderContext::GetRegularTableObj(context_, table_name, table_obj, depth);
264+
// }
265+
266+
if (table_obj != nullptr) {
267+
expr->SetIsNotNull(table_obj->GetColumnCatalogEntry(std::get<2>(col_pos_tuple), false)->IsNotNull());
268+
}
253269
}
254270
}
255271

0 commit comments

Comments
 (0)