首页 > 代码库 > postgreSqL的序列sequence
postgreSqL的序列sequence
PostgreSQL uses sequences to generate values for serial
columns and serial
columns are generally what is used for "auto-incrementing" columns in PostgreSQL. Sequences have names and are, in general, independent of any particular table so you could have one sequence generating unique IDs for several different tables; the sequence name is what lastInsertId
wants as its argument:
For example, PDO_PGSQL() requires you to specify the name of a sequence object for the name parameter.
The sequence object created by PostgreSQL is automatically named [table]_[column]_seq
, So:
$id = $db->lastInsertId(‘tableName_columnName_seq‘);
reference: http://stackoverflow.com/questions/10492566/lastinsertid-does-not-work-in-postgresql
postgreSqL的序列sequence
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。