1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/parser/constraints/check_constraint.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/string_util.hpp"
12#include "duckdb/parser/constraint.hpp"
13#include "duckdb/parser/parsed_expression.hpp"
14
15namespace duckdb {
16
17//! The CheckConstraint contains an expression that must evaluate to TRUE for
18//! every row in a table
19class CheckConstraint : public Constraint {
20public:
21 CheckConstraint(unique_ptr<ParsedExpression> expression)
22 : Constraint(ConstraintType::CHECK), expression(move(expression)){};
23
24 unique_ptr<ParsedExpression> expression;
25
26public:
27 string ToString() const override;
28
29 unique_ptr<Constraint> Copy() override;
30
31 //! Serialize to a stand-alone binary blob
32 void Serialize(Serializer &serializer) override;
33 //! Deserializes a CheckConstraint
34 static unique_ptr<Constraint> Deserialize(Deserializer &source);
35};
36
37} // namespace duckdb
38