1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/parser/expression/star_expression.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/parser/parsed_expression.hpp"
12#include "duckdb/common/case_insensitive_map.hpp"
13
14namespace duckdb {
15
16//! Represents a * expression in the SELECT clause
17class StarExpression : public ParsedExpression {
18public:
19 static constexpr const ExpressionClass TYPE = ExpressionClass::STAR;
20
21public:
22 StarExpression(string relation_name = string());
23
24 //! The relation name in case of tbl.*, or empty if this is a normal *
25 string relation_name;
26 //! List of columns to exclude from the STAR expression
27 case_insensitive_set_t exclude_list;
28 //! List of columns to replace with another expression
29 case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
30 //! The expression to select the columns (regular expression or list)
31 unique_ptr<ParsedExpression> expr;
32 //! Whether or not this is a COLUMNS expression
33 bool columns = false;
34
35public:
36 string ToString() const override;
37
38 static bool Equal(const StarExpression &a, const StarExpression &b);
39
40 unique_ptr<ParsedExpression> Copy() const override;
41
42 void Serialize(FieldWriter &writer) const override;
43 static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
44 void FormatSerialize(FormatSerializer &serializer) const override;
45 static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
46};
47} // namespace duckdb
48