Обсуждение: problems with nextval

Поиск
Список
Период
Сортировка

problems with nextval

От
Patricia Yábar
Дата:
Hello,
firsts at all sorry for my english and I hope write well.

I create a table using the instruction:

$q=pg_exec($conn,"create table xxx as select codi,
telephone,netxval('name_sequence') as id order by codi,telephone");
and when I list the table the value of nextval is incorrect.
For example two registers sequentially  that I saw when i
proved only the select  was create with the value of netxval change.
With out netxval the sequence is correct
I saw in select with out netxval
name:  telephone

John   123
John   456

was create with netxval
name   telephone      id (value of netxval)
John    456              1
John    123              2

Then I create only the table and then fill the values. making a
separated query for netxval and the registers was good.
Mi conclusion is, that using netxval in this cases is not good but I
want to know if I'm right or there are  others solutions that I can use
when I want to this.
Thanks.