[Dbix-class] Issues with postgres timestamp in a primary key

todd.e.rinaldo at jpmorgan.com todd.e.rinaldo at jpmorgan.com
Tue Jul 22 09:00:18 BST 2008


Nope. We had to add date to assure uniqueness.... We're doing a funky
expire the row by making a newer one thing so we have access to
historical. Is this the right forum for this? From what I can tell,
DBIx::Class::Storage::DBI::Pg is part of core DBIC right?

-----Original Message-----
From: dbix-class at trout.me.uk [mailto:dbix-class at trout.me.uk] 
Sent: Monday, July 21, 2008 4:46 PM
To: DBIx::Class user and developer list
Subject: Re: [Dbix-class] Issues with postgres timestamp in a primary key


On Mon, Jul 21, 2008 at 03:58:26PM -0500, todd.e.rinaldo at jpmorgan.com
wrote:
> 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. 

Hmm ... is the rest of the PK sufficiently unique? If it is, I'd just not
tell DBIC that the timestamp column is part of the PK.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class
project?
   Technical Director
http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment
platform?
http://chainsawblues.vox.com/
http://www.shadowcat.co.uk/servers/

_______________________________________________
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/dbix-class@lists.rawmode.org
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.



More information about the DBIx-Class mailing list