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 static constexpr const ConstraintType TYPE = ConstraintType::CHECK;
22
23public:
24 DUCKDB_API explicit CheckConstraint(unique_ptr<ParsedExpression> expression);
25
26 unique_ptr<ParsedExpression> expression;
27
28public:
29 DUCKDB_API string ToString() const override;
30
31 DUCKDB_API unique_ptr<Constraint> Copy() const override;
32
33 DUCKDB_API void Serialize(FieldWriter &writer) const override;
34 DUCKDB_API static unique_ptr<Constraint> Deserialize(FieldReader &source);
35};
36
37} // namespace duckdb
38