note 9198 deleted from function.pg-exec by nlopess

From: Date: Sat, 26 Jun 2004 19:18:29 +0000
Subject: note 9198 deleted from function.pg-exec by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71822@lists.php.net to get a copy of this message
Note Submitter: brooke@jump.net ---- A lot of people have griped about getLastOid vs. other methods. Here's the real deal:<br> One of the many greatnesses of Postgres is Declarative Referential Integrity, available in versions with major number 7 and up. Unfortunately in the beta versions I tried, you could not declare referential integrity against the oid attribute of a table. Therefore, you had to use an explicit "id" field. You could use a serial type (ie default value=nextval(series)) but then if you want the generated ID, you have to do a table lookup to find it. The right way to do it is to explicitly read nextval(sequence) and use it. If somebody gives you holes in your sequence, that's totally OK and a fact of life. It's the only tradeoff which is both fast and correct.

« previous php.notes (#71822) next »