From e286630bf3b7f60c55772d1e9852cffb34e8f078 Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Tue, 13 Feb 2024 10:15:27 +0100 Subject: [PATCH] Fix for SQL value functions when there is an alias specified --- src/planner/binder/expression/bind_columnref_expression.cpp | 2 +- test/sql/function/timestamp/current_time.test | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/planner/binder/expression/bind_columnref_expression.cpp b/src/planner/binder/expression/bind_columnref_expression.cpp index f90b4e129bc6..ce6cb104b723 100644 --- a/src/planner/binder/expression/bind_columnref_expression.cpp +++ b/src/planner/binder/expression/bind_columnref_expression.cpp @@ -423,7 +423,7 @@ BindResult ExpressionBinder::BindExpression(ColumnRefExpression &col_ref_p, idx_ if (!expr) { if (!col_ref_p.IsQualified()) { // column was not found - check if it is a SQL value function - auto value_function = GetSQLValueFunction(col_ref_p.GetName()); + auto value_function = GetSQLValueFunction(col_ref_p.GetColumnName()); if (value_function) { return BindExpression(value_function, depth); } diff --git a/test/sql/function/timestamp/current_time.test b/test/sql/function/timestamp/current_time.test index de4e0da65b6b..a5fb906bb76a 100644 --- a/test/sql/function/timestamp/current_time.test +++ b/test/sql/function/timestamp/current_time.test @@ -42,3 +42,9 @@ SELECT typeof(${func}()); TIMESTAMP WITH TIME ZONE endloop + +statement ok +SELECT CURRENT_TIME AS TIME + +statement ok +SELECT CURRENT_TIME + interval (1) second AS TIME