I don't know if the manual says anything about this but if you check Paul's book page 
150 (paul now we are referencing your book down to page level) it says:

"creating a table by selecting data into it does not automatically copy any indexes 
from the original table"


regards,
thalis

On Sun, 8 Apr 2001, Marc Swanson wrote:

> I'm not sure if this is a bug or not, but I just realized today that some of
> my create table queries (on mysql 3.23.32 ) were not behaving as I would
> expect..  Example:
> 
> **********************************************************
> 
> mysql> create table foo (id int not null primary key, field1 varchar(55),
> unique data_index (id,field1));
> Query OK, 0 rows affected (0.04 sec)
> 
> mysql> show columns from foo;
> +--------+-------------+------+-----+---------+-------+
> | Field  | Type        | Null | Key | Default | Extra |
> +--------+-------------+------+-----+---------+-------+
> | id     | int(11)     |      | PRI | 0       |       |
> | field1 | varchar(55) | YES  |     | NULL    |       |
> +--------+-------------+------+-----+---------+-------+
> 2 rows in set (0.02 sec)
> 
> mysql> create table bar select * from foo;
> Query OK, 0 rows affected (0.07 sec)
> Records: 0  Duplicates: 0  Warnings: 0
> 
> mysql> show columns from bar;
> +--------+----------+------+-----+---------+-------+
> | Field  | Type     | Null | Key | Default | Extra |
> +--------+----------+------+-----+---------+-------+
> | id     | int(11)  |      |     | 0       |       |
> | field1 | char(55) | YES  |     | NULL    |       |
> +--------+----------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
> 
> 
> ***********************************************************
> 
> As you can see the primary key is not a part of table bar.  Nor is the
> unique index as shown with mysqldump
> 
> ***********************************************************
> 
> 
> root@raid:/home/mswanson > mysqldump -d test bar
> # MySQL dump 8.12
> #
> # Host: localhost    Database: test
> #--------------------------------------------------------
> # Server version        3.23.32-log
> 
> #
> # Table structure for table 'bar'
> #
> 
> CREATE TABLE bar (
>   id int(11) NOT NULL default '0',
>   field1 char(55) default NULL
> ) TYPE=MyISAM;
> 
> 
> **************************************************************
> 
> 
> 
> The manual doesn't say anything about this.  Is this a bug or just something
> I missed in the manual?
> 
> 
> Thanks
> 
> 
> -Marc-
> 
> 
> #/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/#
> #Marc Swanson             |                 #
> #MSwanson Consulting      |      \|||/      #
> #                         |      /o o\      #
> #Phone:  (603)868-1721    |-ooo----O----ooo-#
> #Fax:    (603)868-1730    |  Solutions in:  #
> #Mobile: (603)512-1267    |  'PHP    'Perl  #
> #[EMAIL PROTECTED] |  'SQL    'C++   #
> #                         |  'HTML   'Sh/Csh#
> #http://www.mswanson.com  |  'Javascript    #
> #/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/#
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to