propelorm / Propel

Current stable (and outdated and unmaintained) version of Propel - Please use v2 https://github.com/propelorm/Propel2 --
http://www.propelorm.org
MIT License
841 stars 418 forks source link

[PgsqlPlatform] error generated select nextval() query #122

Closed nibsirahsieu closed 12 years ago

nibsirahsieu commented 12 years ago

i found another issue, propel generate $stmt = $con->query('SELECT nextval(edelivery.application_user_id_seq)'); (in the doInsert() function)

SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "edelivery" LINE 1: SELECT nextval(edelivery.application_user_id_seq)

Expected : $stmt = $con->query("SELECT nextval('edelivery.application_user_id_seq')");

Quick fix:


$snippet = "
\$stmt = %s->query(\"SELECT nextval(%s)\");
\$row = \$stmt->fetch(PDO::FETCH_NUM);
%s = \$row[0];";
        $script = sprintf($snippet,
            $connectionVariableName,
            $this->quote($sequenceName),
            $columnValueMutator
        );
fzaninotto commented 12 years ago

See https://github.com/propelorm/Propel/pull/123 for a fix

nibsirahsieu commented 12 years ago

ok :). Thanks

nibsirahsieu commented 12 years ago

Great.. it work.. thank francoiz

nibsirahsieu commented 12 years ago

Should i close this issue?

fzaninotto commented 12 years ago

no, it's not in master yet

willdurand commented 12 years ago

Merged.