env var
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Manual / Troubleshooting.pod
1 =head1 NAME
2
3 DBIx::Class::Manual::Troubleshooting - Got a problem? Shoot it.
4
5 =head2  "Can't locate storage blabla"
6
7 You're trying to make a query on a non-connected schema. Make sure you got
8 the current resultset from $schema->resultset('Artist') on a schema object
9 you got back from connect().
10
11 =head2 Tracing SQL
12
13 The C<DBIC_TRACE> environment variable controls
14 SQL tracing, so to see what is happening try
15
16   export DBIC_TRACE=1
17
18 Alternatively use the C<< storage->debug >> class method:-
19
20   $class->storage->debug(1);
21
22 To send the output somewhere else set debugfh:-
23
24   $class->storage->debugfh(IO::File->new('/tmp/trace.out', 'w');
25
26 Alternatively you can do this with the environment variable too:-
27
28   export DBIC_TRACE="1=/tmp/trace.out"
29
30 =head2 Can't locate method result_source_instance
31
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 =head2 Can't get last insert ID under Postgres with serial primary keys
37
38 Older L<DBI> and L<DBD::Pg> versions do not handle C<last_insert_id>
39 correctly, causing code that uses auto-incrementing primary key
40 columns to fail with a message such as:
41
42   Can't get last insert id at /.../DBIx/Class/Row.pm line 95
43
44 In particular the RHEL 4 and FC3 Linux distributions both ship with
45 combinations of L<DBI> and L<DBD::Pg> modules that do not work
46 correctly.
47
48 L<DBI> version 1.50 and L<DBD::Pg> 1.43 are known to work.
49
50 =cut
51