Sequences without blank holes
От | MaRcElO PeReIrA |
---|---|
Тема | Sequences without blank holes |
Дата | |
Msg-id | 20031106080154.52905.qmail@web20202.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: Sequences without blank holes
Re: Sequences without blank holes Re: Sequences without blank holes Re: Sequences without blank holes |
Список | pgsql-general |
Hi guys, I have been using the following table (short, short, short version): CREATE TABLE products ( prod_id SERIAL, description TEXT ); BUT, there is lots os users blaming because the holes in the [prod_id] field (and, of course it as supposed to be like this, because sequences only increase their values and never rollback). So, a real SELECT statement would return: $ select * from products; prod_id | description --------+--------------------- 1 | S470DXBLM 12 | S470DXABM 33 | RG250DX --------+--------------------- (3 rows) and it is ok to me, but not to the users. How can I assure a ''sequence WITHOUT holes''? Sequences?? Triggers?? Functions?? IF I had ``very few lines'' on the table, ``very few users'' AND it was a kidding software, I would use: $ SELECT max(prod_id)+1 FROM products; to know the values of the next prod_id, but I really think it is not the best way to do that. Could you help me in this way?? Thanks in advances and Best Regards, Marcelo Pereira PHP/SQL/PostgreSQL Universidade Estadual de Campinas São Paulo / Brazil Yahoo! Mail - 6MB, anti-spam e antivírus gratuito. Crie sua conta agora: http://mail.yahoo.com.br
В списке pgsql-general по дате отправления: