Sean McAfee wrote:
I have a table that doesn't have a primary key, but does a unique index. When I call update_or_create on this table, I can create the row just fine, but when I try to update it with a second call, this exception gets thrown:

Cannot safely update a row in a PK-less table

But the documentation for DBIx::Class::ResultSet explicitly says that the method can use unique constraints. So why isn't it?

Does your table have multiple unique constraints or just one?

From my quick reading, the ResultSet documentation appears to be saying you need to provide an explicit 'key' attribute value when a match is being done on a non-primary key (aka unique constraint), rather than it figuring things out for itself if you have exactly 1 unique constraint. Have you set 'key' explicitly?

-- Darren Duncan

_______________________________________________
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.scsys.co.uk

Reply via email to