From: | Paulovič Michal <michal(at)paulovic(dot)sk> |
---|---|
To: | Harald Fuchs <hf118(at)protecting(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Moving from MySQL to PGSQL....some questions (multilevel |
Date: | 2004-03-03 17:12:18 |
Message-ID: | 404611F2.8070903@paulovic.sk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Harald Fuchs wrote:
>In article <Pine(dot)LNX(dot)4(dot)33(dot)0403021406090(dot)4475-100000(at)css120(dot)ihs(dot)com>,
>"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
>
>
>
>>On Tue, 2 Mar 2004, [UTF-8] PauloviÄ Michal wrote:
>>
>>
>>>how you solve the problem with multilevel autoicrement?
>>>
>>>In MySQL you create table with col1, col2. Col 2 is AUTOICREMENT and you
>>>have to create UNIQUE INDEX (Col1, Col2). If you insert to this table
>>>for col1 volume 1, col2 automaticaly increase by one.
>>>
>>>Example:
>>>Insert into table values (1);
>>>Insert into table values (1);
>>>Insert into table values (2);
>>>Insert into table values (1);
>>>Insert into table values (2);
>>>
>>>
>
>
>
>>I did this in MySQL and got this:
>>
>>
>
>
>
>>create table test (id1 int, id2 int auto_increment, primary key(id2));
>>Query OK, 0 rows affected (0.00 sec)
>>
>>
>
>mysql> alter table test add unique index (id1, id2);
>
>
>>Query OK, 0 rows affected (0.09 sec)
>>Records: 0 Duplicates: 0 Warnings: 0
>>
>>
>
>You can't have a multi-level autoincrement if you make the second
>level unique. Use the following instead:
>
> create table test (id1 int, id2 int auto_increment, primary key(id1,id2));
>
>Note that this trick works only for the MyISAM and BDB table types,
>not for InnoDB.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
>________ Information from NOD32 ________
>This message was checked by NOD32 Antivirus System for Linux Mail Server.
>http://www.nod32.com
>
>
>
You don't build secent level unique
You have to create uniqe index under both levels (first and second)
together. But in MySQL there is no problem.
I alredy have table with mulitlevel autoincrement (in MySQL) but now I
want move this to PostgreSQL 7.1, and i have problem with this. It
doesn't work :-((((
From | Date | Subject | |
---|---|---|---|
Next Message | Gellert, Andre | 2004-03-03 17:17:06 | Mistake in my query or Index Scan on subquery failure? (7.4) |
Previous Message | Paulovič Michal | 2004-03-03 17:07:56 | Re: Moving from MySQL to PGSQL....some questions (multilevel |