~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/create_table.rst

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • mto: (1711.1.21 build) (1725.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: prafulla_t@users.sourceforge.net-20100806112112-7w5u0s3nx9u67nzt
Fix for Bug 586051

1. test_if_ref method which checks whether predicate is already evaluated
   due to ref/eq_ref access or not was incorrectly removing a predicate 
   that was not implicitly evaluated due to ref access (due to presence of filesort ?)
   It was field=NULL predicate.
   Such predicate should be kept and execution engine will filter out rows
   correctly. Removal of such predicate led to returning of rows which had
   NULL for join/predicate columns.
2. field COMP_OP NULL will always false for all fields except when COMP_OP
   is NULL-safe equality operator. Modified range optimizer to return zero
   row count in such cases.
   Query now does not even run. It returns zero result. As such Fix(1) is not
   required but we might hit that case in some other query (I have not tried it
   yet)
3. Fixed Field::val_str to print "NULL" for literal NULL instead of "0". It
   added lot of confusion while debugging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
CREATE TABLE
2
 
============
3
 
 
4
 
A CREATE statement in SQL creates an object inside of Drizzle. One of the most common CREATE command is the CREATE TABLE command.
5
 
 
6
 
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
7
 
    (create_definition, ...)
8
 
    [engine_options]
9
 
 
10
 
    or:
11
 
 
12
 
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
13
 
    [(create_definition, ...)]
14
 
    [engine_options]
15
 
    select_statement
16
 
 
17
 
    or:
18
 
 
19
 
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
20
 
    LIKE different_table_name
21
 
    [engine_options]
22
 
 
23
 
create_definition:
24
 
    column_name column_definition
25
 
  | [CONSTRAINT [symbol] ] PRIMARY KEY [index_type]
26
 
    (index_column_name, ...)
27
 
  | INDEX [index_name] (index_column_name, ...)
28
 
    (index_column_name, ...)
29
 
  | [CONSTRAINT [symbol] ] UNIQUE [INDEX]
30
 
    (index_column_name, ...)
31
 
  | [CONSTRAINT [symbol] ] FOREIGN KEY [index_name] (index_column_name, ...)
32
 
    reference_definition
33
 
  | CHECK (expr)
34
 
 
35
 
column_definition:
36
 
  data_type [NOT NULL | NULL] [DEFAULT default_value]
37
 
    [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]
38
 
    [COMMENT 'string']
39
 
    [reference_definition]
40
 
 
41
 
data_type:
42
 
  | INTEGER
43
 
  | BIGINT
44
 
  | DOUBLE[(length, decimals)]
45
 
  | DECIMAL[(length[,decimals])]
46
 
  | DATE
47
 
  | TIMESTAMP
48
 
  | DATETIME
49
 
  | VARCHAR(length) [COLLATE collation_name]
50
 
  | VARBINARY(length)
51
 
  | BLOB
52
 
  | TEXT [BINARY] [COLLATE collation_name]
53
 
  | ENUM(value1, value2, value3, ...) [COLLATE collation_name]
54
 
 
55
 
reference_option:
56
 
  RESTRICT | CASCADE | SET NULL | NO ACTION
57
 
 
58
 
engine_options:
59
 
    engine_option [[,] engine_option] ...
60
 
 
61
 
engine_option:
62
 
  ENGINE = engine_name
63
 
  { engine_specific }