MySQL  8.0.27
Source Code Documentation
parse_tree_column_attrs.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef PARSE_TREE_COL_ATTRS_INCLUDED
24 #define PARSE_TREE_COL_ATTRS_INCLUDED
25 
26 #include <assert.h>
27 #include <sys/types.h> // ulong, uint. TODO: replace with cstdint
28 
29 #include <optional>
30 #include <type_traits>
31 #include <vector>
32 
33 #include "field_types.h"
34 #include "lex_string.h"
35 #include "m_ctype.h"
36 #include "my_alloc.h"
37 #include "my_base.h"
38 #include "my_compiler.h"
39 
40 #include "my_inttypes.h"
41 #include "my_sys.h"
42 #include "mysql_com.h"
43 #include "mysqld_error.h"
44 #include "sql/derror.h"
45 #include "sql/field.h"
46 #include "sql/gis/srid.h"
47 #include "sql/item.h"
48 #include "sql/item_timefunc.h"
49 #include "sql/mem_root_array.h"
50 #include "sql/parse_location.h"
51 #include "sql/parse_tree_helpers.h" // move_cf_appliers
53 #include "sql/parser_yystype.h"
54 #include "sql/sql_alter.h"
55 #include "sql/sql_check_constraint.h" // Sql_check_constraint_spec
56 #include "sql/sql_class.h"
57 #include "sql/sql_error.h"
58 #include "sql/sql_lex.h"
59 #include "sql/sql_list.h"
60 #include "sql/sql_parse.h"
61 #include "sql/system_variables.h"
62 
63 class String;
64 
65 /**
66  Parse context for column type attribyte specific parse tree nodes.
67 
68  For internal use in the contextualization code.
69 
70  @ingroup ptn_column_attrs ptn_gcol_attrs
71 */
73  const bool is_generated; ///< Owner column is a generated one.
74  std::vector<CreateFieldApplier> cf_appliers;
75  Column_parse_context(THD *thd_arg, Query_block *select_arg, bool is_generated)
76  : Parse_context(thd_arg, select_arg), is_generated(is_generated) {}
77 };
78 
79 /**
80  Base class for all column attributes in @SQL{CREATE/ALTER TABLE}
81 
82  @ingroup ptn_column_attrs ptn_gcol_attrs
83 */
84 class PT_column_attr_base : public Parse_tree_node_tmpl<Column_parse_context> {
85  protected:
86  PT_column_attr_base() = default;
87 
88  public:
90 
91  virtual void apply_type_flags(ulong *) const {}
92  virtual void apply_alter_info_flags(ulonglong *) const {}
93  virtual void apply_comment(LEX_CSTRING *) const {}
94  virtual void apply_default_value(Item **) const {}
96  virtual void apply_on_update_value(Item **) const {}
97  virtual void apply_srid_modifier(std::optional<gis::srid_t> *) const {}
99  const CHARSET_INFO **to [[maybe_unused]],
100  bool *has_explicit_collation
101  [[maybe_unused]]) const {
102  return false;
103  }
104  virtual bool add_check_constraints(
105  Sql_check_constraint_spec_list *check_const_list [[maybe_unused]]) {
106  return false;
107  }
108 
109  /**
110  Check for the [NOT] ENFORCED characteristic.
111 
112  @returns true if the [NOT] ENFORCED follows the CHECK(...) clause,
113  false otherwise.
114  */
115  virtual bool has_constraint_enforcement() const { return false; }
116 
117  /**
118  Check if constraint is enforced.
119  Method must be called only when has_constraint_enforcement() is true (i.e
120  when [NOT] ENFORCED follows the CHECK(...) clause).
121 
122  @returns true if constraint is enforced.
123  false otherwise.
124  */
125  virtual bool is_constraint_enforced() const { return false; }
126 
127  /**
128  Update the ENFORCED/NOT ENFORCED state of the CHECK constraint.
129 
130  @param enforced true if ENFORCED, false if NOT ENFORCED.
131 
132  @returns false if success, true if error (e.g. if [NOT] ENFORCED follows
133  something other than the CHECK clause.)
134  */
135  virtual bool set_constraint_enforcement(bool enforced [[maybe_unused]]) {
136  return true; // error
137  }
138 };
139 
140 /**
141  Node for the @SQL{NULL} column attribute
142 
143  @ingroup ptn_column_attrs
144 */
146  public:
147  void apply_type_flags(ulong *type_flags) const override {
148  *type_flags &= ~NOT_NULL_FLAG;
149  *type_flags |= EXPLICIT_NULL_FLAG;
150  }
151 };
152 
153 /**
154  Node for the @SQL{NOT NULL} column attribute
155 
156  @ingroup ptn_column_attrs
157 */
159  void apply_type_flags(ulong *type_flags) const override {
160  *type_flags |= NOT_NULL_FLAG;
161  }
162 };
163 
164 /**
165  Node for the @SQL{NOT SECONDARY} column attribute
166 
167  @ingroup ptn_column_attrs
168 */
170  public:
171  void apply_type_flags(unsigned long *type_flags) const override {
172  *type_flags |= NOT_SECONDARY_FLAG;
173  }
174 };
175 
176 /**
177  Node for the @SQL{UNIQUE [KEY]} column attribute
178 
179  @ingroup ptn_column_attrs
180 */
182  public:
183  void apply_type_flags(ulong *type_flags) const override {
184  *type_flags |= UNIQUE_FLAG;
185  }
186 
187  void apply_alter_info_flags(ulonglong *flags) const override {
189  }
190 };
191 
192 /**
193  Node for the @SQL{PRIMARY [KEY]} column attribute
194 
195  @ingroup ptn_column_attrs
196 */
198  public:
199  void apply_type_flags(ulong *type_flags) const override {
200  *type_flags |= PRI_KEY_FLAG | NOT_NULL_FLAG;
201  }
202 
203  void apply_alter_info_flags(ulonglong *flags) const override {
205  }
206 };
207 
208 /**
209  Node for the @SQL{[CONSTRAINT [symbol]] CHECK '(' expr ')'} column attribute.
210 
211  @ingroup ptn_column_attrs
212 */
216 
217  public:
220  col_cc_spec.check_expr = expr;
221  }
222 
223  bool set_constraint_enforcement(bool enforced) override {
224  col_cc_spec.is_enforced = enforced;
225  return false;
226  }
227 
228  void apply_alter_info_flags(ulonglong *flags) const override {
230  }
231 
233  Sql_check_constraint_spec_list *check_const_list) override {
234  assert(check_const_list != nullptr);
235  return (check_const_list->push_back(&col_cc_spec));
236  }
237 
238  bool contextualize(Column_parse_context *pc) override {
239  return (super::contextualize(pc) ||
241  }
242 };
243 
244 /**
245  Node for the @SQL{[NOT] ENFORCED} column attribute.
246 
247  @ingroup ptn_column_attrs
248 */
250  public:
251  explicit PT_constraint_enforcement_attr(bool enforced)
252  : m_enforced(enforced) {}
253 
254  bool has_constraint_enforcement() const override { return true; }
255 
256  bool is_constraint_enforced() const override { return m_enforced; }
257 
258  private:
259  const bool m_enforced;
260 };
261 
262 /**
263  Node for the @SQL{COMMENT @<comment@>} column attribute
264 
265  @ingroup ptn_column_attrs
266 */
269 
270  public:
272  : comment(comment) {}
273 
274  void apply_comment(LEX_CSTRING *to) const override { *to = comment; }
275 };
276 
277 /**
278  Node for the @SQL{COLLATE @<collation@>} column attribute
279 
280  @ingroup ptn_column_attrs
281 */
283  public:
286  assert(m_collation != nullptr);
287  }
288 
290  bool *has_explicit_collation) const override {
291  if (*has_explicit_collation) {
292  pc->thd->syntax_error_at(m_pos, ER_INVALID_MULTIPLE_CLAUSES, "COLLATE");
293  return true;
294  }
295  *has_explicit_collation = true;
296  return merge_charset_and_collation(*to, m_collation, to);
297  }
298 
299  private:
300  const POS m_pos;
301  const CHARSET_INFO *const m_collation;
302 };
303 
304 // Specific to non-generated columns only:
305 
306 /**
307  Node for the @SQL{DEFAULT @<expression@>} column attribute
308 
309  @ingroup ptn_not_gcol_attr
310 */
313 
315 
316  public:
318  void apply_default_value(Item **value) const override { *value = item; }
319 
320  bool contextualize(Column_parse_context *pc) override {
321  if (pc->is_generated) {
322  my_error(ER_WRONG_USAGE, MYF(0), "DEFAULT", "generated column");
323  return true;
324  }
325  return super::contextualize(pc) || item->itemize(pc, &item);
326  }
327  void apply_type_flags(ulong *type_flags) const override {
328  if (item->type() == Item::NULL_ITEM) *type_flags |= EXPLICIT_NULL_FLAG;
329  }
330 };
331 
332 /**
333  Node for the @SQL{UPDATE NOW[([@<precision@>])]} column attribute
334 
335  @ingroup ptn_not_gcol_attr
336 */
339 
342 
343  public:
345  void apply_on_update_value(Item **value) const override { *value = item; }
346 
347  bool contextualize(Column_parse_context *pc) override {
348  if (pc->is_generated) {
349  my_error(ER_WRONG_USAGE, MYF(0), "ON UPDATE", "generated column");
350  return true;
351  }
352  if (super::contextualize(pc)) return true;
353 
355  return item == nullptr;
356  }
357 };
358 
359 /**
360  Node for the @SQL{AUTO_INCREMENT} column attribute
361 
362  @ingroup ptn_not_gcol_attr
363 */
366 
367  public:
368  void apply_type_flags(ulong *type_flags) const override {
369  *type_flags |= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG;
370  }
371  bool contextualize(Column_parse_context *pc) override {
372  if (pc->is_generated) {
373  my_error(ER_WRONG_USAGE, MYF(0), "AUTO_INCREMENT", "generated column");
374  return true;
375  }
376  return super::contextualize(pc);
377  }
378 };
379 
380 /**
381  Node for the @SQL{SERIAL DEFAULT VALUE} column attribute
382 
383  @ingroup ptn_not_gcol_attr
384 */
387 
388  public:
389  void apply_type_flags(ulong *type_flags) const override {
390  *type_flags |= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG;
391  }
392  void apply_alter_info_flags(ulonglong *flags) const override {
394  }
395  bool contextualize(Column_parse_context *pc) override {
396  if (pc->is_generated) {
397  my_error(ER_WRONG_USAGE, MYF(0), "SERIAL DEFAULT VALUE",
398  "generated column");
399  return true;
400  }
401  return super::contextualize(pc);
402  }
403 };
404 
405 /**
406  Node for the @SQL{COLUMN_FORMAT @<DEFAULT|FIXED|DYNAMIC@>} column attribute
407 
408  @ingroup ptn_not_gcol_attr
409 */
412 
414 
415  public:
417  : format(format) {}
418 
419  void apply_type_flags(ulong *type_flags) const override {
420  *type_flags &= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
421  *type_flags |= format << FIELD_FLAGS_COLUMN_FORMAT;
422  }
423  bool contextualize(Column_parse_context *pc) override {
424  if (pc->is_generated) {
425  my_error(ER_WRONG_USAGE, MYF(0), "COLUMN_FORMAT", "generated column");
426  return true;
427  }
428  return super::contextualize(pc);
429  }
430 };
431 
432 /**
433  Node for the @SQL{STORAGE @<DEFAULT|DISK|MEMORY@>} column attribute
434 
435  @ingroup ptn_not_gcol_attr
436 */
439 
441 
442  public:
444  : media(media) {}
445 
446  void apply_type_flags(ulong *type_flags) const override {
447  *type_flags &= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
448  *type_flags |= media << FIELD_FLAGS_STORAGE_MEDIA;
449  }
450  bool contextualize(Column_parse_context *pc) override {
451  if (pc->is_generated) {
452  my_error(ER_WRONG_USAGE, MYF(0), "STORAGE", "generated column");
453  return true;
454  }
455  return super::contextualize(pc);
456  }
457 };
458 
459 /// Node for the SRID column attribute
462 
464 
465  public:
466  explicit PT_srid_column_attr(gis::srid_t srid) : m_srid(srid) {}
467 
468  void apply_srid_modifier(std::optional<gis::srid_t> *srid) const override {
469  *srid = m_srid;
470  }
471 };
472 
473 /// Node for the generated default value, column attribute
476 
477  public:
481  }
482 
484  Value_generator **default_value_expression) override {
485  *default_value_expression = &m_default_value_expression;
486  }
487 
488  bool contextualize(Column_parse_context *pc) override {
489  // GC and default value expressions are mutually exclusive and thus only
490  // one is allowed to be present on the same column definition.
491  if (pc->is_generated) {
492  my_error(ER_WRONG_USAGE, MYF(0), "DEFAULT", "generated column");
493  return true;
494  }
495  Parse_context expr_pc(pc->thd, pc->select);
496  return super::contextualize(pc) ||
499  }
500 
501  private:
503 };
504 
505 /**
506  Node for the @SQL{VISIBLE|INVISIBLE} column attribute
507 
508  @ingroup ptn_column_attrs
509 */
511  public:
512  explicit PT_column_visibility_attr(bool is_visible)
513  : m_is_visible(is_visible) {}
514  void apply_type_flags(unsigned long *type_flags) const override {
515  *type_flags &= ~FIELD_IS_INVISIBLE;
516  if (!m_is_visible) *type_flags |= FIELD_IS_INVISIBLE;
517  }
518 
519  private:
520  const bool m_is_visible;
521 };
522 
523 // Type nodes:
524 
525 /**
526  Base class for all column type nodes
527 
528  @ingroup ptn_column_types
529 */
530 class PT_type : public Parse_tree_node {
531  public:
533 
534  protected:
536 
537  public:
538  virtual ulong get_type_flags() const { return 0; }
539  virtual const char *get_length() const { return nullptr; }
540  virtual const char *get_dec() const { return nullptr; }
541  virtual const CHARSET_INFO *get_charset() const { return nullptr; }
542  virtual uint get_uint_geom_type() const { return 0; }
543  virtual List<String> *get_interval_list() const { return nullptr; }
544 };
545 
546 /**
547  Node for numeric types
548 
549  Type list:
550  * NUMERIC, REAL, DOUBLE, DECIMAL and FIXED,
551  * INTEGER, INT, INT1, INT2, INT3, INT4, TINYINT, SMALLINT, MEDIUMINT and
552  BIGINT.
553 
554  @ingroup ptn_column_types
555 */
556 class PT_numeric_type : public PT_type {
557  const char *length;
558  const char *dec;
559  ulong options;
560 
561  using Parent_type = std::remove_const<decltype(PT_type::type)>::type;
562 
563  public:
564  PT_numeric_type(THD *thd, Numeric_type type_arg, const char *length,
565  const char *dec, ulong options)
566  : PT_type(static_cast<Parent_type>(type_arg)),
567  length(length),
568  dec(dec),
569  options(options) {
570  assert((options & ~(UNSIGNED_FLAG | ZEROFILL_FLAG)) == 0);
571 
572  if (type_arg != Numeric_type::DECIMAL && dec != nullptr) {
574  ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
575  ER_THD(thd, ER_WARN_DEPRECATED_FLOAT_DIGITS));
576  }
577  if (options & UNSIGNED_FLAG) {
579  ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
580  ER_THD(thd, ER_WARN_DEPRECATED_FLOAT_UNSIGNED));
581  }
582  }
583  PT_numeric_type(THD *thd, Int_type type_arg, const char *length,
584  ulong options)
585  : PT_type(static_cast<enum_field_types>(type_arg)),
586  length(length),
587  dec(nullptr),
588  options(options) {
589  assert((options & ~(UNSIGNED_FLAG | ZEROFILL_FLAG)) == 0);
590 
591  if (length != nullptr) {
593  ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
594  ER_THD(thd, ER_WARN_DEPRECATED_INTEGER_DISPLAY_WIDTH));
595  }
596  }
597 
598  ulong get_type_flags() const override {
600  }
601  const char *get_length() const override { return length; }
602  const char *get_dec() const override { return dec; }
603 };
604 
605 /**
606  Node for the BIT type
607 
608  @ingroup ptn_column_types
609 */
610 class PT_bit_type : public PT_type {
611  const char *length;
612 
613  public:
615  explicit PT_bit_type(const char *length)
617 
618  const char *get_length() const override { return length; }
619 };
620 
621 /**
622  Node for the BOOL/BOOLEAN type
623 
624  @ingroup ptn_column_types
625 */
626 class PT_boolean_type : public PT_type {
627  public:
629  const char *get_length() const override { return "1"; }
630 };
631 
632 enum class Char_type : ulong {
636 };
637 
638 class PT_char_type : public PT_type {
639  const char *length;
641  const bool force_binary;
642 
643  using Parent_type = std::remove_const<decltype(PT_type::type)>::type;
644 
645  public:
646  PT_char_type(Char_type char_type, const char *length,
647  const CHARSET_INFO *charset, bool force_binary = false)
648  : PT_type(static_cast<Parent_type>(char_type)),
649  length(length),
650  charset(charset),
652  assert(charset == nullptr || !force_binary);
653  }
655  bool force_binary = false)
656  : PT_char_type(char_type, "1", charset, force_binary) {}
657  ulong get_type_flags() const override {
658  return force_binary ? BINCMP_FLAG : 0;
659  }
660  const char *get_length() const override { return length; }
661  const CHARSET_INFO *get_charset() const override { return charset; }
662 };
663 
664 enum class Blob_type {
668 };
669 
670 /**
671  Node for BLOB types
672 
673  Types: BLOB, TINYBLOB, MEDIUMBLOB, LONGBLOB, LONG, LONG VARBINARY,
674  LONG VARCHAR, TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
675 
676  @ingroup ptn_column_types
677 */
678 class PT_blob_type : public PT_type {
679  const char *length;
681  const bool force_binary;
682 
683  using Parent_type = std::remove_const<decltype(PT_type::type)>::type;
684 
685  public:
687  bool force_binary = false)
688  : PT_type(static_cast<Parent_type>(blob_type)),
689  length(nullptr),
690  charset(charset),
692  assert(charset == nullptr || !force_binary);
693  }
694  explicit PT_blob_type(const char *length)
696  length(length),
698  force_binary(false) {}
699 
700  ulong get_type_flags() const override {
701  return force_binary ? BINCMP_FLAG : 0;
702  }
703  const CHARSET_INFO *get_charset() const override { return charset; }
704  const char *get_length() const override { return length; }
705 };
706 
707 /**
708  Node for the YEAR type
709 
710  @ingroup ptn_column_types
711 */
712 class PT_year_type : public PT_type {
713  public:
715 };
716 
717 /**
718  Node for the DATE type
719 
720  @ingroup ptn_column_types
721 */
722 class PT_date_type : public PT_type {
723  public:
725 };
726 
727 enum class Time_type : ulong {
730 };
731 
732 /**
733  Node for the TIME, TIMESTAMP and DATETIME types
734 
735  @ingroup ptn_column_types
736 */
737 class PT_time_type : public PT_type {
738  const char *dec;
739 
740  using Parent_type = std::remove_const<decltype(PT_type::type)>::type;
741 
742  public:
743  PT_time_type(Time_type time_type, const char *dec)
744  : PT_type(static_cast<Parent_type>(time_type)), dec(dec) {}
745 
746  const char *get_dec() const override { return dec; }
747 };
748 
749 /**
750  Node for the TIMESTAMP type
751 
752  @ingroup ptn_column_types
753 */
754 class PT_timestamp_type : public PT_type {
755  typedef PT_type super;
756 
757  const char *dec;
758  ulong type_flags;
759 
760  public:
761  explicit PT_timestamp_type(const char *dec)
763 
764  const char *get_dec() const override { return dec; }
765  ulong get_type_flags() const override { return type_flags; }
766 
767  bool contextualize(Parse_context *pc) override {
768  if (super::contextualize(pc)) return true;
769  /*
770  TIMESTAMP fields are NOT NULL by default, unless the variable
771  explicit_defaults_for_timestamp is true.
772  */
775  /*
776  To flag the current statement as dependent for binary
777  logging on the session var. Extra copying to Lex is
778  done in case prepared stmt.
779  */
782 
783  return false;
784  }
785 };
786 
787 /**
788  Node for spatial types
789 
790  Types: GEOMETRY, GEOMCOLLECTION/GEOMETRYCOLLECTION, POINT, MULTIPOINT,
791  LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON
792 
793  @ingroup ptn_column_types
794 */
795 class PT_spacial_type : public PT_type {
797 
798  public:
801 
802  const CHARSET_INFO *get_charset() const override { return &my_charset_bin; }
803  uint get_uint_geom_type() const override { return geo_type; }
804  const char *get_length() const override { return nullptr; }
805 };
806 
808 
809 template <Enum_type enum_type>
810 class PT_enum_type_tmpl : public PT_type {
813  const bool force_binary;
814 
815  using Parent_type = std::remove_const<decltype(PT_type::type)>::type;
816 
817  public:
819  bool force_binary)
820  : PT_type(static_cast<Parent_type>(enum_type)),
822  charset(charset),
824  assert(charset == nullptr || !force_binary);
825  }
826 
827  const CHARSET_INFO *get_charset() const override { return charset; }
828  ulong get_type_flags() const override {
829  return force_binary ? BINCMP_FLAG : 0;
830  }
831  List<String> *get_interval_list() const override { return interval_list; }
832 };
833 
834 /**
835  Node for the ENUM type
836 
837  @ingroup ptn_column_types
838 */
840 
841 /**
842  Node for the SET type
843 
844  @ingroup ptn_column_types
845 */
847 
848 class PT_serial_type : public PT_type {
849  public:
851 
852  ulong get_type_flags() const override {
854  }
855 };
856 
857 /**
858  Node for the JSON type
859 
860  @ingroup ptn_column_types
861 */
862 class PT_json_type : public PT_type {
863  public:
865  const CHARSET_INFO *get_charset() const override { return &my_charset_bin; }
866 };
867 
868 /**
869  Base class for both generated and regular column definitions
870 
871  @ingroup ptn_create_table
872 */
876 
877  public:
879  ulong type_flags;
880  const char *length;
881  const char *dec;
891  /// Holds the expression to generate default values
893  std::optional<gis::srid_t> m_srid;
894  // List of column check constraint's specification.
896 
897  protected:
899 
901  : has_explicit_collation(false),
902  alter_info_flags(0),
908  type_node(type_node) {}
909 
910  public:
911  bool contextualize(Parse_context *pc) override {
912  if (super::contextualize(pc) || type_node->contextualize(pc)) return true;
913 
914  type = type_node->type;
917  dec = type_node->get_dec();
921  check_const_spec_list = new (pc->thd->mem_root)
923  if (check_const_spec_list == nullptr) return true; // OOM
924  return false;
925  }
926 
927  protected:
928  template <class T>
930  Mem_root_array<T *> *attrs) {
931  if (attrs != nullptr) {
932  for (auto attr : *attrs) {
933  if (attr->contextualize(pc)) return true;
934  attr->apply_type_flags(&type_flags);
935  attr->apply_alter_info_flags(&alter_info_flags);
936  attr->apply_comment(&comment);
937  attr->apply_default_value(&default_value);
938  attr->apply_gen_default_value(&default_val_info);
939  attr->apply_on_update_value(&on_update_value);
940  attr->apply_srid_modifier(&m_srid);
941  if (attr->apply_collation(pc, &charset, &has_explicit_collation))
942  return true;
943  if (attr->add_check_constraints(check_const_spec_list)) return true;
944  }
945  }
946  return false;
947  }
948 };
949 
950 /**
951  Base class for regular (non-generated) column definition nodes
952 
953  @ingroup ptn_create_table
954 */
957 
959 
960  public:
961  PT_field_def(PT_type *type_node_arg,
963  : super(type_node_arg), opt_attrs(opt_attrs) {}
964 
965  bool contextualize(Parse_context *pc_arg) override {
966  Column_parse_context pc(pc_arg->thd, pc_arg->select, false);
968  return true;
969 
970  move_cf_appliers(pc_arg, &pc);
971  return false;
972  }
973 };
974 
975 /**
976  Base class for generated column definition nodes
977 
978  @ingroup ptn_create_table
979 */
982 
986 
987  public:
991  : super(type_node_arg),
993  expr(expr),
994  opt_attrs(opt_attrs) {}
995 
996  bool contextualize(Parse_context *pc_arg) override {
997  Column_parse_context pc(pc_arg->thd, pc_arg->select, true);
999  expr->itemize(&pc, &expr))
1000  return true;
1001 
1002  gcol_info = new (pc.mem_root) Value_generator;
1003  if (gcol_info == nullptr) return true; // OOM
1006  gcol_info->set_field_stored(true);
1008 
1009  return false;
1010  }
1011 };
1012 
1014 
1015 #endif /* PARSE_TREE_COL_ATTRS_INCLUDED */
ulonglong flags
Definition: sql_alter.h:428
@ ADD_CHECK_CONSTRAINT
Set for add check constraint.
Definition: sql_alter.h:318
@ ALTER_ADD_INDEX
Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | ADD UNIQUE INDEX | ALTER ADD [COLUMN...
Definition: sql_alter.h:228
geometry_type
Definition: field.h:733
Definition: item_timefunc.h:1154
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
virtual bool itemize(Parse_context *pc, Item **res)
The same as contextualize() but with additional parameter.
Definition: item.cc:616
@ NULL_ITEM
Definition: item.h:846
virtual enum Type type() const =0
bool push_back(const Element_type &element)
Adds a new element at the end of the array, after its current last element.
Definition: mem_root_array.h:182
Node for the AUTO_INCREMENT column attribute.
Definition: parse_tree_column_attrs.h:364
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:365
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:368
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:371
Node for the BIT type.
Definition: parse_tree_column_attrs.h:610
PT_bit_type(const char *length)
Definition: parse_tree_column_attrs.h:615
const char * get_length() const override
Definition: parse_tree_column_attrs.h:618
const char * length
Definition: parse_tree_column_attrs.h:611
PT_bit_type()
Definition: parse_tree_column_attrs.h:614
Node for BLOB types.
Definition: parse_tree_column_attrs.h:678
const CHARSET_INFO * charset
Definition: parse_tree_column_attrs.h:680
const char * get_length() const override
Definition: parse_tree_column_attrs.h:704
const CHARSET_INFO * get_charset() const override
Definition: parse_tree_column_attrs.h:703
const char * length
Definition: parse_tree_column_attrs.h:679
PT_blob_type(const char *length)
Definition: parse_tree_column_attrs.h:694
PT_blob_type(Blob_type blob_type, const CHARSET_INFO *charset, bool force_binary=false)
Definition: parse_tree_column_attrs.h:686
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:700
std::remove_const< decltype(PT_type::type)>::type Parent_type
Definition: parse_tree_column_attrs.h:683
const bool force_binary
Definition: parse_tree_column_attrs.h:681
Node for the BOOL/BOOLEAN type.
Definition: parse_tree_column_attrs.h:626
PT_boolean_type()
Definition: parse_tree_column_attrs.h:628
const char * get_length() const override
Definition: parse_tree_column_attrs.h:629
Definition: parse_tree_column_attrs.h:638
PT_char_type(Char_type char_type, const CHARSET_INFO *charset, bool force_binary=false)
Definition: parse_tree_column_attrs.h:654
std::remove_const< decltype(PT_type::type)>::type Parent_type
Definition: parse_tree_column_attrs.h:643
const char * get_length() const override
Definition: parse_tree_column_attrs.h:660
const CHARSET_INFO * get_charset() const override
Definition: parse_tree_column_attrs.h:661
const char * length
Definition: parse_tree_column_attrs.h:639
PT_char_type(Char_type char_type, const char *length, const CHARSET_INFO *charset, bool force_binary=false)
Definition: parse_tree_column_attrs.h:646
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:657
const CHARSET_INFO * charset
Definition: parse_tree_column_attrs.h:640
const bool force_binary
Definition: parse_tree_column_attrs.h:641
Node for the [CONSTRAINT [symbol]] CHECK '(' expr ')' column attribute.
Definition: parse_tree_column_attrs.h:213
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:238
void apply_alter_info_flags(ulonglong *flags) const override
Definition: parse_tree_column_attrs.h:228
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:214
bool add_check_constraints(Sql_check_constraint_spec_list *check_const_list) override
Definition: parse_tree_column_attrs.h:232
bool set_constraint_enforcement(bool enforced) override
Definition: parse_tree_column_attrs.h:223
PT_check_constraint_column_attr(LEX_STRING &name, Item *expr)
Definition: parse_tree_column_attrs.h:218
Sql_check_constraint_spec col_cc_spec
Definition: parse_tree_column_attrs.h:215
Node for the COLLATE <collation> column attribute.
Definition: parse_tree_column_attrs.h:282
const POS m_pos
Definition: parse_tree_column_attrs.h:300
bool apply_collation(Column_parse_context *pc, const CHARSET_INFO **to, bool *has_explicit_collation) const override
Definition: parse_tree_column_attrs.h:289
PT_collate_column_attr(const POS &pos, const CHARSET_INFO *collation)
Definition: parse_tree_column_attrs.h:284
const CHARSET_INFO *const m_collation
Definition: parse_tree_column_attrs.h:301
Base class for all column attributes in CREATE/ALTER TABLE
Definition: parse_tree_column_attrs.h:84
virtual bool is_constraint_enforced() const
Check if constraint is enforced.
Definition: parse_tree_column_attrs.h:125
virtual void apply_alter_info_flags(ulonglong *) const
Definition: parse_tree_column_attrs.h:92
virtual void apply_srid_modifier(std::optional< gis::srid_t > *) const
Definition: parse_tree_column_attrs.h:97
virtual void apply_gen_default_value(Value_generator **)
Definition: parse_tree_column_attrs.h:95
virtual bool set_constraint_enforcement(bool enforced[[maybe_unused]])
Update the ENFORCED/NOT ENFORCED state of the CHECK constraint.
Definition: parse_tree_column_attrs.h:135
decltype(Alter_info::flags) typedef alter_info_flags_t
Definition: parse_tree_column_attrs.h:89
virtual bool apply_collation(Column_parse_context *, const CHARSET_INFO **to[[maybe_unused]], bool *has_explicit_collation[[maybe_unused]]) const
Definition: parse_tree_column_attrs.h:98
virtual void apply_on_update_value(Item **) const
Definition: parse_tree_column_attrs.h:96
virtual void apply_type_flags(ulong *) const
Definition: parse_tree_column_attrs.h:91
virtual void apply_comment(LEX_CSTRING *) const
Definition: parse_tree_column_attrs.h:93
PT_column_attr_base()=default
virtual bool add_check_constraints(Sql_check_constraint_spec_list *check_const_list[[maybe_unused]])
Definition: parse_tree_column_attrs.h:104
virtual bool has_constraint_enforcement() const
Check for the [NOT] ENFORCED characteristic.
Definition: parse_tree_column_attrs.h:115
virtual void apply_default_value(Item **) const
Definition: parse_tree_column_attrs.h:94
Node for the COLUMN_FORMAT <DEFAULT|FIXED|DYNAMIC> column attribute.
Definition: parse_tree_column_attrs.h:410
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:423
PT_column_format_column_attr(column_format_type format)
Definition: parse_tree_column_attrs.h:416
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:411
column_format_type format
Definition: parse_tree_column_attrs.h:413
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:419
Node for the VISIBLE|INVISIBLE column attribute.
Definition: parse_tree_column_attrs.h:510
PT_column_visibility_attr(bool is_visible)
Definition: parse_tree_column_attrs.h:512
void apply_type_flags(unsigned long *type_flags) const override
Definition: parse_tree_column_attrs.h:514
const bool m_is_visible
Definition: parse_tree_column_attrs.h:520
Node for the COMMENT <comment> column attribute.
Definition: parse_tree_column_attrs.h:267
void apply_comment(LEX_CSTRING *to) const override
Definition: parse_tree_column_attrs.h:274
PT_comment_column_attr(const LEX_CSTRING &comment)
Definition: parse_tree_column_attrs.h:271
const LEX_CSTRING comment
Definition: parse_tree_column_attrs.h:268
Node for the [NOT] ENFORCED column attribute.
Definition: parse_tree_column_attrs.h:249
bool has_constraint_enforcement() const override
Check for the [NOT] ENFORCED characteristic.
Definition: parse_tree_column_attrs.h:254
PT_constraint_enforcement_attr(bool enforced)
Definition: parse_tree_column_attrs.h:251
bool is_constraint_enforced() const override
Check if constraint is enforced.
Definition: parse_tree_column_attrs.h:256
const bool m_enforced
Definition: parse_tree_column_attrs.h:259
Node for the DATE type.
Definition: parse_tree_column_attrs.h:722
PT_date_type()
Definition: parse_tree_column_attrs.h:724
Node for the DEFAULT <expression> column attribute.
Definition: parse_tree_column_attrs.h:311
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:327
void apply_default_value(Item **value) const override
Definition: parse_tree_column_attrs.h:318
PT_default_column_attr(Item *item)
Definition: parse_tree_column_attrs.h:317
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:320
Item * item
Definition: parse_tree_column_attrs.h:314
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:312
Definition: parse_tree_column_attrs.h:810
List< String > * get_interval_list() const override
Definition: parse_tree_column_attrs.h:831
List< String > *const interval_list
Definition: parse_tree_column_attrs.h:811
const CHARSET_INFO * charset
Definition: parse_tree_column_attrs.h:812
const bool force_binary
Definition: parse_tree_column_attrs.h:813
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:828
std::remove_const< decltype(PT_type::type)>::type Parent_type
Definition: parse_tree_column_attrs.h:815
const CHARSET_INFO * get_charset() const override
Definition: parse_tree_column_attrs.h:827
PT_enum_type_tmpl(List< String > *interval_list, const CHARSET_INFO *charset, bool force_binary)
Definition: parse_tree_column_attrs.h:818
Base class for both generated and regular column definitions.
Definition: parse_tree_column_attrs.h:873
bool contextualize_attrs(Column_parse_context *pc, Mem_root_array< T * > *attrs)
Definition: parse_tree_column_attrs.h:929
LEX_CSTRING comment
Definition: parse_tree_column_attrs.h:887
enum_field_types type
Definition: parse_tree_column_attrs.h:878
Value_generator * gcol_info
Definition: parse_tree_column_attrs.h:890
const CHARSET_INFO * charset
Definition: parse_tree_column_attrs.h:882
List< String > * interval_list
Definition: parse_tree_column_attrs.h:885
const char * dec
Definition: parse_tree_column_attrs.h:881
bool has_explicit_collation
Definition: parse_tree_column_attrs.h:883
Item * on_update_value
Definition: parse_tree_column_attrs.h:889
std::optional< gis::srid_t > m_srid
Definition: parse_tree_column_attrs.h:893
const char * length
Definition: parse_tree_column_attrs.h:880
Parse_tree_node super
Definition: parse_tree_column_attrs.h:874
PT_type * type_node
Definition: parse_tree_column_attrs.h:898
alter_info_flags_t alter_info_flags
Definition: parse_tree_column_attrs.h:886
Item * default_value
Definition: parse_tree_column_attrs.h:888
Value_generator * default_val_info
Holds the expression to generate default values.
Definition: parse_tree_column_attrs.h:892
bool contextualize(Parse_context *pc) override
Definition: parse_tree_column_attrs.h:911
Sql_check_constraint_spec_list * check_const_spec_list
Definition: parse_tree_column_attrs.h:895
decltype(Alter_info::flags) typedef alter_info_flags_t
Definition: parse_tree_column_attrs.h:875
ulong type_flags
Definition: parse_tree_column_attrs.h:879
PT_field_def_base(PT_type *type_node)
Definition: parse_tree_column_attrs.h:900
uint uint_geom_type
Definition: parse_tree_column_attrs.h:884
Base class for regular (non-generated) column definition nodes.
Definition: parse_tree_column_attrs.h:955
PT_field_def_base super
Definition: parse_tree_column_attrs.h:956
bool contextualize(Parse_context *pc_arg) override
Definition: parse_tree_column_attrs.h:965
PT_field_def(PT_type *type_node_arg, Mem_root_array< PT_column_attr_base * > *opt_attrs)
Definition: parse_tree_column_attrs.h:961
Mem_root_array< PT_column_attr_base * > * opt_attrs
Definition: parse_tree_column_attrs.h:958
Node for the generated default value, column attribute.
Definition: parse_tree_column_attrs.h:474
Value_generator m_default_value_expression
Definition: parse_tree_column_attrs.h:502
void apply_gen_default_value(Value_generator **default_value_expression) override
Definition: parse_tree_column_attrs.h:483
PT_generated_default_val_column_attr(Item *expr)
Definition: parse_tree_column_attrs.h:478
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:475
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:488
Base class for generated column definition nodes.
Definition: parse_tree_column_attrs.h:980
Item * expr
Definition: parse_tree_column_attrs.h:984
Mem_root_array< PT_column_attr_base * > * opt_attrs
Definition: parse_tree_column_attrs.h:985
PT_generated_field_def(PT_type *type_node_arg, Item *expr, Virtual_or_stored virtual_or_stored, Mem_root_array< PT_column_attr_base * > *opt_attrs)
Definition: parse_tree_column_attrs.h:988
PT_field_def_base super
Definition: parse_tree_column_attrs.h:981
const Virtual_or_stored virtual_or_stored
Definition: parse_tree_column_attrs.h:983
bool contextualize(Parse_context *pc_arg) override
Definition: parse_tree_column_attrs.h:996
Node for the JSON type.
Definition: parse_tree_column_attrs.h:862
PT_json_type()
Definition: parse_tree_column_attrs.h:864
const CHARSET_INFO * get_charset() const override
Definition: parse_tree_column_attrs.h:865
Node for the NOT NULL column attribute.
Definition: parse_tree_column_attrs.h:158
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:159
Node for the NULL column attribute.
Definition: parse_tree_column_attrs.h:145
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:147
Node for numeric types.
Definition: parse_tree_column_attrs.h:556
PT_numeric_type(THD *thd, Numeric_type type_arg, const char *length, const char *dec, ulong options)
Definition: parse_tree_column_attrs.h:564
PT_numeric_type(THD *thd, Int_type type_arg, const char *length, ulong options)
Definition: parse_tree_column_attrs.h:583
std::remove_const< decltype(PT_type::type)>::type Parent_type
Definition: parse_tree_column_attrs.h:561
const char * dec
Definition: parse_tree_column_attrs.h:558
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:598
ulong options
Definition: parse_tree_column_attrs.h:559
const char * length
Definition: parse_tree_column_attrs.h:557
const char * get_length() const override
Definition: parse_tree_column_attrs.h:601
const char * get_dec() const override
Definition: parse_tree_column_attrs.h:602
Node for the UPDATE NOW[([<precision>])] column attribute.
Definition: parse_tree_column_attrs.h:337
PT_on_update_column_attr(uint8 precision)
Definition: parse_tree_column_attrs.h:344
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:347
const uint8 precision
Definition: parse_tree_column_attrs.h:340
void apply_on_update_value(Item **value) const override
Definition: parse_tree_column_attrs.h:345
Item * item
Definition: parse_tree_column_attrs.h:341
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:338
Node for the PRIMARY [KEY] column attribute.
Definition: parse_tree_column_attrs.h:197
void apply_alter_info_flags(ulonglong *flags) const override
Definition: parse_tree_column_attrs.h:203
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:199
Node for the NOT SECONDARY column attribute.
Definition: parse_tree_column_attrs.h:169
void apply_type_flags(unsigned long *type_flags) const override
Definition: parse_tree_column_attrs.h:171
Node for the SERIAL DEFAULT VALUE column attribute.
Definition: parse_tree_column_attrs.h:385
void apply_alter_info_flags(ulonglong *flags) const override
Definition: parse_tree_column_attrs.h:392
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:386
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:389
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:395
Definition: parse_tree_column_attrs.h:848
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:852
PT_serial_type()
Definition: parse_tree_column_attrs.h:850
Node for spatial types.
Definition: parse_tree_column_attrs.h:795
const CHARSET_INFO * get_charset() const override
Definition: parse_tree_column_attrs.h:802
Field::geometry_type geo_type
Definition: parse_tree_column_attrs.h:796
const char * get_length() const override
Definition: parse_tree_column_attrs.h:804
uint get_uint_geom_type() const override
Definition: parse_tree_column_attrs.h:803
PT_spacial_type(Field::geometry_type geo_type)
Definition: parse_tree_column_attrs.h:799
Node for the SRID column attribute.
Definition: parse_tree_column_attrs.h:460
void apply_srid_modifier(std::optional< gis::srid_t > *srid) const override
Definition: parse_tree_column_attrs.h:468
PT_srid_column_attr(gis::srid_t srid)
Definition: parse_tree_column_attrs.h:466
gis::srid_t m_srid
Definition: parse_tree_column_attrs.h:463
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:461
Node for the STORAGE <DEFAULT|DISK|MEMORY> column attribute.
Definition: parse_tree_column_attrs.h:437
PT_column_attr_base super
Definition: parse_tree_column_attrs.h:438
ha_storage_media media
Definition: parse_tree_column_attrs.h:440
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:446
bool contextualize(Column_parse_context *pc) override
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_column_attrs.h:450
PT_storage_media_column_attr(ha_storage_media media)
Definition: parse_tree_column_attrs.h:443
Node for the TIME, TIMESTAMP and DATETIME types.
Definition: parse_tree_column_attrs.h:737
const char * dec
Definition: parse_tree_column_attrs.h:738
const char * get_dec() const override
Definition: parse_tree_column_attrs.h:746
PT_time_type(Time_type time_type, const char *dec)
Definition: parse_tree_column_attrs.h:743
std::remove_const< decltype(PT_type::type)>::type Parent_type
Definition: parse_tree_column_attrs.h:740
Node for the TIMESTAMP type.
Definition: parse_tree_column_attrs.h:754
ulong type_flags
Definition: parse_tree_column_attrs.h:758
PT_timestamp_type(const char *dec)
Definition: parse_tree_column_attrs.h:761
const char * get_dec() const override
Definition: parse_tree_column_attrs.h:764
const char * dec
Definition: parse_tree_column_attrs.h:757
ulong get_type_flags() const override
Definition: parse_tree_column_attrs.h:765
bool contextualize(Parse_context *pc) override
Definition: parse_tree_column_attrs.h:767
PT_type super
Definition: parse_tree_column_attrs.h:755
Base class for all column type nodes.
Definition: parse_tree_column_attrs.h:530
virtual const char * get_length() const
Definition: parse_tree_column_attrs.h:539
virtual ulong get_type_flags() const
Definition: parse_tree_column_attrs.h:538
const enum_field_types type
Definition: parse_tree_column_attrs.h:532
virtual uint get_uint_geom_type() const
Definition: parse_tree_column_attrs.h:542
virtual const char * get_dec() const
Definition: parse_tree_column_attrs.h:540
virtual List< String > * get_interval_list() const
Definition: parse_tree_column_attrs.h:543
virtual const CHARSET_INFO * get_charset() const
Definition: parse_tree_column_attrs.h:541
PT_type(enum_field_types type)
Definition: parse_tree_column_attrs.h:535
Node for the UNIQUE [KEY] column attribute.
Definition: parse_tree_column_attrs.h:181
void apply_alter_info_flags(ulonglong *flags) const override
Definition: parse_tree_column_attrs.h:187
void apply_type_flags(ulong *type_flags) const override
Definition: parse_tree_column_attrs.h:183
Node for the YEAR type.
Definition: parse_tree_column_attrs.h:712
PT_year_type()
Definition: parse_tree_column_attrs.h:714
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:102
virtual bool contextualize(Column_parse_context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:150
MEM_ROOT * mem_root
Definition: sql_class.h:243
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1123
Class to represent the check constraint specifications obtained from the SQL statement parse.
Definition: sql_check_constraint.h:42
Item * check_expr
Check constraint expression.
Definition: sql_check_constraint.h:79
bool is_enforced
Check constraint state (enforced/not enforced)
Definition: sql_check_constraint.h:85
LEX_STRING name
Name of the check constraint.
Definition: sql_check_constraint.h:76
@ SL_WARNING
Definition: sql_error.h:59
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:165
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
void syntax_error_at(const YYLTYPE &location)
Definition: sql_class.h:4183
LEX * lex
Definition: sql_class.h:879
bool binlog_need_explicit_defaults_ts
The member is served for marking a query that CREATEs or ALTERs a table declared with a TIMESTAMP col...
Definition: sql_class.h:2353
struct System_variables variables
Definition: sql_class.h:1006
Used for storing information associated with generated column, default values generated from expressi...
Definition: field.h:481
void set_field_stored(bool stored)
Definition: field.h:545
void set_field_type(enum_field_types fld_type)
Definition: field.h:528
Item * expr_item
Item representing the generation expression.
Definition: field.h:491
Mem_root_array< Sql_check_constraint_spec * > Sql_check_constraint_spec_list
Definition: dd_table.h:48
const char * ER_THD(const THD *thd, int mysql_errno)
Definition: derror.cc:102
Dialog Client Authentication nullptr
Definition: dialog.cc:352
char * pos
Definition: do_ctype.cc:76
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
@ MYSQL_TYPE_TIME2
Internal to MySQL.
Definition: field_types.h:76
@ MYSQL_TYPE_VARCHAR
Definition: field_types.h:72
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:65
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:86
@ MYSQL_TYPE_BLOB
Definition: field_types.h:87
@ MYSQL_TYPE_TINY
Definition: field_types.h:58
@ MYSQL_TYPE_SET
Definition: field_types.h:83
@ MYSQL_TYPE_JSON
Definition: field_types.h:80
@ MYSQL_TYPE_STRING
Definition: field_types.h:89
@ MYSQL_TYPE_ENUM
Definition: field_types.h:82
@ MYSQL_TYPE_TINY_BLOB
Definition: field_types.h:84
@ MYSQL_TYPE_BIT
Definition: field_types.h:73
@ MYSQL_TYPE_GEOMETRY
Definition: field_types.h:90
@ MYSQL_TYPE_MEDIUM_BLOB
Definition: field_types.h:85
@ MYSQL_TYPE_DATETIME2
Internal to MySQL.
Definition: field_types.h:75
@ MYSQL_TYPE_DATE
Definition: field_types.h:67
@ MYSQL_TYPE_TIMESTAMP2
Definition: field_types.h:74
@ MYSQL_TYPE_YEAR
Definition: field_types.h:70
bool merge_charset_and_collation(const CHARSET_INFO *charset, const CHARSET_INFO *collation, const CHARSET_INFO **to)
(end of group Runtime_Environment)
Definition: sql_parse.cc:7057
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
#define PRI_KEY_FLAG
Field is part of a primary key.
Definition: mysql_com.h:154
#define FIELD_FLAGS_COLUMN_FORMAT
Field column format, bit 24-25.
Definition: mysql_com.h:186
#define ZEROFILL_FLAG
Field is zerofill.
Definition: mysql_com.h:159
#define UNSIGNED_FLAG
Field is unsigned.
Definition: mysql_com.h:158
#define UNIQUE_FLAG
Intern: Used by sql_yacc.
Definition: mysql_com.h:172
#define AUTO_INCREMENT_FLAG
field is a autoincrement field
Definition: mysql_com.h:164
#define FIELD_FLAGS_COLUMN_FORMAT_MASK
Definition: mysql_com.h:187
#define NOT_NULL_FLAG
Field can't be NULL.
Definition: mysql_com.h:153
#define BINCMP_FLAG
Intern: Used by sql_yacc.
Definition: mysql_com.h:173
#define FIELD_IS_INVISIBLE
Field is explicitly marked as invisible by the user.
Definition: mysql_com.h:197
#define EXPLICIT_NULL_FLAG
Field is explicitly specified as \ NULL by the user.
Definition: mysql_com.h:189
#define FIELD_FLAGS_STORAGE_MEDIA_MASK
Definition: mysql_com.h:185
#define NOT_SECONDARY_FLAG
Field will not be loaded in secondary engine.
Definition: mysql_com.h:195
#define FIELD_FLAGS_STORAGE_MEDIA
Field storage media, bit 22-23.
Definition: mysql_com.h:184
static int flags[50]
Definition: hp_test1.cc:39
constexpr const LEX_CSTRING EMPTY_CSTR
Definition: lex_string.h:46
A better implementation of the UNIX ctype(3) library.
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:510
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
This file includes constants used by all storage engines.
ha_storage_media
Definition: my_base.h:114
Header for compiler-dependent features.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
uint8_t uint8
Definition: my_inttypes.h:62
#define MYF(v)
Definition: my_inttypes.h:96
Common header for many mysys elements.
Common definition between mysql server & client.
const char * collation
Definition: audit_api_message_emit.cc:183
std::uint32_t srid_t
A spatial reference system ID (SRID).
Definition: srid.h:32
Definition: options.cc:45
Blob_type
Definition: parse_tree_column_attrs.h:664
Enum_type
Definition: parse_tree_column_attrs.h:807
Char_type
Definition: parse_tree_column_attrs.h:632
PT_enum_type_tmpl< Enum_type::ENUM > PT_enum_type
Node for the ENUM type.
Definition: parse_tree_column_attrs.h:839
PT_enum_type_tmpl< Enum_type::SET > PT_set_type
Node for the SET type.
Definition: parse_tree_column_attrs.h:846
Time_type
Definition: parse_tree_column_attrs.h:727
void move_cf_appliers(Parse_context *tddlpc, Column_parse_context *cpc)
Definition: parse_tree_helpers.cc:540
Int_type
Definition: parser_yystype.h:245
Numeric_type
Definition: parser_yystype.h:253
Virtual_or_stored
Definition: parser_yystype.h:243
const string value("\"Value\"")
column_format_type
Definition: field.h:188
void push_warning(THD *thd, Sql_condition::enum_severity_level severity, uint code, const char *message_text)
Push the warning to error list if there is still room in the list.
Definition: sql_error.cc:649
case opt name
Definition: sslopt-case.h:32
Definition: m_ctype.h:354
Parse context for column type attribyte specific parse tree nodes.
Definition: parse_tree_column_attrs.h:72
const bool is_generated
Owner column is a generated one.
Definition: parse_tree_column_attrs.h:73
std::vector< CreateFieldApplier > cf_appliers
Definition: parse_tree_column_attrs.h:74
Column_parse_context(THD *thd_arg, Query_block *select_arg, bool is_generated)
Definition: parse_tree_column_attrs.h:75
bool binlog_need_explicit_defaults_ts
Definition: sql_lex.h:4083
Definition: mysql_lex_string.h:39
Definition: mysql_lex_string.h:34
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:90
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:93
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:91
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:92
bool explicit_defaults_for_timestamp
Definition: system_variables.h:314
Bison "location" class.
Definition: parse_location.h:42
unsigned int uint
Definition: uca-dump.cc:29