2020-03-18 14:11:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST.h>
|
2020-04-05 23:03:20 +00:00
|
|
|
#include <Parsers/ASTQueryWithOnCluster.h>
|
2020-03-18 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
class ASTSettingsProfileElements;
|
2020-05-30 20:10:45 +00:00
|
|
|
class ASTRolesOrUsersSet;
|
2020-03-18 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** CREATE SETTINGS PROFILE [IF NOT EXISTS | OR REPLACE] name
|
|
|
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
2020-04-07 23:57:14 +00:00
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
2020-03-18 14:11:44 +00:00
|
|
|
*
|
|
|
|
* ALTER SETTINGS PROFILE [IF EXISTS] name
|
|
|
|
* [RENAME TO new_name]
|
|
|
|
* [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
|
2020-04-07 23:57:14 +00:00
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
2020-03-18 14:11:44 +00:00
|
|
|
*/
|
2020-04-05 23:03:20 +00:00
|
|
|
class ASTCreateSettingsProfileQuery : public IAST, public ASTQueryWithOnCluster
|
2020-03-18 14:11:44 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool alter = false;
|
|
|
|
bool attach = false;
|
|
|
|
|
|
|
|
bool if_exists = false;
|
|
|
|
bool if_not_exists = false;
|
|
|
|
bool or_replace = false;
|
|
|
|
|
2020-05-30 14:18:08 +00:00
|
|
|
Strings names;
|
2020-03-18 14:11:44 +00:00
|
|
|
String new_name;
|
|
|
|
|
|
|
|
std::shared_ptr<ASTSettingsProfileElements> settings;
|
|
|
|
|
2020-05-30 20:10:45 +00:00
|
|
|
std::shared_ptr<ASTRolesOrUsersSet> to_roles;
|
2020-03-18 14:11:44 +00:00
|
|
|
|
|
|
|
String getID(char) const override;
|
|
|
|
ASTPtr clone() const override;
|
|
|
|
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
2020-04-22 05:39:31 +00:00
|
|
|
void replaceCurrentUserTagWithName(const String & current_user_name) const;
|
2020-04-05 23:03:20 +00:00
|
|
|
ASTPtr getRewrittenASTWithoutOnCluster(const std::string &) const override { return removeOnCluster<ASTCreateSettingsProfileQuery>(clone()); }
|
2020-03-18 14:11:44 +00:00
|
|
|
};
|
|
|
|
}
|