Skip Menu |

This queue is for tickets about the Rose-DBx-Garden-Catalyst CPAN distribution.

Report information
The Basics
Id: 46906
Status: rejected
Priority: 0/
Queue: Rose-DBx-Garden-Catalyst

People
Owner: Nobody in particular
Requestors: cpan [...] bluepolka.net
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.14
Fixed in: (no value)



Subject: Odd SQL logic (bug?) in Rose::DBx::Garden::Catalyst
I'm running the example from the SYNOPSIS of perldoc Rose::DBx::Garden::Catalyst, # create a Catalyst app Show quoted text
> catalyst.pl MyApp
# create a Rose::DBx::Garden::Catalyst script Show quoted text
> cat mk_cat_garden.pl
use Rose::DBx::Garden::Catalyst; use MyDB; # isa Rose::DB my $garden = Rose::DBx::Garden::Catalyst->new( catalyst_prefix => 'MyApp', garden_prefix => 'MyRDBO', db => MyDB->new, tt => 1, # make Template Toolkit files ); $garden->plant('MyApp/lib'); # run your script Show quoted text
> perl mk_cat_garden.pl
# update your MyApp.pm file: __PACKAGE__->setup(); Class::C3::initialize(); # add this line # start your Catalyst dev server Show quoted text
> cd MyApp > perl script/myapp_server.pl
# enjoy the fruits at http://localhost:3000/rdgc For http://localhost:3000/rdgc/sdr/transcript/list, I'm seeing the following error: [error] Couldn't render template "undef error - Could not load MyRDBO::Sdr::Style with key id = '1' - No such MyRDBO::Sdr::Style where default_style = 0 at /usr/local/share/perl/5.8.8/CatalystX/CRUD/Object.pm line 120 " Here's the creation SQL for the relevant tables: CREATE TABLE transcript ( id SERIAL NOT NULL UNIQUE, ... style_id INTEGER NOT NULL, FOREIGN KEY (style_id) REFERENCES style (id), ... PRIMARY KEY (student_id, label) ); CREATE TABLE style ( id SERIAL NOT NULL UNIQUE, name VARCHAR NOT NULL PRIMARY KEY, description VARCHAR NOT NULL UNIQUE, css VARCHAR NOT NULL UNIQUE, default_style BOOLEAN NOT NULL DEFAULT 'FALSE', enabled BOOLEAN NOT NULL DEFAULT 'TRUE', creator_id INTEGER NOT NULL, FOREIGN KEY (creator_id) REFERENCES user_account (id), created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP ); CREATE UNIQUE INDEX style_default_style_uidx ON style(default_style) WHERE default_style = 'TRUE'; Here's the SQL I see in the logs: 2009-06-12 19:19:29.719 MDT [679] ed 127.0.0.1(52142) sdr LOG: execute dbdpg_p674_4: SELECT id, name, description, css, default_style, enabled, creator_id, created FROM style WHERE default_style = $1 2009-06-12 19:19:29.719 MDT [679] ed 127.0.0.1(52142) sdr DETAIL: parameters: $1 = 'f' $ perl -v This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi $ uname -a Linux davy 2.6.24-19-generic #1 SMP Wed Jun 18 14:15:37 UTC 2008 x86_64 GNU/Linux I suspect it's getting confused due to the unique index with the WHERE clause.
This is using a PostgreSQL 8.3 database.
RT formatting sucks, loses everything. Sorry.
Subject: Re: [rt.cpan.org #46906] Odd SQL logic (bug?) in Rose::DBx::Garden::Catalyst
Date: Sat, 13 Jun 2009 22:22:31 -0500
To: bug-Rose-DBx-Garden-Catalyst [...] rt.cpan.org
From: Peter Karman <peter [...] peknet.com>
Ed Loehr via RT wrote on 6/12/09 8:25 PM: Show quoted text
> I suspect it's getting confused due to the unique index with the WHERE > clause. >
I created a test db with that schema, ran RDGC against it and did not get that error. That's too bad; it would have been easier to debug if I had. I suspect it has to do more with how RDBO::Loader is generating your .pm code, and less to do with anything particular in RDGC itself. I've put all my generated code here for your comparison: http://peknet.com/~karpet/rdgc-test.tar.gz my local versions for comparison: $ perl -MRose::DB -e 'print $Rose::DB::VERSION, $/' 0.751 $ perl -MRose::DB::Object -e 'print $Rose::DB::Object::VERSION, $/' 0.781 $ perl -MRose::DBx::Garden::Catalyst -e 'print $Rose::DBx::Garden::Catalyst::VERSION, $/' 0.14 $ perl -MRose::DBx::Garden -e 'print $Rose::DBx::Garden::VERSION, $/' 0.15 -- Peter Karman . http://peknet.com/ . peter@peknet.com
On Sat Jun 13 20:22:51 2009, peter@peknet.com wrote: Show quoted text
> > my local versions for comparison: > > $ perl -MRose::DB -e 'print $Rose::DB::VERSION, $/' > 0.751 > $ perl -MRose::DB::Object -e 'print $Rose::DB::Object::VERSION, $/' > 0.781 > $ perl -MRose::DBx::Garden::Catalyst -e 'print > $Rose::DBx::Garden::Catalyst::VERSION, $/' > 0.14 > $ perl -MRose::DBx::Garden -e 'print $Rose::DBx::Garden::VERSION, $/' > 0.15 >
Thanks for the code, I'll have to dig a little deeper. Looks like the only version diff between us is Rose::DB v0.751 vs v0.752. Here's John Siracusa's changelog, nothing suggestive to me: 0.752 (05.08.2009) - John Siracusa <siracusa@gmail.com> * Added workaround for the lack of getpwuid() on Windows. * SQLite column and table names are not properly unquoted when necessary. (RT 45836) * Indicate that MySQL 5.0.45 and later supports selecting from a subselect.
I'm going to send you a complete schema via email to see if that makes it repeatable. If you wouldn't mind, please don't publish/post the schema.
Subject: Re: [rt.cpan.org #46906] Odd SQL logic (bug?) in Rose::DBx::Garden::Catalyst
Date: Mon, 15 Jun 2009 21:43:05 -0500
To: bug-Rose-DBx-Garden-Catalyst [...] rt.cpan.org
From: Peter Karman <peter [...] peknet.com>
Ed Loehr via RT wrote on 6/15/09 7:41 PM: Show quoted text
> Queue: Rose-DBx-Garden-Catalyst > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=46906 > > > I'm going to send you a complete schema via email to see if that makes > it repeatable. If you wouldn't mind, please don't publish/post the schema.
Thanks to the excellent test case, I've found that it is a problem with RDBO generating '0' instead of 'f' and '1' instead of 't' for loading via boolean unique values. It's a real edge case, but not caused by RDGC. I'm closing this ticket, and referring you to RDBO instead. -- Peter Karman . http://peknet.com/ . peter@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9