createSequence {pgUtils} | R Documentation |
createSequence
creates a PostgreSQL SEQUENCE. SEQUENCEs allow the creation of autoincrementing sequences.
createSequence(con, name=NULL, increment=1, start=100)
con |
A connection object (create it with the dbConnect.PgSQL.conn function from the package RdbiPgSQL) |
name |
The name for the sequence |
increment |
the value to increment the sequence by each call, by default 1. |
start |
the starting value of the sequence, by default 100. |
creates a PostgreSQL SEQUENCE table. Such a sequence table can be used to get unique numbers and are therefore ideal for Primary keys (by creating a table with the default call createDBTable also a sequence will be created, to get unique Primary keys for the rows). To get the next value from the sequece only call nextval('<sequence name>'). For more details look in the PostgreSQL reference manual.
Johannes Rainer