Skip Menu |

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

Report information
The Basics
Id: 77723
Status: rejected
Priority: 0/
Queue: DBIx-Admin-TableInfo

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: primary key columns where the column name contains a space are incorrectly reported
Test case attached. Not sure if this is database-specific, or what. I'm using SQLite 3.6.23.1.
Subject: sqlite-thing.pl
use 5.010; use strict; use Data::Dumper; use DBI; use DBIx::Admin::TableInfo; use Test::More tests => 3; my $db = DBI->connect('dbi:SQLite:database=:memory:') or die $DBI::errstr; $db->do($_) for q[CREATE TABLE "Country Info" ("Country Code" CHAR(2) PRIMARY KEY, "Name" VARCHAR(200))], q[INSERT INTO "Country Info" VALUES ('DE', 'Germany')], q[INSERT INTO "Country Info" VALUES ('FR', 'France')]; my $info = DBIx::Admin::TableInfo->new(dbh => $db)->info; my @key = values %{$info->{'Country Info'}{primary_keys}}; is( $info->{'Country Info'}{columns}{'Country Code'}{COLUMN_NAME}, 'Country Code', 'In "columns" data, column name is reported correctly.', ); is( scalar(@key), 1, 'The primary key column was found.', ); is( $key[0]->{COLUMN_NAME}, 'Country Code', 'The primary key column name is reported correctly.', );
Hmmm... digging further, this may be a DBD::SQLite bug I'm seeing.
On 2012-06-08T23:51:18+01:00, TOBYINK wrote: Show quoted text
> Hmmm... digging further, this may be a DBD::SQLite bug I'm seeing.
Oh yes; it totally is! @pk = (split /\s+/, $prefix)[0]; # take first word as name
Subject: Re: [rt.cpan.org #77723] primary key columns where the column name contains a space are incorrectly reported
Date: Sat, 09 Jun 2012 09:51:39 +1000
To: bug-DBIx-Admin-TableInfo [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
On 09/06/12 08:55, Toby Inkster via RT wrote: Show quoted text
> Queue: DBIx-Admin-TableInfo > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77723> > > On 2012-06-08T23:51:18+01:00, TOBYINK wrote:
>> Hmmm... digging further, this may be a DBD::SQLite bug I'm seeing.
> > Oh yes; it totally is! > > @pk = (split /\s+/, $prefix)[0]; # take first word as name
Phew! Thanx for investigating. I'll let you report it :-). -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Subject: Re: [rt.cpan.org #77723] primary key columns where the column name contains a space are incorrectly reported
Date: Sat, 09 Jun 2012 09:53:24 +1000
To: bug-DBIx-Admin-TableInfo [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Toby On 09/06/12 08:55, Toby Inkster via RT wrote: Show quoted text
> Queue: DBIx-Admin-TableInfo > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77723> > > On 2012-06-08T23:51:18+01:00, TOBYINK wrote:
>> Hmmm... digging further, this may be a DBD::SQLite bug I'm seeing.
> > Oh yes; it totally is! > > @pk = (split /\s+/, $prefix)[0]; # take first word as name
Actually, the comment suggests the author realized what they were doing. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
On 2012-06-09T00:57:59+01:00, ron@savage.net.au wrote: Show quoted text
> Actually, the comment suggests the author realized what they were
doing. Reported it as: https://rt.cpan.org/Ticket/Display.html?id=77724 My reading of the comment is that the author is using regexps to pull the primary key out of things like this: serial_number int And takes the first word... q(serial_number). However, this fails when it hits a table that has a primary key like this: "Serial Number" int Because the first work is... q("Serial);
Subject: Re: [rt.cpan.org #77723] primary key columns where the column name contains a space are incorrectly reported
Date: Mon, 11 Jun 2012 09:51:54 +1000
To: bug-DBIx-Admin-TableInfo [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Toby On 11/06/12 07:38, Toby Inkster via RT wrote: Show quoted text
> Queue: DBIx-Admin-TableInfo > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77723> > > On 2012-06-09T00:57:59+01:00, ron@savage.net.au wrote:
>> Actually, the comment suggests the author realized what they were
> doing. > > Reported it as: > https://rt.cpan.org/Ticket/Display.html?id=77724 > > My reading of the comment is that the author is using regexps to pull > the primary key out of things like this: > > serial_number int > > And takes the first word... q(serial_number). > > However, this fails when it hits a table that has a primary key like > this: > > "Serial Number" int > > Because the first work is... q("Serial);
I understand, but after having another look at the code I still think the author's comment was an admission they knew the logic adopted was as a last resort and that they knew it was a dubious assumption. I see you reported it as a but against DBD::SQLite. That's good. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Hi Tony I'm classifying this as Rejected, i.e. not a bug. Cheers Ron