The server might need to add columns to the table, for various internal purposes. These columns should be marked hidden — the user shouldn't see them. Depending on the application there can be different levels of "hiddeness":

      1. Not hidden — normal columns created by the user
      2. A little bit hidden — columns that the user has marked hiden. They aren't shown in SELECT * and they don't require values in INSERT table VALUE (...). Otherwise they behave as normal columns.
      3. More hidden — Can be queried explicitly, otherwise hidden from everything. Think ROWID pseudo-column. Because they're hidden from ALTER TABLE and from CREATE TABLE they cannot be created or dropped, they're created by the system.
      4. Very hidden — as above, but cannot be queried either. They can only show up in EXPLAIN EXTENDED (might be possible for a very hidden indexed virtual column) but otherwise they don't exist for the user.

      See also Invisible Columns in Oracle and Hidden Columns in DB2.

      Q: What happens in one declares a hidden column that is NOT NULL and has no default value? Oracle returns an error at INSERT time if the column value was not provided. DB2 does not allow to create such a column.
      A: We'll do the latter, an error at CREATE TABLE time.
      Q: The syntax. Oracle uses the INVISIBLE keyword, DB2 uses IMPLICITLY HIDDEN.
      A: We use HIDDEN ???
      Q: Visibility of hidden columns in SHOW commands, in the INFORMATION_SCHEMA tables, in ALTER, etc. Oracle hides invisible columns in the informational commands too (and has a special view that shows them). DB2 hides them too, unless one uses a special form of the DESCRIBE} statement.
      A: Fully visible everywhere. They're only hidden from SELECT * and INSERT that does not specify the column list.
      Q: Replication. Are hidden columns written to binlog?
      A: User-hidden columns — absolutely. But others? ROWID pseudo-column should not be replicated, that's what "pseudo" mean. Hidden automatic primary key should be. Per-column setting?
      Q: Indexes on hidden columns, are they hidden? What about indexes on a mix of hidden/visible columns?
      A: On user-visible columns, no and no. On more hidden — yes and impossible.


          Issue Links



              • Assignee:
                serg Sergei Golubchik
                serg Sergei Golubchik
              • Votes:
                1 Vote for this issue
                3 Start watching this issue


                • Created: