sequences

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

sequences

От:
"Patrick Welche" <prlw1@newn.cam.ac.uk>
Дата:
After the interesting discussion on what is the safest way to have a unique
"oid"-like value per row, I thought I would have a go, but from libpq++ I
don't seem to be able to read the new sequence value:

Table    = person
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| id                               | int4 not null default nextval('p |     4 |
| surname                          | text not null                    |   var |
| firstname                        | text not null                    |   var |
| email                            | text                             |   var |
| phone                            | text                             |   var |
| rfbdate                          | date                             |     4 |
+----------------------------------+----------------------------------+-------+
Index:    person_id_key

The output from my test program is:

INSERT INTO person (surname,firstname,email,phone) VALUES ('Welche','Patrick','
prlw1',null)
SELECT currval('person_id_seq')    Missing person id

and the relevant bit of code is:
       query<<"INSERT INTO person (surname,firstname,email,phone) VALUES ('"            <
FAQ