Skip to content

Loading…

Problem with sequence names, PostgreSQL and MixedCased schemas #232

Merged
merged 1 commit into from

3 participants

@ajgarlag

I''m having problems with a doctrine migration in a pgsql database that has a mixed case schema name.

After some investigation I've found the origin of the problem: when the schema manager is going to list sequences it executes a SQL statement to find the minimun sequence value.

This SQL statement is not quoting the sequence name, so the SQL fails with mixed cased schemas.

This trivial commit resolves this problem. I think it could be backported to stable versions of DBAL.

@doctrinebot

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-389

@guilhermeblanco guilhermeblanco merged commit c125e22 into doctrine:master

1 check passed

Details default The Travis build passed
@ajgarlag

@guilhermeblanco Thank you for merging this pull request.

Do you think that it could be merged to 2.3?
Should I open another pull request for that branch?

@guilhermeblanco
Doctrine member

@ajgarlag no need for that...
@beberlei can you merge it into other branches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2012
  1. @ajgarlag

    Fix the SQL statement to select the sequence minimun value when the s…

    ajgarlag committed
    …chema name is case sensitive
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View
2 lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
@@ -237,7 +237,7 @@ protected function _getPortableSequenceDefinition($sequence)
$sequenceName = $sequence['relname'];
}
- $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $sequenceName);
+ $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
}
Something went wrong with that request. Please try again.