Re: auto_increment field behavior

2013-03-13 Thread spameden
2013/3/13 Reindl Harald h.rei...@thelounge.net: Am 12.03.2013 22:34, schrieb spameden: NOTE: AUTO_INCREMENT is 32768 instead of 17923 ! So next inserted row would have pc_id=32768. Please suggest if it's normal behavior or not what do you expect if a PRIMARY KEY record get's removed? re

Re: auto_increment field behavior

2013-03-12 Thread spameden
Furthermore I've tested on 133K records and AUTO_INCREMENT field in the end had the value of 234076. mysql select count(*) from billing.phone_codes; +--+ | count(*) | +--+ | 12 | +--+ 1 row in set (0.02 sec) AUTO_INCREMENT=234076 So it basically means If I have

Re: auto_increment field behavior

2013-03-12 Thread spameden
| +---+-+ | test | CREATE TABLE `test` ( `pc_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pc_type` enum('ABC','DEF') DEFAULT NULL, PRIMARY KEY (`pc_id`) ) ENGINE=InnoDB AUTO_INCREMENT=17923 DEFAULT CHARSET=utf8

Re: auto_increment field behavior

2013-03-12 Thread spameden
Nevermind, I've found the bug: http://bugs.mysql.com/bug.php?id=57643 I'm gonna subscribe for it and see if it's gonna be resolved. Many thanks guys for all your assistance! 2013/3/13 spameden spame...@gmail.com: 2013/3/13 Rick James rja...@yahoo-inc.com: AUTO_INCREMENT guarantees

Re: auto_increment field behavior

2013-03-12 Thread spameden
2013/3/13 Rick James rja...@yahoo-inc.com: AUTO_INCREMENT guarantees that it will not assign the same number twice. That's about all it is willing to guarantee. With InnoDB, if a transaction starts, uses an auto_inc value, then rolls back, that id is lost. True, but if you do not specify

RE: auto_increment field behavior

2013-03-12 Thread Rick James
What settings? (innodb_autoinc_lock_mode comes to mind, but there may be others.) It is acceptable, by the definition of AUTO_INCREMENT, for it to burn the missing 15K ids. -Original Message- From: spameden [mailto:spame...@gmail.com] Sent: Tuesday, March 12, 2013 2:34 PM

Re: auto_increment field behavior

2013-03-12 Thread spameden
in set (0.00 sec) It is acceptable, by the definition of AUTO_INCREMENT, for it to burn the missing 15K ids. I don't get this explanation, could you please explain bit more? So it's completely normal for AUTO_INCREMENT field to act like this? -Original Message- From: spameden

RE: auto_increment field behavior

2013-03-12 Thread Rick James
AUTO_INCREMENT guarantees that it will not assign the same number twice. That's about all it is willing to guarantee. With InnoDB, if a transaction starts, uses an auto_inc value, then rolls back, that id is lost. When you have multiple threads loading data into the same table, diff values

Re: auto_increment field behavior

2013-03-12 Thread spameden
| +---+-+ | test | CREATE TABLE `test` ( `pc_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `pc_type` enum('ABC','DEF') DEFAULT NULL, PRIMARY KEY (`pc_id`) ) ENGINE=InnoDB AUTO_INCREMENT=17923 DEFAULT CHARSET=utf8

Re: auto_increment field behavior

2013-03-12 Thread Reindl Harald
Am 12.03.2013 22:34, schrieb spameden: NOTE: AUTO_INCREMENT is 32768 instead of 17923 ! So next inserted row would have pc_id=32768. Please suggest if it's normal behavior or not what do you expect if a PRIMARY KEY record get's removed? re-use the same primary key? this is not the way

RE: How MyISAM handle auto_increment

2011-10-07 Thread Jerry Schwartz
-Original Message- From: Lucio Chiappetti [mailto:lu...@lambrate.inaf.it] Sent: Thursday, October 06, 2011 3:18 AM To: Jerry Schwartz Cc: Mysql List Subject: RE: How MyISAM handle auto_increment On Wed, 5 Oct 2011, Jerry Schwartz wrote: Can't you use CREATE TABLE LIKE

RE: How MyISAM handle auto_increment

2011-10-06 Thread Lucio Chiappetti
On Wed, 5 Oct 2011, Jerry Schwartz wrote: Can't you use CREATE TABLE LIKE and then reset the auto-increment value? Thanks. Since when does create table like exist? I was unaware of it, but I see it exists in mysql 5.1. The tricks I described worked since 3.x or thereabouts. --

Re: How MyISAM handle auto_increment

2011-10-05 Thread Lucio Chiappetti
On Mon, 3 Oct 2011, Reindl Harald wrote: I have questions regarding how MyISAM handles auto_increment clolumn? it is a table-property and you hould NOT touch it without godd reasons because it is named AUTO I guess there are quite often good reasons to change it, which can be done e.g

How MyISAM handle auto_increment

2011-10-03 Thread Angela liu
Hi, Folks: I have questions regarding how MyISAM handles auto_increment clolumn? 1. is there a auto_increment counter for MyISAM to assign a new value to auto_increment columns?   2. if MyISAM has the counter, is the counter stored in memory or disk? Thnaks 

Re: How MyISAM handle auto_increment

2011-10-03 Thread mos
At 04:46 PM 10/3/2011, you wrote: Hi, Folks: I have questions regarding how MyISAM handles auto_increment clolumn? 1. is there a auto_increment counter for MyISAM to assign a new value to auto_increment columns? Yes 2. if MyISAM has the counter, is the counter stored in memory or disk

Re: How MyISAM handle auto_increment

2011-10-03 Thread Angela liu
Thanks, what about if mysqld restart, does auto_increment gets reset  ?  I saw this happened to Innodb, if table is empty and server restart, auto_incremnet gets reset to 0 From: mos mo...@fastmail.fm To: mysql@lists.mysql.com Sent: Monday, October 3, 2011 3:01

Re: How MyISAM handle auto_increment

2011-10-03 Thread Reindl Harald
Am 03.10.2011 23:46, schrieb Angela liu: Hi, Folks: I have questions regarding how MyISAM handles auto_increment clolumn? 1. is there a auto_increment counter for MyISAM to assign a new value to auto_increment columns? 2. if MyISAM has the counter, is the counter stored in memory

Re: How MyISAM handle auto_increment

2011-10-03 Thread mos
At 06:21 PM 10/3/2011, Angela liu wrote: Thanks, what about if mysqld restart, does auto_increment gets reset ? No. The next auto increment value stays with the table. As another person already stated, you should never manually change the auto increment value on a table that already has

Re: auto_increment value increased from 20 to 32 when I inserted a new row.

2011-09-20 Thread Johan De Meersman
- Original Message - From: crocket crockabisc...@gmail.com I had 19 rows in series table. And when I tried inserting the 20th row, the auto_increment value suddenly increased from 20 to 32, and the new row has 20 as series_id. The first thing that comes to mind, is transactions

auto_increment value increased from 20 to 32 when I inserted a new row.

2011-09-19 Thread crocket
Below is the definition of the table with the problem. CREATE TABLE `series` ( `series_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(200) NOT NULL, PRIMARY KEY (`series_id`) ) ENGINE=InnoDB I had 19 rows in series table. And when I tried inserting the 20th row

auto_increment by more than 1

2011-02-23 Thread Jim McNeely
Is there a way to set the auto-increment for a particular table to increase by some number more than one, like maybe 10? Thanks in advance, Jim McNeely -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: auto_increment by more than 1

2011-02-23 Thread Carsten Pedersen
Den 23-02-2011 18:41, Jim McNeely skrev: Is there a way to set the auto-increment for a particular table to increase by some number more than one, like maybe 10? Thanks in advance, Jim McNeely CREATE TABLE t ( ... ) AUTO_INCREMENT=10; / Carsten -- MySQL General Mailing List For list

Re: auto_increment by more than 1

2011-02-23 Thread Shawn Green (MySQL)
On 2/23/2011 12:41, Jim McNeely wrote: Is there a way to set the auto-increment for a particular table to increase by some number more than one, like maybe 10? Thanks in advance, Jim McNeely The manual is your friend. Don't be afraid of it :)

Re: auto_increment by more than 1

2011-02-23 Thread Jim McNeely
I have read the manual, and you're right, the auto-increment_increment is a system wide setting. I only want this on one table. I am in this instance creating ID's for a separate system via HL7 for a Filemaker system, and FileMaker is too lame and slow to actually spit out an ID in time for the

Re: auto_increment by more than 1

2011-02-23 Thread Jim McNeely
wrote: Den 23-02-2011 18:41, Jim McNeely skrev: Is there a way to set the auto-increment for a particular table to increase by some number more than one, like maybe 10? Thanks in advance, Jim McNeely CREATE TABLE t ( ... ) AUTO_INCREMENT=10; / Carsten -- MySQL General

Re: auto_increment by more than 1

2011-02-23 Thread Reindl Harald
Am 23.02.2011 22:29, schrieb Jim McNeely: I have read the manual, and you're right, the auto-increment_increment is a system wide setting No, scope session means set VAR=value Command-Line Format --auto_increment_increment[=#] Option-File Format auto_increment_increment Option Sets

Re: auto_increment by more than 1

2011-02-23 Thread Reindl Harald
Am 23.02.2011 22:55, schrieb Singer X.J. Wang: Yes, you can set it up so that it increases it by X only for that statement.. eg. [other stuff] set auto_increment_increment = X; insert into that table you want set auto_increment_increment = 1; [other stuff] Now you have to remmeber

Re: Discontinued AUTO_INCREMENT problem....

2010-12-21 Thread 杨涛涛
Hi. You can show us your show create table statement as well. 杨涛 我博客1:http://yueliangdao0608.cublog.cn My 我博客2:http://yueliangdao0608.blog.51cto.com 2010/12/20 Xavier Correyeur x.correy...@free.fr Hi everybody ! A have a discontinued AUTO_INCREMENT sequence when i insert data in a table

Re: Discontinued AUTO_INCREMENT problem....

2010-12-21 Thread Wagner Bianchi
://yueliangdao0608.blog.51cto.com 2010/12/20 Xavier Correyeur x.correy...@free.fr Hi everybody ! A have a discontinued AUTO_INCREMENT sequence when i insert data in a table with a 100 (or more) items SELECT request. The problem (or situation) is reproductible, you can see an example below

Re: Discontinued AUTO_INCREMENT problem....

2010-12-21 Thread partha sarathy
...@free.fr; mysql@lists.mysql.com Sent: Tue, 21 December, 2010 3:28:00 PM Subject: Re: Discontinued AUTO_INCREMENT problem Too curious...could you share a SHOW CREATE TABLE from this table as requested before? Best regards. -- Wagner Bianchi 2010/12/21 杨涛涛 david.y...@actionsky.com Hi. You

Re: Discontinued AUTO_INCREMENT problem....

2010-12-21 Thread 杨涛涛
Sent: Tue, 21 December, 2010 3:28:00 PM Subject: Re: Discontinued AUTO_INCREMENT problem Too curious...could you share a SHOW CREATE TABLE from this table as requested before? Best regards. -- Wagner Bianchi 2010/12/21 杨涛涛 david.y...@actionsky.com Hi. You can show us your show

Discontinued AUTO_INCREMENT problem....

2010-12-20 Thread Xavier Correyeur
Hi everybody ! A have a discontinued AUTO_INCREMENT sequence when i insert data in a table with a 100 (or more) items SELECT request. The problem (or situation) is reproductible, you can see an example below. Anybody could explain this to me ? Cheers XC My MySQL version : Ver 14.14 Distrib

Re: about auto_increment id

2010-10-17 Thread Sander de Bruijne
ALTER TABLE sometable AUTO_INCREMENT = 1000; On 10/17/2010 07:03 AM, short cutter wrote: Hi, Is it possible to change this directive's value without modifition to my.cnf and restart mysqld? I remember there is a set @@variable syntax, but not sure. Thanks. 2010/10/17 mosmo...@fastmail.fm

about auto_increment id

2010-10-16 Thread short cutter
Hello, I have a table which has the ID key with auto_increment and which is a primary key. If I insert the table with the id value which is generated by the program, for example, insert table (id, user_name, age) values (1000, 'kenn', 30); the value 1000 is inserted forcely, not generated

Re: about auto_increment id

2010-10-16 Thread mos
At 08:05 PM 10/16/2010, you wrote: Hello, I have a table which has the ID key with auto_increment and which is a primary key. If I insert the table with the id value which is generated by the program, for example, insert table (id, user_name, age) values (1000, 'kenn', 30); the value 1000

Re: about auto_increment id

2010-10-16 Thread mos
At 08:55 PM 10/16/2010, you wrote: After executing the SQL statement, the next Id inserted will be 1000. Oops. I meant : After executing the SQL statement, the next Id inserted will be 1001. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: about auto_increment id

2010-10-16 Thread short cutter
Hi, Is it possible to change this directive's value without modifition to my.cnf and restart mysqld? I remember there is a set @@variable syntax, but not sure. Thanks. 2010/10/17 mos mo...@fastmail.fm: At 08:55 PM 10/16/2010, you wrote: After executing the SQL statement, the next Id inserted

setting auto_increment value with a local variable

2010-03-19 Thread Suresh Kuna
Hi, Is there any way to set the auto_increment value with the variable like below. mysql set @id=10; mysql alter table suresh_copy auto_increme...@id; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax

Pb: auto_increment - insert zero value

2010-03-18 Thread Vikram A
Hi, I have problem in the insertion of 0 in auto_increment. I have set in my.ini file as follows, sql-mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO Even now the auto increment filed is not allows to insert a zero; If i insert zero, 1 is getting

Re: auto_increment weirdness

2010-02-19 Thread Ananda Kumar
, 2010 6:05 PM To: mysql@lists.mysql.com Subject: auto_increment weirdness Hi, for some reason, I have an auto_increment field that's magically bumped up to the next biggest power of 2 after a big INSERT...SELECT that inserts a bunch of tuples (into an empty table). Is this expected behavior

RE: auto_increment weirdness

2010-02-18 Thread Gavin Towey
Reproduced in 5.1.43. Could not reproduce it in 5.0.66 -Original Message- From: Yang Zhang [mailto:yanghates...@gmail.com] Sent: Wednesday, February 17, 2010 6:05 PM To: mysql@lists.mysql.com Subject: auto_increment weirdness Hi, for some reason, I have an auto_increment field that's

auto_increment weirdness

2010-02-17 Thread Yang Zhang
Hi, for some reason, I have an auto_increment field that's magically bumped up to the next biggest power of 2 after a big INSERT...SELECT that inserts a bunch of tuples (into an empty table). Is this expected behavior? I couldn't find any mention of this from the docs (using the MySQL 5.4.3 beta

Re: auto_increment without primary key in innodb?

2010-01-26 Thread Johan De Meersman
: create table (myid int unsigned not null auto_increment., unique key (myid)); but this is effectively a primary key Only mostly true :-) It *is* the same for MyISAM, but for InnoDB the primary key is special, as that is the one that stores the data inline (clustered index). Additional

Fwd: auto_increment without primary key in innodb?

2010-01-26 Thread Wagner Bianchi
Yeah, Paul... This is so clear...the auto_increment column may be indexed like: - KEY(); - UNIQUE(); - PRIMARY KEY() ...when you create or alter a table. -- Wagner Bianchi 2010/1/25 Paul DuBois paul.dub...@sun.com The requirement is that it be indexed. The index need not be a primary

auto_increment without primary key in innodb?

2010-01-25 Thread Yang Zhang
In innodb, is it possible to have an auto_increment field without making it a (part of a) primary key? Why is this a requirement? I'm getting the following error. Thanks in advance. ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

RE: auto_increment without primary key in innodb ?

2010-01-25 Thread Tom Worster
it's not an innodb thing: http://dev.mysql.com/doc/refman/5.0/en/create-table.html Note There can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot have a DEFAULT value. An AUTO_INCREMENT column works properly only if it contains only positive values. Inserting

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Yang Zhang
Right, I saw the docs. I'm fine with creating an index on it, but the only way I've successfully created a table with auto_increment is by making it a primary key. And I still don't understand why this requirement is there in the first place. On Mon, Jan 25, 2010 at 10:32 AM, Tom Worster f

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Jaime Crespo Rincón
2010/1/25 Yang Zhang yanghates...@gmail.com: Right, I saw the docs. I'm fine with creating an index on it, but the only way I've successfully created a table with auto_increment is by making it a primary key. And I still don't understand why this requirement is there in the first place. Non

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Paul DuBois
The requirement is that it be indexed. The index need not be a primary key. mysql create table t (i int not null auto_increment, index(i)) engine innodb; Query OK, 0 rows affected (0.45 sec) On Jan 25, 2010, at 9:39 AM, Yang Zhang wrote: Right, I saw the docs. I'm fine with creating an index

Re: auto_increment without primary key in innodb?

2010-01-25 Thread Yong Lee
yah, mysql only allows one auto increment field n that's used as the primary key in tables. I don't think it has to be the primary key as long as it is a unique key i think that's okay. so u should be able to do : create table (myid int unsigned not null auto_increment., unique key (myid

Problems with auto_increment updating when (i think) it shouldn't

2009-08-07 Thread Proemial
Hey folks. I'm getting some weird behaviour out of Auto_increment. If I enter a attempt to INSERT a row into a table with a UNIQUE index, where the insert would violate uniqueness of existing data, I'm seeing the auto_increment increase even though the insert fails. The server in question

Re: Problems with auto_increment updating when (i think) it shouldn't

2009-08-07 Thread Johnny Withers
It will also update the auto_increment column when you ROLLBACK a failed insert: mysql USE test; Database changed mysql SELECT * FROM t1\G Empty set (0.00 sec) mysql DROP TABLE t1; Query OK, 0 rows affected (0.06 sec) mysql mysql CREATE TABLE t1( - id INT UNSIGNED NOT NULL AUTO_INCREMENT

Re: Problems with auto_increment updating when (i think) it shouldn't

2009-08-07 Thread Proemial
Hmm, that makes sense. I should have thought of that. Thanks! On Fri, Aug 7, 2009 at 12:32 PM, Johnny Withersjoh...@pixelated.net wrote: It will also update the auto_increment column when you ROLLBACK a failed insert: mysql USE test; Database changed mysql SELECT * FROM t1\G Empty set

auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur
Hi All I have created a table.Now I need to make a field Auto_increment...Help me with this issue..An example will do.. Regards Jnani -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

RE: auto_increment Issue

2009-04-10 Thread abdulazeez alugo
Date: Fri, 10 Apr 2009 15:15:28 +0530 From: jnaneshwar.banta...@kavach.net To: mysql@lists.mysql.com Subject: auto_increment Issue Hi All I have created a table.Now I need to make a field Auto_increment...Help me with this issue..An example will do.. Regards Jnani Hi Jnani

Re: auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur
Hi While trying for the same,I am getting the following error Incorrect table definition; there can be only one auto column and it must be defined as a key Jnani Octavian Rasnita wrote: Or more simple: ALTER TABLE tbl modify id INT UNSIGNED NOT NULL AUTO_INCREMENT; -- Octavian

RE: auto_increment Issue

2009-04-10 Thread abdulazeez alugo
Date: Fri, 10 Apr 2009 15:55:33 +0530 From: jnaneshwar.banta...@kavach.net To: orasn...@gmail.com CC: defati...@hotmail.com; mysql@lists.mysql.com Subject: Re: auto_increment Issue Hi While trying for the same,I am getting the following error Incorrect table definition

Re: auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur
Hi , Thanks,Its working now Jnani abdulazeez alugo wrote: Date: Fri, 10 Apr 2009 15:55:33 +0530 From: jnaneshwar.banta...@kavach.net To: orasn...@gmail.com CC: defati...@hotmail.com; mysql@lists.mysql.com Subject: Re: auto_increment Issue Hi While trying for the same,I am

Re: auto_increment problem

2008-10-30 Thread Moon's Father
alter table tablename modify id int not null auto_increment primary key; On Sat, Oct 25, 2008 at 2:48 AM, Paul [EMAIL PROTECTED] wrote: Anybody know if there's a way to change a primary key field that is not auto-incremented, turning on auto-increment but preserving the values

auto_increment problem

2008-10-24 Thread Paul
Anybody know if there's a way to change a primary key field that is not auto-incremented, turning on auto-increment but preserving the values that are currently in it? TIA, Paul W -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: How to build sub-sequence ... AUTO_INCREMENT on a sub-key starting with a specific offset?

2008-10-20 Thread Moon's Father
You could create an extra table in order to record the max number of widget,the the ID should alway be 1. On Thu, Oct 16, 2008 at 2:04 AM, Rob Wultsch [EMAIL PROTECTED] wrote: I would do a muli key PK with a after insert trigger to that would change widget_number 1 to 1000. Just my HO... I

How to build sub-sequence ... AUTO_INCREMENT on a sub-key starting with a specific offset?

2008-10-15 Thread D. Dante Lorenso
but the widget table references the account table with a foreign key on account_id: -- CREATE TABLE `account` ( `account_id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT, `label` VARCHAR(64) COLLATE latin1_swedish_ci NOT NULL DEFAULT '', PRIMARY KEY (`account_id`), UNIQUE KEY `account_id

Re: How to build sub-sequence ... AUTO_INCREMENT on a sub-key starting with a specific offset?

2008-10-15 Thread Rob Wultsch
I would do a muli key PK with a after insert trigger to that would change widget_number 1 to 1000. Just my HO... I would use this combo as the primary key, but I hate doing joins with multiple primary keys, so I'll also keep the widget_id for the purpose of making joins easier. Why? Both of

Re: mysqldump and auto_increment

2008-05-20 Thread Dan Lipsitt
: Is there a set of flags for mysqldump that will include the auto_increment specifier for columns, but leave out the AUTO_INCREMENT=x saved values? I want to compare the schema of two versions of a database, without considering the data. In my opinion, the saved auto increment counter is part

mysqldump and auto_increment

2008-05-19 Thread Dan Lipsitt
Is there a set of flags for mysqldump that will include the auto_increment specifier for columns, but leave out the AUTO_INCREMENT=x saved values? I want to compare the schema of two versions of a database, without considering the data. In my opinion, the saved auto increment counter is part

Re: mysqldump and auto_increment

2008-05-19 Thread Moon's Father
You can import your data into a test database,then export the data using statement select ... into ... then You can complare the two. On Tue, May 20, 2008 at 9:14 AM, Dan Lipsitt [EMAIL PROTECTED] wrote: Is there a set of flags for mysqldump that will include the auto_increment specifier

Re: auto_increment

2008-04-22 Thread Sebastian Mendel
Hiep Nguyen schrieb: hi list, reading manual on mysql regarding auto_increment with multiple-column index: CREATE TABLE animals ( grp ENUM('fish','mammal','bird') NOT NULL, id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (grp,id) ); INSERT

Re: auto_increment

2008-04-22 Thread Sebastian Mendel
Sebastian Mendel schrieb: Hiep Nguyen schrieb: hi list, reading manual on mysql regarding auto_increment with multiple-column index: CREATE TABLE animals ( grp ENUM('fish','mammal','bird') NOT NULL, id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY

Re: auto_increment

2008-04-22 Thread Ben Clewett
Are you sure, I just get: CREATE TABLE ... ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key On version 5.0.41. What version are you using? Hiep Nguyen wrote: hi list, reading manual on mysql regarding auto_increment

Re: auto_increment

2008-04-22 Thread Sebastian Mendel
Ben Clewett schrieb: Are you sure, I just get: CREATE TABLE ... ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key the mentioned CREATE TABLE is fine and works On version 5.0.41. What version are you using? this works on

Re: auto_increment

2008-04-22 Thread Ben Clewett
You are right, I've tried 5.0.18 and 5.0.45 which work. There must have been a bug in 5.0.41 with which I used test the question... I belive the question has been answered by now anyway :) Ben Sebastian Mendel wrote: Ben Clewett schrieb: Are you sure, I just get: CREATE TABLE ... ERROR

Re: auto_increment

2008-04-22 Thread Hiep Nguyen
On Tue, 22 Apr 2008, Sebastian Mendel wrote: Sebastian Mendel schrieb: Hiep Nguyen schrieb: hi list, reading manual on mysql regarding auto_increment with multiple-column index: CREATE TABLE animals ( grp ENUM('fish','mammal','bird') NOT NULL, id MEDIUMINT NOT NULL AUTO_INCREMENT

auto_increment

2008-04-21 Thread Hiep Nguyen
hi list, reading manual on mysql regarding auto_increment with multiple-column index: CREATE TABLE animals ( grp ENUM('fish','mammal','bird') NOT NULL, id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (grp,id) ); INSERT INTO animals (grp,name) VALUES

Re: why in procedure truncate table do not reset auto_increment?

2008-01-10 Thread Sebastian Mendel
| is available. However, the operation is still mapped to |DELETE| if there are foreign key constraints that reference the table. (When fast truncate is used, it resets any |AUTO_INCREMENT| counter. From MySQL 5.0.13 on, the |AUTO_INCREMENT| counter is reset by |TRUNCATE TABLE|, regardless

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
过客 schrieb: [...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0 could lead

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies
[...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0 could lead to using

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb: [...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies
[...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0 could lead to using

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb: [...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies
[...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0 could lead

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb: [...] why in procedure TRUNCATE table demo do not reset auto_increment? is clearly written in the documentation, just read ... in short: auto_increment is used for primary key, primary keys could be referenced from another table, setting auto_increment back to 0

Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread x
| is available. However, the operation is still mapped to |DELETE| if there are foreign key constraints that reference the table. (When fast truncate is used, it resets any |AUTO_INCREMENT| counter. From MySQL 5.0.13 on, the |AUTO_INCREMENT| counter is reset by |TRUNCATE TABLE|, regardless of whether

why in procedure truncate table do not reset auto_increment?

2008-01-06 Thread 过客
*hi everyone: * I've some puzzle with the following test: CREATE TABLE `demo` ( `id` int(11) NOT NULL auto_increment, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; INSERT INTO demo VALUES(100); delimiter // create procedure test() DETERMINISTIC begin

Re: Replication and AUTO_INCREMENT; is it safe?

2007-10-24 Thread Eric Frazier
On 10/24/07, Eric Frazier [EMAIL PROTECTED] wrote: js wrote: Hi list, Reading How AUTO_INCREMENT Handling Works in InnoDB[1] makes me wonder how is it possible to replicate AUTO_INCREMENTed value to slaves. According to the doc, If you specify an AUTO_INCREMENT column for an InnoDB

Re: Replication and AUTO_INCREMENT; is it safe?

2007-10-24 Thread Harrison Fisk
Hello, On Oct 23, 2007, at 11:23 AM, js wrote: Hi list, Reading How AUTO_INCREMENT Handling Works in InnoDB[1] makes me wonder how is it possible to replicate AUTO_INCREMENTed value to slaves. According to the doc, If you specify an AUTO_INCREMENT column for an InnoDB table, the table

Replication and AUTO_INCREMENT; is it safe?

2007-10-23 Thread js
Hi list, Reading How AUTO_INCREMENT Handling Works in InnoDB[1] makes me wonder how is it possible to replicate AUTO_INCREMENTed value to slaves. According to the doc, If you specify an AUTO_INCREMENT column for an InnoDB table, the table handle in the InnoDB data dictionary contains a special

Re: Replication and AUTO_INCREMENT; is it safe?

2007-10-23 Thread Philip Hallstrom
Reading How AUTO_INCREMENT Handling Works in InnoDB[1] makes me wonder how is it possible to replicate AUTO_INCREMENTed value to slaves. According to the doc, If you specify an AUTO_INCREMENT column for an InnoDB table, the table handle in the InnoDB data dictionary contains a special counter

Re: Replication and AUTO_INCREMENT; is it safe?

2007-10-23 Thread js
If After delete from table where id = 4 and restart mysqld on server B, insert into table (value) values(e) is executed on server A. Why would you delete data from the slave? The delete statement is for Master, not slave. -- MySQL General Mailing List For list archives:

Re: Replication and AUTO_INCREMENT; is it safe?

2007-10-23 Thread js
Thank you for your reply. But I couldn't under stand how --auto-increment-increment and --auto-increment-offset helps me avoid my problem. Could you please explain? On 10/24/07, Eric Frazier [EMAIL PROTECTED] wrote: js wrote: Hi list, Reading How AUTO_INCREMENT Handling Works in InnoDB[1

sequential numbering in Auto_Increment Field across two tables

2007-10-11 Thread Stephen Sunderlin
is a primary, Not Null AUTO_INCREMENT field. The issue is that the first auto increment number in the primary key of TableA is the next highest value of the AUTO_INCREMENT field of tableA instead of what I would have suspected was 1. Is this normal. Does it matter. And will this create conflict

Behaviour of auto_increment

2007-07-15 Thread Andrew Carlson
I have created a new table, with an auto_increment value. I would like the first auto_increment value to be 1001. So I - 1) inserted a fake record with an id of 1000 2) alter table tblname auto_increment=1000 (with and without a fake record) 3) alter table tblname auto_increment=1001

Re: Behaviour of auto_increment

2007-07-15 Thread Paul DuBois
At 5:34 PM -0500 7/15/07, Andrew Carlson wrote: I have created a new table, with an auto_increment value. I would like the first auto_increment value to be 1001. So I - 1) inserted a fake record with an id of 1000 2) alter table tblname auto_increment=1000 (with and without a fake record) 3

Re: Behaviour of auto_increment

2007-07-15 Thread Gary
Andrew Carlson wrote: I have created a new table, with an auto_increment value. I would like the first auto_increment value to be 1001. So I - 1) inserted a fake record with an id of 1000 2) alter table tblname auto_increment=1000 (with and without a fake record) 3) alter table tblname

Insert into multiple tables using auto_increment reference

2007-06-11 Thread Hamish Allan
Hi, Is it possible to insert values into two tables simultaneously and have the value of one of the columns in the second table be the auto_increment value from inserting into the first? E.g. if table1 has an auto_increment column c1, the logic I'm looking for would be something like: INSERT

Re: Insert into multiple tables using auto_increment reference

2007-06-11 Thread Baron Schwartz
Hi, Hamish Allan wrote: Hi, Is it possible to insert values into two tables simultaneously and have the value of one of the columns in the second table be the auto_increment value from inserting into the first? No, because you can only insert into one table at a time. But you can write

Re: Insert into multiple tables using auto_increment reference

2007-06-11 Thread Hamish Allan
On 6/11/07, Baron Schwartz [EMAIL PROTECTED] wrote: Hi, Hamish Allan wrote: Hi, Is it possible to insert values into two tables simultaneously and have the value of one of the columns in the second table be the auto_increment value from inserting into the first? No, because you can only

sequences and auto_increment

2007-01-02 Thread Luca Ferrari
DEFAULT ('comp-06-'::text || (nextval('sequenza_competenza'::regclass))::text), descrizione character varying(100), CONSTRAINT competenza_pkey PRIMARY KEY (id_competenza) ) there, id_competenza is compound by a string comp-06 and the next value of a sequence (similar to auto_increment

Re: sequences and auto_increment

2007-01-02 Thread Martijn Tonies
DEFAULT ('comp-06-'::text || (nextval('sequenza_competenza'::regclass))::text), descrizione character varying(100), CONSTRAINT competenza_pkey PRIMARY KEY (id_competenza) ) there, id_competenza is compound by a string comp-06 and the next value of a sequence (similar to auto_increment

Re: sequences and auto_increment

2007-01-02 Thread Brent Baisley
I don't think MySQL has exactly what you are looking for, but you may be able to get the behavior you want. The auto_increment value is actually based on an index and doesn't have to be unique. So you could create a compound index that has one or more fields plus the auto_increment field

Re: sequences and auto_increment

2007-01-02 Thread Luca Ferrari
On Tuesday 02 January 2007 16:51 Brent Baisley's cat, walking on the keyboard, wrote: CREATE TABLE competenza ( competenza varchar(30) NOT NULL default 'comp-06-', id_competenza int unsigned not null auto_increment, descrizione varchar(100), PRIMARY KEY (competenza, id_competenza

  1   2   3   4   5   6   7   >