postgreSqL的序列sequence
2024-08-21 05:29:45
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
最新文章
- DB2 JDBC
- Hibernate Id Generator and Primary Key
- JavaScript判断图片是否加载完成的三种方式
- 一个Java对象到底占用多大内存?
- Introduction to Project Management(II)
- Oracle RAC环境下如何更新patch(Rolling Patch)
- kubuntu/ubuntu下安装fcitx输入法
- Linux64位程序中的漏洞利用
- Educational Codeforces Round 56 (Rated for Div. 2) D
- Java8虚拟机内存模型
- python 字典 拼接SQL语句
- 关于NGUI Shader 和 Draw Call的优化 &; 模糊shader
- 十四、文件和目录——文件时间和utime函数
- 转载:JAVA序列化与反序列化 (作者:YSOcean)
- CSS background-image背景图片相关介绍
- 第二个Sprint ------第七天、第八天、第九天、第十天,第十一天
- 【HNOI2007】紧急疏散
- Java学习(异常类)
- 2017-2018-1 JaWorld 团队作业--冲刺2
- MongoDB安装及启动