Hi, 

Today, we ran across an issue with DBIC in postgres related to 
DBIx::Class::Storage::DBI::Pg. We needed to add a "timestamp with timezone" 
(which defaulted to "postgres now()") to an existing primary key in a table. 
The add went ok and the schema was updated in DBIx Class. 

When we attempted to add rows, where we explicitly specified the new timestamp 
field, all went well. 

When we attempted to create a row without specifying the timestamp primary key 
(since it defaulted), last_insert_id threw an error. 

From what we can tell as it currently stands, we cannot default primary keys to 
now() successfully. We are working around this by simply feeding in the current 
time when we call the insert, but would like to leverage a default on this 
primary key. 

Can anyone recommend how we can fix the schema so it behaves properly or do we 
have a bug? 

Thanks,

Error stack below:

# could not fetch primary key for app_environment_passwords, could not get 
autoinc sequence for date_active (check that table and column specifications 
are correct and in the correct case) at 
/opt/perl588/site/lib/DBIx/Class/Schema.pm line 954
#       
DBIx::Class::Schema::throw_exception('GASS::Schema::GASSdb=HASH(0x1e5cb70)', 
'could not fetch primary key for app_environment_passwords, co...') called at 
/opt/perl588/site/lib/DBIx/Class/Storage.pm line 122
#       
DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::Pg=HASH(0x1d12700)',
 'could not fetch primary key for app_environment_passwords, co...') called at 
/opt/perl588/site/lib/DBIx/Class/Storage/DBI/Pg.pm line 24
#       
DBIx::Class::Storage::DBI::Pg::last_insert_id('DBIx::Class::Storage::DBI::Pg=HASH(0x1d12700)',
 'DBIx::Class::ResultSource::Table=HASH(0x2190d90)', 'date_active') called at 
/opt/perl588/site/lib/DBIx/Class/Row.pm line 222
#       
DBIx::Class::Row::insert('GASS::Model::Access::AppEnvironmentPasswords=HASH(0x25eb090)')
 called at /opt/perl588/site/lib/DBIx/Class/Row.pm line 243
#       
DBIx::Class::Row::insert('GASS::Model::Access::AppEnvironments=HASH(0x2491e90)')
 called at /opt/perl588/site/lib/DBIx/Class/ResultSet.pm line 1638
#       
DBIx::Class::ResultSet::create('DBIx::Class::ResultSet=HASH(0x25dfda0)', 
'HASH(0x25eb590)') called at /home/e140995/GASS/t/model/lib/ModelTester.pm line 
71
....
Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to