Re: Moving from MySQL to PGSQL....some questions (multilevel

From: Paulovič Michal <michal(at)paulovic(dot)sk>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Moving from MySQL to PGSQL....some questions (multilevel
Date: 2004-03-03 17:07:56
Message-ID: 404610EC.5000308@paulovic.sk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

There is no problem with MySQL but how you build this functionality in
PgSQL?????

Lincoln Yeoh wrote:

> Uh, which behaviour do you want? The one Scott just got, or the one
> you claimed to get earlier (which is not the same as what Scott got).
> I'm not sure how you can do on MySQL what you claimed to get on MySQL
> with just the autoincrement feature.
>
> Do you require a contiguous sequence of numbers - no skipped numbers,
> or ascending unique numbers will do?
>
> At 06:45 AM 3/3/2004 +0100, Paulovič Michal wrote:
>
>> Yes I know,
>>
>> But how you do this at PgSQL????
>>
>>
>> scott.marlowe wrote:
>>
>>> 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
>>>
>>> mysql> insert into test (id1) values (1);
>>> Query OK, 1 row affected (0.00 sec)
>>>
>>> mysql> insert into test (id1) values (1);
>>> Query OK, 1 row affected (0.00 sec)
>>>
>>> mysql> insert into test (id1) values (2);
>>> Query OK, 1 row affected (0.00 sec)
>>>
>>> mysql> insert into test (id1) values (1);
>>> Query OK, 1 row affected (0.00 sec)
>>>
>>> mysql> insert into test (id1) values (2);
>>> Query OK, 1 row affected (0.00 sec)
>>>
>>> mysql> select * from test;
>>> +------+-----+
>>> | id1 | id2 |
>>> +------+-----+
>>> | 1 | 1 |
>>> | 1 | 2 |
>>> | 1 | 4 |
>>> | 2 | 3 |
>>> | 2 | 5 |
>>> +------+-----+
>>> 5 rows in set (0.00 sec)
>>>
>>> I'm running an older flavor of 3.23.41, it's what came with RH 7.2
>>>
>>> Or did I do something different?
>>>
>>>
>>>> Result is:
>>>> 1,1
>>>> 1,2
>>>> 2,1
>>>> 1,3
>>>> 2,2
>>>>
>>>> How you convert this functionality from MySQL to PgSQL???
>>>>
>>>
>>>
>>> ---------------------------(end of
>>> broadcast)---------------------------
>>> TIP 1: subscribe and unsubscribe commands go 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
>>>
>>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 8: explain analyze is your friend
>>
>>
>
>
>
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Server.
> http://www.nod32.com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paulovič Michal 2004-03-03 17:12:18 Re: Moving from MySQL to PGSQL....some questions (multilevel
Previous Message Harald Fuchs 2004-03-03 16:59:02 Re: Moving from MySQL to PGSQL....some questions (multilevel