2019-11-29 17:22:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IParserBase.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/** Parses queries like
|
|
|
|
* CREATE [ROW] POLICY [IF NOT EXISTS | OR REPLACE] name ON [database.]table
|
|
|
|
* [AS {PERMISSIVE | RESTRICTIVE}]
|
|
|
|
* [FOR {SELECT | INSERT | UPDATE | DELETE | ALL}]
|
|
|
|
* [USING condition]
|
|
|
|
* [WITH CHECK condition] [,...]
|
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
|
|
|
*
|
|
|
|
* ALTER [ROW] POLICY [IF EXISTS] name ON [database.]table
|
|
|
|
* [RENAME TO new_name]
|
|
|
|
* [AS {PERMISSIVE | RESTRICTIVE}]
|
|
|
|
* [FOR {SELECT | INSERT | UPDATE | DELETE | ALL}]
|
|
|
|
* [USING {condition | NONE}]
|
|
|
|
* [WITH CHECK {condition | NONE}] [,...]
|
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
|
|
|
*/
|
|
|
|
class ParserCreateRowPolicyQuery : public IParserBase
|
|
|
|
{
|
2020-02-21 19:27:12 +00:00
|
|
|
public:
|
2020-05-30 20:10:45 +00:00
|
|
|
void useAttachMode(bool attach_mode_ = true) { attach_mode = attach_mode_; }
|
2020-02-21 19:27:12 +00:00
|
|
|
|
2019-11-29 17:22:56 +00:00
|
|
|
protected:
|
|
|
|
const char * getName() const override { return "CREATE ROW POLICY or ALTER ROW POLICY query"; }
|
|
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
2020-02-21 19:27:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool attach_mode = false;
|
2019-11-29 17:22:56 +00:00
|
|
|
};
|
|
|
|
}
|