Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 51653
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: icestar [...] inbox.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08114
Fixed in: 0.08121



Subject: DBIx::Class::Row delete method bug or feature for SQLite database
Download (untitled) / with headers
text/plain 624b
Hello! Maybe I am wrong but in my opinion this is a bug. Below is a case description for SQLite database. I have a parent table with has_many relationship to child table. In parent table primary key is ID. In child table there isn't primary key, only foreign key ParentID to parent table. When I try to delete row from parent table I get exception "Cannot safely delete a row in a PK- less table". For mysql everything is OK. If I add primary key to child table the problem will gone for SQLite as well. Maybe there is a restriction somewhere in documentation that I have to create primary key, but I haven't found it.
Download (untitled) / with headers
text/plain 954b
On Wed Nov 18 09:21:11 2009, Alien wrote: Show quoted text
> Hello! > Maybe I am wrong but in my opinion this is a bug. > Below is a case description for SQLite database. > I have a parent table with has_many relationship to child table. In > parent table primary key is ID. In child table there isn't primary key, > only foreign key ParentID to parent table. When I try to delete row > from parent table I get exception "Cannot safely delete a row in a PK- > less table". For mysql everything is OK. If I add primary key to child > table the problem will gone for SQLite as well. Maybe there is a > restriction somewhere in documentation that I have to create primary > key, but I haven't found it.
A lot (and I really mean it) of advanced DBIC functions do not work without a clearly defined set of primary columns (and deletion from a joined resultset is pretty advanced). Please suggest places in the documentation where we should add this bit of information.
From: icestar [...] inbox.ru
Download (untitled) / with headers
text/plain 601b
On Thu Nov 19 05:01:17 2009, RIBASUSHI wrote: Show quoted text
> > A lot (and I really mean it) of advanced DBIC functions do not work > without a clearly defined set of primary columns (and deletion from a > joined resultset is pretty advanced). Please suggest places in the > documentation where we should add this bit of information.
Thanks for your reply. I think the best place for this note is a description of <delete> method of DBIx::Class::Row class, where you are writing: "If you delete an object in a class with a has_many relationship, an attempt is made to delete all the related objects as well."
Download (untitled) / with headers
text/plain 816b
On Thu Nov 19 14:57:21 2009, Alien wrote: Show quoted text
> On Thu Nov 19 05:01:17 2009, RIBASUSHI wrote:
> > > > A lot (and I really mean it) of advanced DBIC functions do not work > > without a clearly defined set of primary columns (and deletion from a > > joined resultset is pretty advanced). Please suggest places in the > > documentation where we should add this bit of information.
> > > Thanks for your reply. I think the best place for this note is a > description of <delete> method of DBIx::Class::Row class, where you are > writing: "If you delete an object in a class with a has_many > relationship, an attempt is made to delete all the related objects as > well."
Documentation patched: http://dev.catalystframework.org/svnweb/bast/revision?rev=8903#diff__DBIx-Class_0.08_trunk_lib_DBIx_Class_Manual_Intro.pod
DBIC 0.08121 shipped containing a fix for this bug.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.