[Dbix-class] Probleme with nextval() and postgresql 7.4.17

Matt S Trout dbix-class at trout.me.uk
Tue Oct 7 18:25:37 BST 2008


On Tue, Oct 07, 2008 at 10:54:30AM +0200, Ludovic Legrand wrote:
> hi,
> I want to select the nextval of the sequence 'seq_id_comparison' of the
> table 'Comparison' with this line:
> 
> $dbh->resultset('Comparison')->search(undef, {
>       select => "nextval('seq_id_comparison')",
>       as => 'id_comp',
>       })->single->get_column('id_comp');
> SQL equivalent:
> SELECT NEXTVAL('seq_id_comparison');
> 
> The SQL statement gives last_value + 1, that's ok, while the DBIx
> request gives something like last_value + 500 ...
> How to explain this increment ?

DBIC_TRACE=1 perl myscript.pl

and see what queries you're running.

Also please note it's DBIx::Class or DBIC, DBIx:: contains lots of other
projects.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list