Native Sequence Lookup for postgres - Re: [PEAR-BUG] Bug #97 [Fbk]: [Feature Request]
| From: | Alan Knowles | Date: | Wed, 17 Mar 2004 05:31:32 +0000 |
| Subject: | Native Sequence Lookup for postgres - Re: [PEAR-BUG] Bug #97 [Fbk]: [Feature Request] | ||
| References: | 1 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-26486@lists.php.net to get a copy of this message | ||
Cross posted..
Can whoever sent me the patch for dataobjects to query postgres for the name of the nextval() sequence key add comments to this bug report..
It's disappeared in a flood of emails over the last few months..
Thanks
Alan
PHP Bug Database wrote:
ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://pear.php.net/bugs/bug.php?id=97&edit=2-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comID: 97 Updated by: danielc@php.net Reported By: alan at akbkhome dot com Status: Feedback Bug Type: DBOperating System: allPHP Version: Irrelevant Assigned To: danielcNew Comment: Hi Alan: Pardon my delay in getting back to you on this. Can you please provide a patch that implements what you're thinking? Thanks. Previous Comments: ------------------------------------------------------------------------ [2004-01-21 06:05:08] alan_k@php.net native as in defined as the default value for a column.. eg. id int(11) default nextval(mysequence), unless you manually specify 'mysequence' for the sequence - you are likely to create a different sequence (normally {tablename}_seq acutally for table info on the above example - it should returb something like [name] => 'id' [type] => 'int(11)' [sequence_name] => 'mysequence' .... ------------------------------------------------------------------------ [2004-01-20 11:43:37] danielc@php.net Yeah, I guess we could add the argument to the sequence methods in all of the drivers. I'm now looking at pgsql.php. It does use native sequences. createSequence() does a CREATE SEQUENCE and nextID() calls SELECT NEXTVAL(). This should always return a unique ID, even when multiple sessions are in use. Here's the documentation: http://www.postgresql.org/docs/current/interactive/sql-createsequence.html Can you elaborate on what you mean, please? By "prefer it to be returned by tableinfo as well" you mean you'd like the method to be able to indicate if a column is auto-incremented? I've been gradually cleaning up and testing the tableInfo methods. I'll add this type of column into the mix and see what can be done with it. ------------------------------------------------------------------------ [2004-01-20 02:06:57] alan_k@php.net Should be ok - other databases can just ignore the value. they would just fall back to non-native sequences.. I guess the main reason is that if a database is used by other applications - eg. perl.. VB or something.. they can be updated independantly. I would prefer it to be returned by tableinfo as well.. ------------------------------------------------------------------------ [2004-01-20 01:46:54] danielc@php.net Wouldn't an extra argument cause difficulties for people moving from pgsql to another driver? ------------------------------------------------------------------------ [2003-10-13 20:56:26] alan at akbkhome dot com Description: ------------ add an option to nextId(), to lookup the databases default nextID eg. as defined by id int(11) default nextval(mysequence), .... - it is known to be possible in postgres.... ------------------------------------------------------------------------