NYCPHP Meetup

NYPHP.org

[nycphp-talk] PEAR::DB->nextID problems

Mitch Pirtle mitchy at spacemonkeylabs.com
Tue Aug 3 09:34:16 EDT 2004


Daniel Convissor wrote:

>Before I get into testing things out, did you create the sequence 
>manually somewhere else using createSequence()?  If so, are you using 
>the same exact name, including your unnecessarily appending "_seq" to 
>the name as you are here:
>
>  
>
>>       $id = $this->db->nextId( 'content_archives_id_seq' );
>>    
>>

The sequence was created automagically by PostgreSQL at table creation 
time, thanks to the SERIAL column type.  I used PGAdminIII to get the 
exact name of the sequence, which is content_archives_id_seq.

>Similarly, do all calls to nextID() use the same exact name?  You see, 
>"_seq" is automatically appended to any name you pass to any of the 
>sequence methods.  So, if you call it with "_seq" the name will be 
>"_seq_seq".
>  
>

So are you saying that nextID() appends the string "_seq" to the 
sequence name?

>If neither of those situations are the problem, please be so kind as 
>to send along a self contained test script that both creates and drops 
>the test table plus passes values into the query.
>  
>

Okay, first will experiment with the sequence names and check that 
things are on the up and up.  If after that I still have trouble I'll 
write something up that you can see.

-- Mitch



More information about the talk mailing list