ZF-11307: Reset sequence number when truncating table during PHPUnit test -> only for PostgreSQL

Issue Type: Improvement Created: 2011-04-19T13:11:48.000+0000 Last Updated: 2011-04-19T13:28:34.000+0000 Status: Open Fix version(s): Reporter: Dominic Luechinger (dol) Assignee: Ralph Schindler (ralph) Tags: - Zend_Test_PHPUnit

Related issues: Attachments:


During a Zend_Test_PHPUnit_DatabaseTestCase setup phase the tables from getDataSet() will be truncated. If PostgreSQL is the backend, the truncate operation is done by the following command:

'TRUNCATE '.$tableName.' CASCADE' (line 109, Zend_Test_PHPUnit_Db_Operation_Truncate)

PostgreSQL has the possibility to reset the sequence numbers during truncate. This is described in… .

IMHO it makes sense to extend the truncate command for PostgreSQL like this.

$db->query('TRUNCATE '.$tableName.' RESTART IDENTITY CASCADE');

This command resets the sequence number of the primary key.


Posted by Matthew Weier O'Phinney (matthew) on 2011-04-19T13:28:34.000+0000

Assigning to Ralph

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.