Skip to content


Subversion checkout URL

You can clone with
Download ZIP


fix column names in versionable with Postgres #693

wants to merge 1 commit into from

3 participants


When using Postgres, the versionable behavior produces invalid column names for the *_ids and *_versions columns, because the foreign table name it uses as a prefix includes the Postgres schema name and a dot. This pull request uses getCommonName() instead of getName() for the table name when generating the column names, thus leaving off the schema prefix.

This replaces the pull request submitted a while back as #498.


could you add a testcase which fails without your patch?


well yeah, a test case would be nice.


ping @kcivey


Sorry, I haven't had time to figure out the testing yet. It looks like the Versionable tests all use a SQLite database, but I guess I can stick a Versionable test into the Postgres testing.

@crzdeveloper crzdeveloper referenced this pull request from a commit in crzdeveloper/propel-versionable
@crzdeveloper crzdeveloper Fix from issue propelorm/Propel#693 65694eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2013
  1. @kcivey

    fix invalid id and version column names (with schema prefix) generate…

    kcivey authored
    …d from Versionable with Postgres
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 generator/lib/behavior/versionable/VersionableBehavior.php
6 generator/lib/behavior/versionable/VersionableBehavior.php
@@ -165,7 +165,7 @@ public function addForeignKeyVersionColumns()
foreach ($this->getVersionableReferrers() as $fk) {
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$columns = array(
@@ -236,7 +236,7 @@ public function getVersionableReferrers()
public function getReferrerIdsColumn(ForeignKey $fk)
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$fkColumnName = $fkTableName . '_id';
@@ -249,7 +249,7 @@ public function getReferrerIdsColumn(ForeignKey $fk)
public function getReferrerVersionsColumn(ForeignKey $fk)
- $fkTableName = $fk->getTable()->getName();
+ $fkTableName = $fk->getTable()->getCommonName();
if ($fk->isLocalPrimaryKey()) {
$fkColumnName = $fkTableName . '_version';
Something went wrong with that request. Please try again.