Handle postgres sequences #2863

Closed
wants to merge 7 commits into
from

Conversation

Projects
None yet
4 participants

geelweb commented Oct 30, 2012

Hi,

I added the code in the existing, but empty, file Zend/Db/Adapter/Driver/Pgsql/Feature/SequenceHelper.php + unit tests.

You can find usage examples there https://github.com/geelweb/zf2-db-tests, I tested 3 use cases :

  • sets the sequence name to getLastGeneratedValue()
  • sets the sequence name to the tableGateway with setSequence()
  • use the features MetadataFeature + SequenceHelper to find the sequence name

I am running into this problem, too, and would like to see it fixed.

For my case, I added single quotes around the SELECT NEXTVAL() statement.

Owner

weierophinney commented Jan 29, 2013

IIRC, this may be implemented on the develop branch currently, as sequence support was added for Oracle, which was also found to be suitable for DB2. @ralphschindler can you confirm?

Member

ralphschindler commented Jan 29, 2013

This has been addressed in develop with the addition of the SequenceFeature for Zend\Db\TableGateway\Feature\SequenceFeature
https://github.com/zendframework/zf2/blob/develop/library/Zend/Db/TableGateway/Feature/SequenceFeature.php

I see, but I am using develop. ZF2 + PostgreSQL 9.1, and it doesn't work.

I was going to try to run the unit tests, but I found none for SequenceFeature. Do you mind if I write some?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment