2010-11-21 1 views
1

PostgreSQL 9.0에 데이터베이스가 있고 db에서 모델을 생성하기 위해 Doctrine ORM 1.2를 사용하려고합니다. 여기 Doctrine 및 Postgresql, DB에서 모델 생성 문제

내 코드입니다 :

<?php 
require_once 'Doctrine.php'; 
spl_autoload_register(array('Doctrine', 'autoload')); 
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload')); 
$manager = Doctrine_Manager::getInstance(); 
$conn = Doctrine_Manager::connection('pgsql://postgres:[email protected]/erp','doctrine'); 
$conn->setAttribute(Doctrine_Core::ATTR_PORTABILITY, Doctrine_Core::PORTABILITY_FIX_CASE | PORTABILITY_RTM); 
$conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true); 
$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true); 
Doctrine_Core::loadModels('../application/models'); 
Doctrine_Core::generateModelsFromDb('../application/models', array('doctrine'), array('generateTableClasses' => true)); 
?> 

내가 페이지를 실행하면이 오류를 얻을 :

Fatal error: Uncaught exception 'Doctrine_Connection_Pgsql_Exception' with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Query: "SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype AS typtype, is_nullable as isnotnull, column_default as default, (SELECT 't' in D:\Doctrine-1.2.3\Doctrine-1.2.3\Doctrine\Connection.php on line 1082 

말할 가치,이 코드함으로써 (MySQL은 완벽하게 작동하고 mysql : // ... of the connection of ofcurse), postgresql 9.0에서 작동하도록하는 데 문제가 있습니다.

아이디어가 있으십니까?

답변

1

교리에서이 벌레처럼 소리 : http://www.doctrine-project.org/jira/browse/DC-919

+0

원본 파일에 오타가있었습니다. 그리고 나는 SVN에서 소스를 다운로드하고 여전히 오타가 존재한다는 것에 놀랐다. 나는 나 자신을 제거했다! 어쨌든 – Pooria

0

시도는 테이블 이름 또는 열 이름에 따옴표를 추가 할 수 있습니다.

표를 내보내는 동안 올바른 이름을 찾습니다.

내 문제는 누군가가 테이블 이름에 따옴표를 추가했다는 것이 었습니다.

$sql='SELECT "id","name", 
    ("f1"=\'aaa\' OR 
    "f1"=\'bbb\') AS "myflag" 
    FROM "mytable"';