1DBIx::Class::Manual::TrUosuebrleCsohnotortiibnugt(e3d)PDeBrIlx:D:oCcluamsesn:t:aMtainounal::Troubleshooting(3)
2
3
4
6 DBIx::Class::Manual::Troubleshooting - Got a problem? Shoot it.
7
8 "Can't locate storage blabla"
9 You're trying to make a query on a non-connected schema. Make sure you
10 got the current resultset from $schema->resultset('Artist') on a schema
11 object you got back from connect().
12
13 Tracing SQL
14 The "DBIC_TRACE" environment variable controls SQL tracing, so to see
15 what is happening try
16
17 export DBIC_TRACE=1
18
19 Alternatively use the "storage->debug" class method:-
20
21 $schema->storage->debug(1);
22
23 To send the output somewhere else set debugfh:-
24
25 $schema->storage->debugfh(IO::File->new('/tmp/trace.out', 'w'));
26
27 Alternatively you can do this with the environment variable, too:-
28
29 export DBIC_TRACE="1=/tmp/trace.out"
30
31 Can't locate method result_source_instance
32 For some reason the table class in question didn't load fully, so the
33 ResultSource object for it hasn't been created. Debug this class in
34 isolation, then try loading the full schema again.
35
36 Can't get last insert ID under Postgres with serial primary keys
37 Older DBI and DBD::Pg versions do not handle "last_insert_id"
38 correctly, causing code that uses auto-incrementing primary key columns
39 to fail with a message such as:
40
41 Can't get last insert id at /.../DBIx/Class/Row.pm line 95
42
43 In particular the RHEL 4 and FC3 Linux distributions both ship with
44 combinations of DBI and DBD::Pg modules that do not work correctly.
45
46 DBI version 1.50 and DBD::Pg 1.43 are known to work.
47
48 Can't locate object method "source_name" via package
49 There's likely a syntax error in the table class referred to elsewhere
50 in this error message. In particular make sure that the package
51 declaration is correct. For example, for a schema " MySchema " you need
52 to specify a fully qualified namespace: " package MySchema::MyTable; ".
53
54 syntax error at or near "<something>" ...
55 This can happen if you have a relation whose name is a word reserved by
56 your database, e.g. "user":
57
58 package My::Schema::User;
59 ...
60 __PACKAGE__->table('users');
61 __PACKAGE__->add_columns(qw/ id name /);
62 __PACKAGE__->set_primary_key('id');
63 ...
64 1;
65
66 package My::Schema::ACL;
67 ...
68 __PACKAGE__->table('acl');
69 __PACKAGE__->add_columns(qw/ user_id /);
70 __PACKAGE__->belongs_to( 'user' => 'My::Schema::User', 'user_id' );
71 ...
72 1;
73
74 $schema->resultset('ACL')->search(
75 {},
76 {
77 join => [qw/ user /],
78 '+select' => [ 'user.name' ]
79 }
80 );
81
82 The SQL generated would resemble something like:
83
84 SELECT me.user_id, user.name FROM acl me
85 JOIN users user ON me.user_id = user.id
86
87 If, as is likely, your database treats "user" as a reserved word, you'd
88 end up with the following errors:
89
90 1) syntax error at or near "." - due to "user.name" in the SELECT
91 clause
92
93 2) syntax error at or near "user" - due to "user" in the JOIN clause
94
95 The solution is to enable quoting - see "Setting quoting for the
96 generated SQL" in DBIx::Class::Manual::Cookbook for details.
97
98 column "foo DESC" does not exist ...
99 This can happen if you are still using the obsolete order hack, and
100 also happen to turn on SQL-quoting.
101
102 $rs->search( {}, { order_by => [ 'name DESC' ] } );
103
104 The above should be written as:
105
106 $rs->search( {}, { order_by => { -desc => 'name' } } );
107
108 For more ways to express order clauses refer to "ORDER BY CLAUSES" in
109 SQL::Abstract::Classic
110
111 Perl Performance Issues on Red Hat Systems
112 There is a problem with slow performance of certain DBIx::Class
113 operations using the system perl on some Fedora and Red Hat Enterprise
114 Linux system (as well as their derivative distributions such as Centos,
115 White Box and Scientific Linux).
116
117 Distributions affected include Fedora 5 through to Fedora 8 and RHEL5
118 up to and including RHEL5 Update 2. Fedora 9 (which uses perl 5.10) has
119 never been affected - this is purely a perl 5.8.8 issue.
120
121 As of September 2008 the following packages are known to be fixed and
122 so free of this performance issue (this means all Fedora and RHEL5
123 systems with full current updates will not be subject to this
124 problem):-
125
126 Fedora 8 - perl-5.8.8-41.fc8
127 RHEL5 - perl-5.8.8-15.el5_2.1
128
129 This issue is due to perl doing an exhaustive search of blessed objects
130 under certain circumstances. The problem shows up as performance
131 degradation exponential to the number of DBIx::Class result objects in
132 memory, so can be unnoticeable with certain data sets, but with huge
133 performance impacts on other datasets.
134
135 A pair of tests for susceptibility to the issue and performance effects
136 of the bless/overload problem can be found in the DBIx::Class test
137 suite, in the "t/99rh_perl_perf_bug.t" file.
138
139 Further information on this issue can be found in
140 <https://bugzilla.redhat.com/show_bug.cgi?id=379791>,
141 <https://bugzilla.redhat.com/show_bug.cgi?id=460308> and
142 <http://rhn.redhat.com/errata/RHBA-2008-0876.html>
143
144 Excessive Memory Allocation with TEXT/BLOB/etc. Columns and Large
145 LongReadLen
146 It has been observed, using DBD::ODBC, that creating a DBIx::Class::Row
147 object which includes a column of data type TEXT/BLOB/etc. will
148 allocate LongReadLen bytes. This allocation does not leak, but if
149 LongReadLen is large in size, and many such result objects are created,
150 e.g. as the output of a ResultSet query, the memory footprint of the
151 Perl interpreter can grow very large.
152
153 The solution is to use the smallest practical value for LongReadLen.
154
156 Check the list of additional DBIC resources.
157
159 This module is free software copyright by the DBIx::Class (DBIC)
160 authors. You can redistribute it and/or modify it under the same terms
161 as the DBIx::Class library.
162
163
164
165perl v5.32.0 2020-0D7B-I2x8::Class::Manual::Troubleshooting(3)