Skip Menu |

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

Report information
The Basics
Id: 39622
Status: resolved
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: rsrchboy [...] cpan.org
Cc:
AdminCc:

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



Subject: DB2: unique constraint detection fails
In DBIx::Class::Schema::Loader::DBI::DB2::_table_uniq_info(), we see: q{SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ FROM SYSCAT.TABCONST as tc JOIN SYSCAT.KEYCOLUSE as kcu ON tc.CONSTNAME = kcu.CONSTNAME WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'} However, tc and kcu should be joined using both the table and schema names, along the lines of q{SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ FROM SYSCAT.TABCONST as tc JOIN SYSCAT.KEYCOLUSE as kcu ON tc.CONSTNAME = kcu.CONSTNAME and tc.SCHEMANAME = kcu.SCHEMANAME WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'} Without that, the query will return constraints for the wrong tables if there happens to be a table of the same name in multiple schemas. (marked as critical as this tends to break functionality with DB2)
Subject: Re: [rt.cpan.org #39622] DB2: unique constraint detection fails
Date: Sat, 27 Sep 2008 19:50:20 +0100
To: Chris Weyl via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcat.co.uk>
On Thu, Sep 25, 2008 at 09:56:32PM -0400, Chris Weyl via RT wrote: Show quoted text
> Thu Sep 25 21:56:30 2008: Request 39622 was acted upon. > Transaction: Ticket created by RSRCHBOY > Queue: DBIx-Class-Schema-Loader > Subject: DB2: unique constraint detection fails > Broken in: 0.04005 > Severity: Critical > Owner: Nobody > Requestors: rsrchboy@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=39622 > > > > In DBIx::Class::Schema::Loader::DBI::DB2::_table_uniq_info(), we see: > > q{SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ > FROM SYSCAT.TABCONST as tc > JOIN SYSCAT.KEYCOLUSE as kcu ON tc.CONSTNAME = kcu.CONSTNAME > WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'} > > However, tc and kcu should be joined using both the table and schema > names, along the lines of > > q{SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ > FROM SYSCAT.TABCONST as tc > JOIN SYSCAT.KEYCOLUSE as kcu > ON tc.CONSTNAME = kcu.CONSTNAME and tc.SCHEMANAME = kcu.SCHEMANAME > WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'} > > Without that, the query will return constraints for the wrong tables if > there happens to be a table of the same name in multiple schemas. > > (marked as critical as this tends to break functionality with DB2)
Could we have a patch and tests then please? I don't believe ilmari has a DB2 box handy -- 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/
Subject: Re: [rt.cpan.org #39622] DB2: unique constraint detection fails
Date: Fri, 3 Oct 2008 15:17:29 -0700
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: "Chris Weyl" <rsrchboy [...] cpan.org>
On Sat, Sep 27, 2008 at 11:51 AM, Matt S Trout via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> Could we have a patch and tests then please? I don't believe ilmari has > a DB2 box handy
Unfortunately, as this is something I'm working through for my Real Job, I have to take any "code" contributions through both management, and Legal for an OK. The I can vouch the above snippet of SQL works, but I can't supply either a patch or tests until I get the OK. -Chris -- Chris Weyl Ex astris, scientia
Fixed in git://git.shadowcat.co.uk/dbsrgits/DBIx-Class-Schema-Loader.git . Used the join condition: tc.TABSCHEMA = kcu.TABSCHEMA rather than: tc.SCHEMANAME = kcu.SCHEMANAME as there doesn't seem to be a SCHEMANAME column. Will be released soon.