Re: sequences and auto_increment

2007-01-02 Thread Martijn Tonies
by a string "comp-06" and the next value of a > sequence (similar to auto_increment). In MySQL there're no sequences, or > better, there's only an auto_increment action on an int field. How can I > obtain the same effect of the concatenation of a sequence and a string

sequences and auto_increment

2007-01-02 Thread Luca Ferrari
) NOT NULL 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

Re: InnoDB does not preserve AUTO_INCREMENT -- WTF!?

2006-11-12 Thread Miles Teg
We ship out mySQL on our appliances in enterprise level scenarios. We often like to start the AUTO_INCREMENT for several tables at 10,000 -- this way we can reserve the lower 'block' of IDs for our own internal and 'default' use so all customers have the same basic data

Re: InnoDB does not preserve AUTO_INCREMENT -- WTF!?

2006-11-10 Thread David Griffiths
bles from MYISM to INNODB, only to find out this colossal design flaw in InnoDB tables. We ship out mySQL on our appliances in enterprise level scenarios. We often like to start the AUTO_INCREMENT for several tables at 10,000 -- this way we can reserve the lower 'block' of IDs for o

Re: InnoDB does not preserve AUTO_INCREMENT -- WTF!?

2006-11-10 Thread Ryan Stille
les. We ship out mySQL on our appliances in enterprise level scenarios. We often like to start the AUTO_INCREMENT for several tables at 10,000 -- this way we can reserve the lower 'block' of IDs for our own internal and 'default' use so all customers have the same basic database

InnoDB does not preserve AUTO_INCREMENT -- WTF!?

2006-11-10 Thread Daevid Vincent
the AUTO_INCREMENT for several tables at 10,000 -- this way we can reserve the lower 'block' of IDs for our own internal and 'default' use so all customers have the same basic database schema. It also makes our code easier to write as we can, in one easy swoop, make the ID

Re: odd behaviour with auto_increment

2006-09-27 Thread Jorrit Kronjee
On 9/26/2006 4:02 PM, Dan Buettner wrote: > Jorrit, it's a known behavior, not a bug. > > Recent versions of MySQL will, when given a zero (0) as a value for an > auto incrementing identity column, simply fill in the next auto > incrementing value ... unless you flip a switch to specifically tell

Re: odd behaviour with auto_increment

2006-09-26 Thread Dan Buettner
l.com/doc/refman/4.1/en/server-sql-mode.html and look for NO_AUTO_VALUE_ON_ZERO HTH, Dan On 9/26/06, Jorrit Kronjee <[EMAIL PROTECTED]> wrote: Dear list, I discovered something that seems to be odd behaviour. I have a basic table with one column set to auto_increment: mysql> DESCRI

odd behaviour with auto_increment

2006-09-26 Thread Jorrit Kronjee
Dear list, I discovered something that seems to be odd behaviour. I have a basic table with one column set to auto_increment: mysql> DESCRIBE basic_table; +---+-+--+-+-++ | Field | Type| Null | Key | Default | Ex

Re: auto_increment field start value

2006-09-22 Thread dpgirago
At 14:16 -0500 9/22/06, [EMAIL PROTECTED] wrote: >> I seem to recall that when creating a table, you could designate an >> auto_increment field to begin counting at zero(0) instead of one (1), but I >> can't find an example in the documents. >> > Don'

Re: auto_increment field start value

2006-09-22 Thread Paul DuBois
At 14:16 -0500 9/22/06, [EMAIL PROTECTED] wrote: I seem to recall that when creating a table, you could designate an auto_increment field to begin counting at zero(0) instead of one (1), but I can't find an example in the documents. Don't store 0 in an AUTO_INCREMENT column. -- P

Re: Re: auto_increment field start value

2006-09-22 Thread Dan Buettner
NO_AUTO_VALUE_ON_ZERO Dan On 9/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Thanks, Dan, but I can't get it to work. Defining a column like this: << a int not null auto_increment=0 primary key >> throws an error, and while the alter table statement seems to work ok, whether th

Re: auto_increment field start value

2006-09-22 Thread dpgirago
OK. If you assign to auto_increment any number higher than what currently exists in the column, it changes the value and the incremented sequence from that point. But apparently you can't assign the value zero to the column, even if the table is empty. > Thanks, Dan, but I can't g

Re: auto_increment field start value

2006-09-22 Thread dpgirago
Thanks, Dan, but I can't get it to work. Defining a column like this: << a int not null auto_increment=0 primary key >> throws an error, and while the alter table statement seems to work ok, whether the table is empty or not, it has no effect on subsequent inserts. I'm wonde

Re: auto_increment field start value

2006-09-22 Thread Dan Buettner
David - there's some info in the online docs here: http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html Specifically: To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this: mysql> ALTER TABLE tbl AUTO_INCREME

auto_increment field start value

2006-09-22 Thread dpgirago
I seem to recall that when creating a table, you could designate an auto_increment field to begin counting at zero(0) instead of one (1), but I can't find an example in the documents. I'm using 4.0.16 and table type=myisam. David -- MySQL General Mailing List For list arch

RE: Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-14 Thread Daevid Vincent
= 65535 # MEDIUMTEXT = 16777215 # LONGTEXT = 4294967295 DÆVID > -Original Message- > From: Daniel Kasak [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 13, 2006 9:52 PM > To: wolverine my; mysql@lists.mysql.com > Subject: Re: Reset (or Defrag) the AUTO_IN

Re: Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-14 Thread Marco Simon
t; > I have the following tables and the data, > > CREATE TABLE category ( >id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY >name VARCHAR(50) NOT NULL > ); > > CREATE TABLE user ( >id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, >name VARCHAR(5

Re: Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-13 Thread Daniel Kasak
wolverine my wrote: > Yes, I agree on what you have described. > > However, what should we do when the value is reaching the maximum? To > alter the data type to a bigger one? Yes - convert the data type to a larger one. If you've got a mediumint, for example, you can convert it to an unsigned m

Re: Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-13 Thread wolverine my
same primary key. How do you figure out which record is the oldest one, which is the 2nd oldest one, which is the current one, etc? What happens if you have records in a related column that were referring to this primary key? You've got a big mess! Also, there's no such thing as 'd

Re: Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-13 Thread Daniel Kasak
o this primary key? You've got a big mess! Also, there's no such thing as 'defrag'ing an auto_increment column. The space left when you delete a row will be taken by another record when MySQL sees fit. If you absolutely must have a continuous stream of numbers for your primary

Reset (or Defrag) the AUTO_INCREMENT columns

2006-06-13 Thread wolverine my
Hi! I have the following tables and the data, CREATE TABLE category ( id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY name VARCHAR(50) NOT NULL ); CREATE TABLE user ( id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50) NOT NULL, category TINYINT UNSIGNED REFERENCES

Re: insert not working with auto_increment column

2006-06-13 Thread Digvijoy Chatterjee
On 6/13/06, Rob Desbois <[EMAIL PROTECTED]> wrote: If you are going to specify values for all columns in your insert, you should put NULL as the value for an AUTO_INCREMENT column, e.g. mysql> insert into SalesSupData values (NULL,2,2,'test',140); My preferred way however i

re: insert not working with auto_increment column

2006-06-13 Thread Rob Desbois
If you are going to specify values for all columns in your insert, you should put NULL as the value for an AUTO_INCREMENT column, e.g. mysql> insert into SalesSupData values (NULL,2,2,'test',140); My preferred way however is to put the column names and just miss out the auto_inc

insert not working with auto_increment column

2006-06-13 Thread Digvijoy Chatterjee
I have a problem with inserting data into table in Mysql. I have a Auto_increment Column in Table which throws errors when I try to insert into the table. This is table description. mysql> desc SalesSupData; +-+-+--+-+-++ | Fi

Re: auto_increment Question

2006-06-01 Thread Paul DuBois
auto_increment, no? Cheers. $people = "INSERT INTO people (people_id, people_full_name, people_isactor, people_isdirector) VALUES (1, 'Jim Carey', 1, 0), (2, 'Tom Shadyac', 0, 1), (3, 'Lawrence Kasdan', 0, 1), (4, 'Kevin Kline', 1, 0), (5, &#

Re: auto_increment Question

2006-06-01 Thread Douglas Sims
Hi Mark People_id is the column with auto increment? You can verify that it really does have auto_increment by using the "describe" command. For example: mysql> describe checks; +-+--+--+-+- ++ | Field

auto_increment Question

2006-06-01 Thread Mark Sargent
Hi All, if a table has an auto_incremented primary key why does the below code require the people_id to be manually inserted? I got this from Beginning PHP, Apache, MySQL Web Development book from Wrox. Curious, as it seems to defeat the purpose of auto_increment, no? Cheers. $people

Re: mysqldump ignores auto_increment

2006-04-14 Thread bagpuss
Figured out what was causing it The /etc/my.cnf had a line in it, in the [mysqldump] section... compatible=mysql40 Comment that line out and it works - we need that when sending data to customers who are still running mysql40. Now I know whats causing it, I can work around it. Many thanks, Ia

Re: mysqldump ignores auto_increment

2006-04-13 Thread bagpuss
Imran, Thanks for your reply. I tried what you asked, and it did the same. I then went onto a couple of other boxes with EXACTLY the same MySQL install and they worked (added the auto_increment). The box that fails is running Redhat 7.3 (for customer backward compatibilty). I dont have any other

mysqldump ignores auto_increment

2006-04-13 Thread bagpuss
Hi, I got confused looking to see if this was a known problem - so thought I'd try again. mysql_standard 4.1.16 on Linux... Synopsis: Create table with auto_increment mysqldump database output doesn't create table with auto_increment. Example: Create a table in a junk database usin

Re: auto_increment and the value 0

2006-03-29 Thread Gabriel PREDA
You can override MySQL behaviour of generating a new value if you insert a 0 into an auton_increment field. Quoting from the manual: > NO_AUTO_VALUE_ON_ZERO affects handling of AUTO_INCREMENT columns. > Normally, you generate the next sequence number for the column by inserting > eithe

Re: auto_increment and the value 0

2006-03-29 Thread Simon Garner
On 30/03/2006 12:31 p.m., Daniel Kasak wrote: [EMAIL PROTECTED] wrote: I suppose that would be alot easier than trying to bump the PK and related FK values of the whole table by 1, just to give the first row in the table the auto_increment value of 1? Yes. That sounds messy. What about

Re: auto_increment and the value 0

2006-03-29 Thread Daniel Kasak
next auto_increment value? Not really. The primary key isn't ( or at least shouldn't be ) used to determine 'position' in the record. If you are actually using the primary key to determine 'position', ie select * from table order by primary_key ... then yes, the posi

Re: auto_increment and the value 0

2006-03-29 Thread mysql
Are you saying just change the row with the 0 value as the PK, and change the FK's in the related tables to point to the new value instaed of 0? If so, would this move the row logically to the end of the table, if the 0 PK was replaced with the next auto_increment value? I suppose

Re: auto_increment and the value 0

2006-03-29 Thread Daniel Kasak
Stanton, Brian wrote: I'm migrating a database from 4.0.12 on Solaris to 4.0.18-0 on Red Hat Linux. A few of the tables have a 0 (zero) in the auto_increment primary key column. However, when importing, the 0 in the insert is translated to the next available auto_increment value thus caus

auto_increment and the value 0

2006-03-29 Thread Stanton, Brian
I'm migrating a database from 4.0.12 on Solaris to 4.0.18-0 on Red Hat Linux. A few of the tables have a 0 (zero) in the auto_increment primary key column. However, when importing, the 0 in the insert is translated to the next available auto_increment value thus causing a duplicate key situ

Re: auto_increment syntax

2006-03-23 Thread Simon Garner
On 24/03/2006 11:06 a.m., Eric Beversluis wrote: Can someone illustrate the correct syntax for using auto_increment in making a table? I've studied the manual and I'm not seeing how it comes out. EG: CREATE TABLE Books ( bookID INT(5) PRIMARY KEY AUTO_INCREMENT... THEN WHAT?

auto_increment syntax

2006-03-23 Thread Eric Beversluis
Can someone illustrate the correct syntax for using auto_increment in making a table? I've studied the manual and I'm not seeing how it comes out. EG: CREATE TABLE Books ( bookID INT(5) PRIMARY KEY AUTO_INCREMENT... THEN WHAT? Thanks. EB -- MySQL General Mailing List For lis

Re: auto_increment

2006-02-03 Thread sheeri kritzer
You can change the table definition to not have the auto_increment column, and then ALTER TABLE MODIFY COLUMN after that. However, if you post your errors here, perhaps you'll get the answer that actually solves the problem, instead of working around it to possibly leave bad data for y

Re: auto_increment

2006-02-03 Thread Gleb Paharenko
wrote: > Hi All, > > I'm trying to restore a database where the first column is set to > auto_increment. When I apply the inserts created from the mysqldump I get > errors about the auto_increment column. Is there a may to turn it off while > I run the inserts or do I have to m

auto_increment

2006-02-03 Thread Scott Johnson
Hi All, I'm trying to restore a database where the first column is set to auto_increment. When I apply the inserts created from the mysqldump I get errors about the auto_increment column. Is there a may to turn it off while I run the inserts or do I have to modify the table? Thanks,

[Fwd: Primary Key Generator as auto_increment replacement]

2006-02-03 Thread Ady Wicaksono
Anybody has idea about primary key generator to replace auto_increment as primary key? I found this problem too (http://bugs.mysql.com/bug.php?id=16979) since huge insert/update/select count(*) work parallel frequently, . i got deadlock :( Thx -- MySQL General Mailing List

Primary Key Generator as auto_increment replacement

2006-02-03 Thread Ady Wicaksono
Anybody has idea about primary key generator to replace auto_increment as primary key? I found this problem too (http://bugs.mysql.com/bug.php?id=16979) since huge insert/update/select count(*) work parallel frequently, . i got deadlock :( Thx -- MySQL General Mailing List For list

Re: Auto_Increment value

2005-12-03 Thread Cal Evans
http://dev.mysql.com/doc/refman/4.1/en/odbc-and-last-insert-id.html | | Cal Evans | http://www.calevans.com | Danesh Daroui wrote: Hi all, I have a simple table with an Auto_Increment column. I insert NULL to this column each time I insert a row to have an automatic unique value

Auto_Increment value

2005-12-03 Thread Danesh Daroui
Hi all, I have a simple table with an Auto_Increment column. I insert NULL to this column each time I insert a row to have an automatic unique value. The problem is that I want to have new automatically generated value back to insert it to another table. How can I have new

Auto_Increment Value

2005-12-03 Thread Danesh Daroui
Hi all, I have a simple table with an Auto_Increment column. I insert NULL to this column each time I insert a row to have an automatic unique value. The problem is that I want to have new automatically generated value back to insert it to another table. How can I have new

Re: chronological auto_increment problem

2005-11-11 Thread Jigal van Hemert
InterNetX - Andreas Prasch wrote: Hi, I have a master and a slave mysql server. On the master I write binlogs needed for replication. From time to time I have chronological auto_increment problems, here's a short explanation. - the table structure : | Field | Type| Null | Key | De

chronological auto_increment problem

2005-11-09 Thread InterNetX - Andreas Prasch
Hi, I have a master and a slave mysql server. On the master I write binlogs needed for replication. From time to time I have chronological auto_increment problems, here's a short explanation. - the table structure : | Field | Type| Null | Key | Default |

Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread Daniel Kasak
Eamon Daly wrote: We have a table containing just one column that we use for unique IDs: CREATE TABLE `id_sequence` ( `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`) ) TYPE=MyISAM Watching 'SHOW FULL PROCESSLIST' and reading the slow query log shows the occasion

Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread Gleb Paharenko
AUTO_INCREMENT columns in InnoDB. See: http://dev.mysql.com/doc/mysql/en/innodb-auto-increment-column.html "Eamon Daly" <[EMAIL PROTECTED]> wrote: > We have a table containing just one column that we use for > unique IDs: > > CREATE TABLE `id

Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread SGreen
<[EMAIL PROTECTED]> > To: "Eamon Daly" <[EMAIL PROTECTED]> > Cc: > Sent: Wednesday, August 24, 2005 12:05 PM > Subject: Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table > > > > "Eamon Daly" <[EMAIL PROTECTED]> wrote on 08/24/

Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread Eamon Daly
Sent: Wednesday, August 24, 2005 12:05 PM Subject: Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table "Eamon Daly" <[EMAIL PROTECTED]> wrote on 08/24/2005 12:40:55 PM: We have a table containing just one column that we use for unique IDs: CREATE TABLE `id_sequence` ( `i

Re: MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread SGreen
"Eamon Daly" <[EMAIL PROTECTED]> wrote on 08/24/2005 12:40:55 PM: > We have a table containing just one column that we use for > unique IDs: > > CREATE TABLE `id_sequence` ( > `id` int(10) unsigned NOT NULL auto_increment, > PRIMARY KEY (`id`) > )

MyISAM vs. InnoDB for an AUTO_INCREMENT counter table

2005-08-24 Thread Eamon Daly
We have a table containing just one column that we use for unique IDs: CREATE TABLE `id_sequence` ( `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`) ) TYPE=MyISAM Watching 'SHOW FULL PROCESSLIST' and reading the slow query log shows the occasional backlog of

Re: multi-thread insert into innodb table with auto_increment column cause deadlock

2005-05-30 Thread Gu Lei
YES  | | NULL  |    | | SN    | int(11)  |  | UNI | NULL  | auto_increment | +---+--+--+-+---++ 6 rows in set (0.00 sec) client:  OS fedora3   MyODBC3.51.10  unixODBC 2.2.9 server: OS Red

multi-thread insert into innodb table with auto_increment column cause deadlock

2005-05-29 Thread Gu Lei
ULL  |    | | SN    | int(11)  |  | UNI | NULL  | auto_increment | +---+--+--+-+---++ 6 rows in set (0.00 sec) client:  OS fedora3   MyODBC3.51.10  unixODBC 2.2.9 server: OS RedHat Adavanced server3.0 My

Re: auto_increment trouble (not the usual check || alter table solution, though)

2005-05-27 Thread Ricardo Oliveira
62141 | text | > | 262142 | text | > | 262143 | text | > | 262144 | text | > ++--+ > 5 rows in set (0.00 sec) > > it's surprising that you can insert NULL in a primary key auto_increment. > second, with only 1 values, if the auto_increment

Re: ON DUPLICATE KEY UPDATE and AUTO_INCREMENT columns

2005-05-20 Thread mfatene
Hi Sven, Last_insert_id is not what your're looking for, for the same reason you give about max(id) : your insert can find a duplicate key because another user inserted an id between two of yours. Last_insert_id gives just the last auto_increment id for success in insertion. Suppose that

Re: ON DUPLICATE KEY UPDATE and AUTO_INCREMENT columns

2005-05-19 Thread Sven Paulus
try to insert an existing value (in the second column), the LAST_INSERT_ID() contains a random value (the next auto_increment value going to be used?) afterwards. So I can't rely in retrieving LAST_INSERT_ID(). > Since last_insert_id() has a connection scope, it's better for you to use

Re: ON DUPLICATE KEY UPDATE and AUTO_INCREMENT columns

2005-05-19 Thread mfatene
ven Paulus <[EMAIL PROTECTED]>: > Hi, > > I'd like to insert string values into a table. If I add a new string, I want > to get back the value of the AUTO_INCREMENT column. If the string already > exists in the table, I'd like to get the AUTO_INCREMENT value of

ON DUPLICATE KEY UPDATE and AUTO_INCREMENT columns

2005-05-19 Thread Sven Paulus
Hi, I'd like to insert string values into a table. If I add a new string, I want to get back the value of the AUTO_INCREMENT column. If the string already exists in the table, I'd like to get the AUTO_INCREMENT value of the existing entry. I thought this might be possible using INS

Re: auto_increment trouble (not the usual check || alter table solution, though)

2005-05-16 Thread Ricardo Oliveira
Partha, Partha Dutta wrote: This may not be a very elegant solution, but you can do this just to get the inserts going again: ALTER TABLE users MODIFY COLUMN uid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT; If you don't have any negative uids, then you will be able to store 2 billion more uids.

Re: auto_increment trouble (not the usual check || alter table solution, though)

2005-05-16 Thread mfatene
5 rows in set (0.00 sec) it's surprising that you can insert NULL in a primary key auto_increment. second, with only 1 values, if the auto_increment reached 2147483647 this means that you have an intensive delete, or the auto_increment had been altered. you can create table toto like users,

Re: auto_increment trouble (not the usual check || alter table solution, though)

2005-05-16 Thread Ricardo Oliveira
Partha, On 5/16/05, Partha Dutta <[EMAIL PROTECTED]> wrote: > This may not be a very elegant solution, but you can do this just to get the > inserts going again: > > ALTER TABLE users > MODIFY COLUMN uid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT; > > If you don't

RE: auto_increment trouble (not the usual check || alter table solution, though)

2005-05-16 Thread Partha Dutta
This may not be a very elegant solution, but you can do this just to get the inserts going again: ALTER TABLE users MODIFY COLUMN uid INTEGER UNSIGNED NOT NULL AUTO_INCREMENT; If you don't have any negative uids, then you will be able to store 2 billion more uids. Just out of curiosity,

auto_increment trouble (not the usual check || alter table solution, though)

2005-05-16 Thread Ricardo Oliveira
le which holds records from user profiles. It's a very simple table, with one auto_increment field and a bunch of other field - nothing out of the ordinary. To those of you familiar with slashcode, it's an old version of the users table: CREATE TABLE users ( uid int(11) NOT NULL auto_inc

Re: Is this wise use of auto_increment?

2005-04-05 Thread SGreen
es is a key that maps > to multiple rows in the other table. This is the sane thing to do if > there were'nt any order requirements: > > CREATE TABLE Bar ( > ... other stuff ... > key1 int unsigned not null auto_increment, > UNIQUE (key1), > ... > ); > CR

Is this wise use of auto_increment?

2005-04-04 Thread Julian Pellico
x27;nt any order requirements: CREATE TABLE Bar ( ... other stuff ... key1 int unsigned not null auto_increment, UNIQUE (key1), ... ); CREATE TABLE Foo ( key1 int unsigned not null, key2 int unsigned not null, value int, PRIMARY KEY k (key1, key2) ); However, I need to insert a set of

mysqldump and missing AUTO_INCREMENT=1000 ??

2005-03-29 Thread Daevid Vincent
I have a table that I created by hand like this: DROP TABLE IF EXISTS testset; CREATE TABLE testset ( id int(10) unsigned NOT NULL auto_increment, name varchar(50) NOT NULL default '', special enum('','all','safe','unsafe') NOT NULL defaul

mysqldump and auto_increment

2005-02-24 Thread Jim McAtee
The reason I asked about auto_increment behavior is that I'm looking at the output from mysqldump --opt and there are no commands to preserve/set the auto_increment value. Is there a mysqldump option to do this? Or will restoring from a dump always leave the auto_increment value one gr

Re: auto_increment insert-delete-insert

2005-02-24 Thread SGreen
"Jim McAtee" <[EMAIL PROTECTED]> wrote on 02/24/2005 04:50:11 PM: > Say a row is inserted into a table with an auto_increment column and then > deleted before another record is inserted. When a new row is inserted, > will the value of the auto_increment column b

Re: auto_increment insert-delete-insert

2005-02-24 Thread Daniel Kasak
Jim McAtee wrote: Say a row is inserted into a table with an auto_increment column and then deleted before another record is inserted. When a new row is inserted, will the value of the auto_increment column be the same as the deleted record's, or will it be one greater? Greater. -- D

auto_increment insert-delete-insert

2005-02-24 Thread Jim McAtee
Say a row is inserted into a table with an auto_increment column and then deleted before another record is inserted. When a new row is inserted, will the value of the auto_increment column be the same as the deleted record's, or will it be one greater? -- MySQL General Mailing List For

Re: set auto_increment does not work?

2005-02-23 Thread Heikki Tuuri
Hi! For InnoDB, CREATE TABLE ... AUTO_INCREMENT=... works starting from 5.0.3. Until then, you have to use the 'insert + delete a dummy row' method to init the counter. Best regards, Heikki Tuuri Innobase Oy Foreign keys, transactions, and row level locking for MySQL InnoDB Hot Back

Re: set auto_increment does not work?

2005-02-22 Thread Rich Lafferty
On Tue, Feb 22, 2005 at 03:46:34PM -0600, Scott Purcell <[EMAIL PROTECTED]> wrote: > Hello, > > ALTER TABLE tbl_name AUTO_INCREMENT = 1000 > will start your records at 1000 > > But it does not work for myself. How can I get the auto_increment to > begin at a set sta

set auto_increment does not work?

2005-02-22 Thread Scott Purcell
Hello, I am having trouble getting the auto_increment function to begin at a set value. When I search the docs, I find information like: Posted by Michael Craig on September 6 2002 9:51pm [ <http://dev.mysql.com/doc/mysql/comment.php?id=1058&action=delete> Delete]

Re: auto_increment not working?

2005-02-18 Thread courtot
it doesn't work with innodb table. http://dev.mysql.com/doc/mysql/en/innodb-restrictions.html InnoDB does not support the AUTO_INCREMENT table option for setting the initial sequence value in a CREATE TABLE or ALTER TABLE statement. To set the value with InnoDB, insert a dummy row with a

Re: auto_increment not working?

2005-02-18 Thread daniel
I am not really experienced on this, but i have noticed that simply truncating an innodb table doesnt reset the autoinc key, u have to redump the table. I cant see what you are trying to do here ALTER TABLE users auto_increment = 590; set it to start @ 590 ? > Hello, > I am trying

auto_increment not working?

2005-02-18 Thread Scott Purcell
Hello, I am trying to get auto_increment to begin at a certain integer. CREATE TABLE USERS ( user_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, username varchar(50), firstname varchar(50), middlename varchar(50), lastname varchar(50), email varchar(100

Re: auto_increment=0

2005-02-17 Thread Gleb Paharenko
Hello. Use the NO_AUTO_VALUE_ON_ZERO sql mode. See: http://dev.mysql.com/doc/mysql/en/server-sql-mode.html Philippe Rousselot <[EMAIL PROTECTED]> wrote: > hi, > > I am migrating a DB having a table with a UID not_null autoincrement > > the original table starts at UID=0 >

auto_increment=0

2005-02-16 Thread Philippe Rousselot
hi, I am migrating a DB having a table with a UID not_null autoincrement the original table starts at UID=0 I cannot migrate this table autmaticaly as the line for UID=0 is automatically transformed into UID=1 and therefore I get an error message for the next line (UID=1) as being already into t

Re: Corrupted auto_increment?

2005-01-31 Thread Gleb Paharenko
le will throw an error > regarding a duplicate key value in an auto_increment field. I assume that > something is corrupted. > > There are 779239 records, the most recently added having an auto_increment > ID field of 779239. When a new record is added, MySQL attempts to give it

Corrupted auto_increment?

2005-01-30 Thread Jim McAtee
A server running MySQL 3.23 crashed yesterday. Since bringing it back online, doing inserts into a particular table will throw an error regarding a duplicate key value in an auto_increment field. I assume that something is corrupted. There are 779239 records, the most recently added having

Re: AUTO_INCREMENT working

2004-12-14 Thread Gleb Paharenko
Hello. There were several bugs in older versions of MySQL related to 'duplicate entry' errors. Do you use latest release? In documentation it is said that AUTO_INCREMENT works correctly with replication. Please also take a look in the documentation at these links: http://dev.mys

AUTO_INCREMENT working

2004-12-13 Thread Mitul Bhammar
Can anybody tell me how AUTO_INCREMENT works in MySQL especially when we are using DB Replications. At times I get duplicate key error though taken care that the insertions and updations are done in the master db.

Re: AUTO_INCREMENT

2004-09-16 Thread SGreen
According to http://dev.mysql.com/doc/mysql/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. It did not specify that the AUTO_INCREMENT column couldn't have a regular index on it. If you have this

AUTO_INCREMENT

2004-09-15 Thread Seena Blace
Hi, Is there any way AUTO_INCREMENT column cann't me Primary key ? One table has one column auto_increment which I want to convert into non primary key but I also want to maintain the column.How to do that? thanks - Do you

Re: Auto_increment

2004-09-10 Thread SGreen
r to that column by surrounding its name with backticks. May I suggest you use an alternate spelling (like "key_") or an alternate name (like "id") for your column to avoid needing backticks? Anyway, if you _must_ keep your current design choice: CREATE TABLE backticktest

Auto_increment

2004-09-10 Thread Pahlevanzadeh Mohsen
Dears, I need to define a column within my table.I want to name it "key".Also i need to it is auto_increment & not null.Also i want to it is primary key. Please tell its statement. Yours,Mohsen = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh///

RE: Auto_increment and existing table

2004-08-11 Thread Scott Hamm
Thanks! -Original Message- From: Victor Pendleton [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 3:40 PM To: 'Scott Hamm '; ''Mysql ' (E-mail) ' Subject: RE: Auto_increment and existing table If you do an ALTER TABLE table_name MODIFY id INTEG

RE: Auto_increment and existing table

2004-08-11 Thread Victor Pendleton
If you do an ALTER TABLE table_name MODIFY id INTEGER AUTO_INCREMENT, ADD PRIMARY KEY(id); ... The next record entered should be properly auto_incremented. -Original Message- From: Scott Hamm To: 'Mysql ' (E-mail) Sent: 8/11/04 1:32 PM Subject: Auto_increment and existing t

Auto_increment and existing table

2004-08-11 Thread Scott Hamm
I've imported Access DB into MySQL, and AutoID was lost. The number in ID column exists and I wonder if I update the column from int(10) to auto_increment, will it replace existing number with MySQL's auto_increment number? Or is there a proper way to update from int(10) to auto_increme

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-23 Thread Kevin Brock
On Jun 23, 2004, at 8:15 AM, Michael Stassen wrote: So, if I understand you correctly, somewhere in the middle of a 20,000 row insert, a row gets inserted with auto_increment id = 87,123,456, say, then the next row tries to insert with the value 87,123,457 but fails. You fix this by skipping

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-23 Thread Michael Stassen
So, if I understand you correctly, somewhere in the middle of a 20,000 row insert, a row gets inserted with auto_increment id = 87,123,456, say, then the next row tries to insert with the value 87,123,457 but fails. You fix this by skipping the next value with ALTER TABLE yourtable

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-22 Thread Kevin Brock
On Jun 18, 2004, at 5:31 PM, Scott Haneda wrote: While I do not know why, I would suggest you simply drop the PK and recreate it, this should be a whole lot faster than the alter. This took the same amount of time as the alter table (a little longer actually). The documentation says that in late

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-20 Thread Michael Stassen
Robert A. Rosenberg wrote: At 13:37 -0400 on 06/19/2004, Michael Stassen wrote about Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a: Finally, just to cover all the bases, that really is 87 million inserts, not 8.7 million, right? I only ask because a MEDIUMINT column runs

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-20 Thread Robert A. Rosenberg
At 13:37 -0400 on 06/19/2004, Michael Stassen wrote about Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a: Finally, just to cover all the bases, that really is 87 million inserts, not 8.7 million, right? I only ask because a MEDIUMINT column runs out a little past 8.3 millio

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-19 Thread Robert A. Rosenberg
At 17:16 -0700 on 06/18/2004, Kevin Brock wrote about AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one: We have a table with a primary index which is INT NOT NULL AUTO_INCREMENT. After inserting ~87,000,000 entries, we started seeing error 1062, ER_DUP_ENTRY. You are wasting half

Re: AUTO_INCREMENT problem... ER_DUP_ENTRY? (No, it's not a one byte index :)

2004-06-19 Thread Kevin Brock
On Jun 19, 2004, at 10:37 AM, Michael Stassen wrote: Something about your description doesn't quite fit, however. You say that you are "nowhere near the limit", but you say that resetting the "auto_increment starting point" fixes the problem. Those seem contradict

<    1   2   3   4   5   6   7   >