http://www.perlmonks.org?node_id=969425

kiz has asked for the wisdom of the Perl Monks concerning the following question:

Environment - Perl: Ububtu 12.04; Perl 5.14.2; all packages installed via .debs. Database: postgres database on a Sun server.

I am using dbicdump to create a pile of DBIx::Class packages to access a database... and a few of tables are not coming through cleanly.

For example - If I query my database through psql, I get:

oarj3=> select column_name,data_type from information_schema.columns w +here table_name like 'urls'; column_name | data_type -----------------+------------------- date_checked | date http_code | integer base_uri | text host_alive | boolean last_check_good | boolean count_fails | integer count_success | integer pri | boolean url | text table_id | integer tbl | character varying id | integer (12 rows)

When I run the following dbicddump command

dbicdump -o dump_directory=./lib/perl -o debug=1 EDINA::ORI dbi:Pg:dbname=oarj3;host=[host];port=[port] [username] [password]

I get the following extract in Url.pm:

__PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0, sequence => "urls_id_seq", }, "table", { accessor => undef, data_type => "varchar", is_nullable => 0, size +=> 20 }, "table_id", { data_type => "integer", is_nullable => 0 }, "url", { data_type => "text", is_nullable => 0 }, "primary", { data_type => "boolean", default_value => \"false", is_nullable => +0 }, );

First off.... the column "tbl" has become "table", and unaccessable - which is a bit of a problem, but easily solvable.

However the bigger problem is that I'm missing 7 columns!

The interesting part is that this is happening to my 'urls' table (12 rows), my 'name' table (drops the final "pri" column), and my 'org' table (8 rows: drops 6!), but not my 'repo' table (15 columns) or my 'sword' table (6 columns)

I've looked at the debug output, and it doesn't seem to be listing the columns:

EDINA::ORI::Result::Url->table("urls"); Column 'table' in table 'urls' collides with an inherited method. See "COLUMN ACCESSOR COLLISIONS" in perldoc DBIx::Class::Schema::Loade +r::Base . EDINA::ORI::Result::Url->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0, sequence => "urls_id_seq", }, "table", { accessor => undef, data_type => "varchar", is_nullable => 0, size +=> 20 }, "table_id", { data_type => "integer", is_nullable => 0 }, "url", { data_type => "text", is_nullable => 0 }, "primary", { data_type => "boolean", default_value => \"false", is_nullable => +0 }, ); DBIx::Class::Schema::Loader::make_schema_at(): urls has no primary key + at /usr/local/bin/dbicdump line 178

Just to add confusion here - I've another database (same name) on a different postgres server (different port), and I know it's not being referenced as it has different fields in its tables, and they're not being imported.

I've looked and looked, rerun and compared, and even spoken to a teddybear.... Other than hand-coding the missing data into the records, is there something I've missed?

Is there an obvious reason the data is not being build correctly?



-- Ian Stuart
A man depriving some poor village, somewhere, of a first-class idiot.