Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-23-2007, 09:26 PM
Junior Member
 
Join Date: Aug 2007
Posts: 1
Default Postgresql insert in schema.table with schema.sequence. Bug?

I have a table using schema - cd (i don't use public scheme):
Code:
CREATE TABLE cd.album ( 
    id    	int4 NOT NULL DEFAULT nextval('cd.album_id_seq'::regclass),
    artist	varchar(100) NULL,
    title 	varchar(100) NULL,
    PRIMARY KEY(id)
)
as you see I have a siquence cd.album_id_seq using it for autoincrementing primary key id in the same schema as well.

In ZF Model I create class:
PHP Code:
<?php
class Album extends Zend_Db_Table
{
    protected 
$_name 'cd.album';
    protected 
$_sequence 'cd.album_id_seq';    
}
When I try to insert record:
PHP Code:
$data = array(
  
'artist' => $artist,
  
'title' => $title,
  );
$album = new Album();
$album->insert($data); 
it's error had place:
Apache Log:
Code:
[Fri Aug 24 00:50:58 2007] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR:  \xd0\xbe\xd1\x82\xd0\xbd\xd0\xbe\xd1\x88\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5 "album" \xd0\xbd\xd0\xb5 \xd1\x81\xd1\x83\xd1\x89\xd0\xb5\xd1\x81\xd1\x82\xd0\xb2\xd1\x83\xd0\xb5\xd1\x82' in /var/www/html/library/Zend/Db/Statement/Pdo.php:227\nStack trace:\n#0 /var/www/html/library/Zend/Db/Statement.php(298): Zend_Db_Statement_Pdo->_execute(Array)\n#1 /var/www/html/library/Zend/Db/Adapter/Abstract.php(279): Zend_Db_Statement->execute(Array)\n#2 /var/www/html/library/Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query('INSERT INTO "al...', Array)\n#3 /var/www/html/library/Zend/Db/Adapter/Abstract.php(357): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO "al...', Array)\n#4 /var/www/html/library/Zend/Db/Table/Abstract.php(765): Zend_Db_Adapter_Abstract->insert('album', Array)\n#5 /var/www/html/application/controllers/IndexController.php(32): Zend_Db_Table_Abstract->insert(Array)\n#6 /var/www/html/library/Zend/Controller/Action.php(497): IndexController->addAction()\n#7 /var/www/html/library/Zend/Controller/Dispatcher/Standard. in /var/www/html/library/Zend/Db/Statement/Pdo.php on line 227, referer: http://127.0.0.1/index/add
Is it bug, or I do somthing wrong?

PS: I was try to define _schema="cd" result was the same. Select work fine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:53 AM.