Re: MDB - insert query
| From: | Alexey Borzov | Date: | Fri, 07 Mar 2003 17:34:04 +0000 |
| Subject: | Re: MDB - insert query | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4094@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
No, it's an old feature, probably as old as sequences themselves. I do not know the semantics of currId, but see the difference in behaviour between currval and last_value: Connection 1 established Connection 2 established Connection 1: SELECT nextval('foo_seq') ---> 5 Connection 2: SELECT currval('foo_seq') ---> error, we didn't do nextval Connection 2: SELECT last_value FROM foo_seq ---> 5 Connection 2: SELECT nextval('foo_seq') ---> 6 Connection 1: SELECT currval('foo_seq') ---> 5 (this is the value for this connection) Connection 1: SELECT last_value FROM foo_seq ---> 6 (this is the concurrency problem I talked about) Connection 2: SELECT currval('foo_seq') ---> 6Looks like you've found another bug as well. SELECT last_value is a Bad Way of getting current value of PostgreSQL sequence, there are possible concurrency problems. The query should be "SELECT currval('$seqname')"Do you know if currval() is a new feature? This stuff is taken from the Metabase driver and I assume Manuel did it for a reason (he always does). This is the reason we don't use LIMIT either