MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
Find a file
Sachin Setiya 84726906c9 MDEV-10177 Invisible Columns and Invisible Index
Feature Definition:-

This feature adds invisible column functionality to server.
There is 4 level of "invisibility":

1. Not invisible (NOT_INVISIBLE) — Normal columns created by the user

2. A little bit invisible (USER_DEFINED_INVISIBLE) — columns that the
    user has marked invisible. They aren't shown in SELECT * and they
    don't require values in INSERT table VALUE (...). Otherwise
    they behave as normal columns.

3. More invisible (SYSTEM_INVISIBLE) — Can be queried explicitly,
    otherwise invisible from everything. Think ROWID sytem column.
    Because they're invisible from ALTER TABLE and from CREATE TABLE
    they cannot be created or dropped, they're created by the system.
    User cant not create a column name which is same as of
    SYSTEM_INVISIBLE.

4. Very invisible (COMPLETELY_INVISIBLE) — as above, but cannot be
    queried either. They can only show up in EXPLAIN EXTENDED (might
    be possible for a very invisible indexed virtual column) but
    otherwise they don't exist for the user.If user creates a columns
    which has same name as of COMPLETELY_INVISIBLE then
    COMPLETELY_INVISIBLE column is renamed again. So it is completely
    invisible from user.

Invisible Index(HA_INVISIBLE_KEY):-
   Creation of invisible columns require a new type of index which
   will be only visible to system. User cant see/alter/create/delete
   this index. If user creates a index which is same name as of
   invisible index then it will be renamed.

Syntax Details:-

  Only USER_DEFINED_INVISIBLE column can be created by user. This
  can be created by adding INVISIBLE suffix after column definition.

  Create table t1( a int invisible, b int);

Rules:-
  There are some rules/restrictions related to use of invisible columns
  1. All the columns in table cant be invisible.
     Create table t1(a int invisible); \\error
     Create table t1(a int invisible, b int invisble); \\error
  2. If you want invisible column to be NOT NULL then you have to supply
     Default value for the column.
     Create table t1(a int, b int not null); \\error
  3. If you create a view/create table with select * then this wont copy
     invisible fields. So newly created view/table wont have any invisible
     columns.
     Create table t2 as select * from t1;//t2 wont have t1 invisible column
     Create view v1 as select * from t1;//v1 wont have t1 invisible column
  4. Invisibility wont be forwarded to next table in any case of create
     table/view as select */(a,b,c) from table.
     Create table t2 as select a,b,c from t1; // t2 will have t1 invisible
                           // column(b), but this wont be invisible in t2
     Create view v1 as select a,b,c from t1; // v1 will have t1 invisible
                           // column(b), but this wont be invisible in v1

Implementation Details:-
  Parsing:- INVISIBLE_SYM is added into vcol_attribute(so its like unique
      suffix), It is also added into keyword_sp_not_data_type so that table
      can have column with name invisible.
  Implementation detail is given by each modified function/created function.
   (Some function are left as they were self explanatory)
   (m= Modified, n= Newly Created)

  mysql_prepare_create_table(m):- Extra checks for invisible columns are
  added. Also some DEBUG_EXECUTE_IF are also added for test cases.

  mysql_prepare_alter_table(m):- Now this will drop all the
  COMPLETELY_INVISIBLE column and HA_INVISIBLE_KEY index. Further
  Modifications are made to stop drop/change/delete of SYSTEM_INVISIBLE
  column.

  build_frm_image(m):- Now this allows incorporating field_visibility
  status into frm image. To remain compatible with old frms
  field_visibility info will be only written when any of the field is
  not NOT_INVISIBLE.

  extra2_write_additional_field_properties(n):- This will write field
  visibility info into buffer. We first write EXTRA2_FIELD_FLAGS into
  buffer/frm , then each next char will have field_visibility for each
  field.

  init_from_binary_frm_image(m):- Now if we get EXTRA2_FIELD_FLAGS,
  then we will read the next n(n= number of fields) chars and set the
  field_visibility. We also increment
  thd->status_var.feature_invisible_columns. One important thing to
  note if we find out that key contains a field whose visibility is
  > USER_DEFINED_INVISIBLE then , we declare this key as invisible
  key.

  sql_show.cc is changed accordingly to make show table, show keys
  correct.

  mysql_insert(m):- If we get to know that we are doing insert in
  this way insert into t1 values(1,1); without explicitly specifying
  columns, then we check for if we have invisible fields if yes then
  we reset the whole record, Why ? Because first we want hidden columns
  to get default/null value. Second thing auto_increment has property
  no default and no null which voilates invisible key rule 2, And
  because of this it was giving error. Reseting table->record[0]
  eliminates this issue. More info put breakpoint on handler::write_row
  and see auto_increment value.

  fill_record(m):- we continue loop if we find invisible column because
  this is already reseted/will get its value if it is default.

Test cases:- Since we can not directly add > USER_DEFINED_INVISIBLE
  column then I have debug_dbug to create it in mysql_prepare_create_table.

  Patch Credit:- Serg Golubchik
2017-12-15 02:41:52 +05:30
BUILD Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-07-04 15:31:25 +04:00
client Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
cmake Merge bb-10.2-ext into 10.3 2017-12-12 09:57:17 +02:00
dbug Make debug multi thread safe 2017-10-26 13:49:55 +03:00
debian Travis-CI: slim down the deb build so it passes in the 50 minute time limit 2017-11-21 13:07:26 +02:00
Docs Merge branch '10.0' into 10.1 2016-03-21 13:02:53 +01:00
extra MDEV-12501 -- set --maturity-level by default 2017-12-09 23:34:43 +00:00
include MDEV-10177 Invisible Columns and Invisible Index 2017-12-15 02:41:52 +05:30
libmariadb@63f841f78f Update C/C to fix unit tests with clang 2017-11-24 14:39:38 +01:00
libmysqld Merge remote-tracking branch 'shagalla/10.3-mdev12172' into 10.3 2017-11-01 21:42:26 -07:00
libservices MDEV-11663 Create services for functionality used by plugins 2017-04-27 19:12:38 +02:00
man Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
mysql-test MDEV-10177 Invisible Columns and Invisible Index 2017-12-15 02:41:52 +05:30
mysys Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
mysys_ssl MDEV-13384 - misc Windows warnings fixed 2017-09-28 17:20:46 +00:00
pcre Merge branch '10.1' into 10.2 2017-10-24 14:53:18 +02:00
plugin Search for galera libraries also in /usr/lib64/galera-3 2017-12-08 11:38:22 +02:00
randgen/conf Group commit for maria engine. 2010-02-12 15:12:28 +02:00
scripts MDEV-14573: Upgrade from previous versions is broken for procedures 2017-12-12 12:09:52 +05:30
sql MDEV-10177 Invisible Columns and Invisible Index 2017-12-15 02:41:52 +05:30
sql-bench don't install same files twice 2017-08-14 19:45:58 +02:00
sql-common Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-10-30 20:47:39 +04:00
storage Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
strings Merge bb-10.2-ext into 10.3 2017-12-12 09:57:17 +02:00
support-files Merge bb-10.2-ext into 10.3 2017-09-21 08:12:19 +03:00
tests Merge bb-10.2-ext into 10.3 2017-11-30 08:16:37 +02:00
unittest MDEV-13728 - Import MySQL 5.7 atomic operations for MSVC and Solaris 2017-11-27 18:35:53 +04:00
vio MDEV-14113 Use abortive TCP close, in case server closes the connection 2017-12-11 14:54:17 +00:00
win Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-10-30 20:47:39 +04:00
wsrep Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
zlib Build improvements and cleanups. 2017-09-08 18:22:15 +00:00
.gitattributes Merge branch 'connect/10.1' into 10.1 2016-06-28 22:12:50 +02:00
.gitignore ignore generated file 2017-09-23 20:21:39 +02:00
.gitmodules Use https instead of ssh(git@) for rocksdb submodule. 2016-11-15 10:00:19 -05:00
.travis.compiler.sh travis: add clang-5.0 2017-08-07 10:05:01 +04:00
.travis.yml Travis-CI: clean up cruft and add more in-line commments 2017-11-21 13:07:26 +02:00
BUILD-CMAKE various documentation updates 2012-06-18 16:57:58 -04:00
CMakeLists.txt Merge bb-10.2-ext into 10.3 2017-09-25 22:05:56 +03:00
config.h.cmake Cleanup UT_LOW_PRIORITY_CPU/UT_RESUME_PRIORITY_CPU 2017-11-28 16:34:31 +04:00
configure.cmake Cleanup UT_LOW_PRIORITY_CPU/UT_RESUME_PRIORITY_CPU 2017-11-28 16:34:31 +04:00
COPYING Use a new version of "COPYING", the GPL text. 2010-03-04 14:26:27 +01:00
COPYING.thirdparty Correct FSF address 2017-03-10 18:21:29 +01:00
CREDITS Update MariaDB Foundation sponsors 2017-06-15 14:42:41 +04:00
EXCEPTIONS-CLIENT MDEV-5645 MariaDB-5.5.35 - references are made to an "EXCEPTIONS-CLIENT" file but it does not exist 2014-05-31 13:18:56 +02:00
INSTALL-SOURCE Update AskMonty and Atlassian references to MariaDB 2016-03-08 15:24:01 +02:00
INSTALL-WIN-SOURCE Update AskMonty and Atlassian references to MariaDB 2016-03-08 15:24:01 +02:00
KNOWN_BUGS.txt various documentation updates 2012-06-18 16:57:58 -04:00
README.md README.md - Secure (HTTPS) Links 2017-09-25 13:51:15 +04:00
VERSION MDEV-12501 -- set --maturity-level by default 2017-12-09 23:34:43 +00:00

MariaDB: drop-in replacement for MySQL

MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

MariaDB is brought to you by the MariaDB Foundation. Please read the CREDITS file for details about the MariaDB Foundation, and who is developing MariaDB.

MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Foundation and the MariaDB Corporation, and by many people in the community.

MySQL, which is the base of MariaDB, is a product and trademark of Oracle Corporation, Inc. For a list of developers and other contributors, see the Credits appendix. You can also run 'SHOW authors' to get a list of active contributors.

A description of the MariaDB project and a manual can be found at: https://mariadb.org/ https://mariadb.com/kb/en/ https://mariadb.com/kb/en/mariadb-vs-mysql-features/ https://mariadb.com/kb/en/mariadb-versus-mysql-features/ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/

As MariaDB is a full replacement of MySQL, the MySQL manual at http://dev.mysql.com/doc is generally applicable.

Help:

More help is available from the Maria Discuss mailing list https://launchpad.net/~maria-discuss and the #maria IRC channel on Freenode.

License:


NOTE:

MariaDB is specifically available only under version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in the MySQL distribution for more information.

License information can be found in the COPYING, COPYING.LESSER, and COPYING.thirdparty files.


Bug Reports:

Bug and/or error reports regarding MariaDB should be submitted at https://mariadb.org/jira

Bugs in the MySQL code can also be submitted at https://bugs.mysql.com

The code for MariaDB, including all revision history, can be found at: https://github.com/MariaDB/server


Code status:

  • tests status travis-ci.org (10.2 branch)