Hi,
    I'm developing an app using cat and dbic, with postgresql 8.1.
I've got a table with a "unique" column.

When I try to insert a record that violates that constraint (the code is executed via txn_do($coderef)), I obviously get an exception from DBIC.

The problem is that if I run myapp_server without the -d flag, the exception string is correct; but if I run it _with_ the -d flag istead, the error gets cleared by a SELECT(*) COUNT executed with apparently no reason after the failing INSERT() query. Therefore the error string I get is something like "command ignored until end of transaction block."

The connection options include AutoCommit=1.

The two attachments include the log output of myapp_server.pl for exactly the same http POST request, with and without the -d flag respectively.

Thanks in advance for any help.

--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
[EMAIL PROTECTED] ~/perl/LettereAttivazione $ DBI_TRACE=1 perl -Mlib=lib 
script/lettereattivazione_server.pl
    DBI 1.58-nothread default trace level set to 0x0/1 (pid 7375) at DBI.pm 
line 271 via DBI.pm line 8
You can connect to your server at http://serverlinux:3000
    -> DBI->connect(dbi:Pg:database=LettereAttivazione, la, ****, 
HASH(0x90767ec))
    -> DBI->install_driver(Pg) for linux perl=5.008008 pid=7375 ruid=1010 
euid=1010
       install_driver: DBD::Pg version 1.49 loaded from 
/usr/lib/perl5/site_perl/5.8.8/i686-linux/DBD/Pg.pm
    <- install_driver= DBI::dr=HASH(0x907e870)
    !! warn: 0 CLEARED by call to connect method
    <- connect('database=LettereAttivazione' 'la' ...)= DBI::db=HASH(0x90e9cf0) 
at DBI.pm line 633
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 685
    <- STORE('PrintError' 1)= 1 at DBI.pm line 685
    <- STORE('AutoCommit' 1)= 1 at DBI.pm line 685
    <- STORE('Username' 'la')= 1 at DBI.pm line 688
    <> FETCH('Username')= 'la' ('Username' from cache) at DBI.pm line 688
    <- connected('dbi:Pg:database=LettereAttivazione' 'la' ...)= undef at 
DBI.pm line 694
    <- connect= DBI::db=HASH(0x90e9cf0)
    <- STORE('dbi_connect_closure' CODE(0x90e9864))= 1 at DBI.pm line 703
    <- STORE('HandleError' CODE(0x90e9f00))= 1 at DBI.pm line 782
    <- STORE('ShowErrorStatement' 1)= 1 at DBI.pm line 783
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 784
    <- STORE('PrintError' 0)= 1 at DBI.pm line 785
    <- FETCH('AutoCommit')= 1 at Grouped.pm line 270
    <- FETCH('Driver')= DBI::dr=HASH(0x907e870) at DBI.pm line 738
    <> FETCH('Name')= 'Pg' ('Name' from cache) at DBI.pm line 738
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- begin_work= 1 at DBI.pm line 809
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- FETCH('Driver')= DBI::dr=HASH(0x907e870) at DBI.pm line 66
    <> FETCH('Name')= 'Pg' ('Name' from cache) at DBI.pm line 66
    <- FETCH('Driver')= DBI::dr=HASH(0x907e870) at Limit.pm line 301
    <> FETCH('Name')= 'Pg' ('Name' from cache) at Limit.pm line 301
    <- FETCH('Driver')= DBI::dr=HASH(0x907e870) at Limit.pm line 338
    <> FETCH('Name')= 'Pg' ('Name' from cache) at Limit.pm line 338
    <- prepare_cached('INSERT INTO accordi_quadro (codice, data, descrizione, 
importo_totale, perc_otto) VALUES (?, ?, ?, ?, ?)' HASH(0x90f8df4) ...)= 
DBI::st=HASH(0x90f8e78) at DBI.pm line 1116
    <- bind_param(1 '3' ...)= 1 at DBI.pm line 932
    <- bind_param(2 '2007-01-01' ...)= 1 at DBI.pm line 932
    <- bind_param(3 'description' ...)= 1 at DBI.pm line 932
    <- bind_param(4 100 ...)= 1 at DBI.pm line 932
    <- bind_param(5 65 ...)= 1 at DBI.pm line 932
    !! ERROR: 7 'ERROR:  una chiave duplicata viola il vincolo 
"accordi_quadro_codice_key"
' (err#0)
    <- execute= undef at DBI.pm line 938
    -> HandleError on DBI::st=HASH(0x90f8e3c) via CODE(0x90e9f00) (undef)
       ERROR: 7 'ERROR:  una chiave duplicata viola il vincolo 
"accordi_quadro_codice_key"
' (err#0)
    <- FETCH('Active')= 1 at DBI.pm line 673
       ERROR: 7 'ERROR:  una chiave duplicata viola il vincolo 
"accordi_quadro_codice_key"
' (err#0)
    <- ping= 4 at DBI.pm line 673
    !! ERROR: 7 CLEARED by call to rollback method
    <- rollback= 1 at DBI.pm line 838
[EMAIL PROTECTED] ~/perl/LettereAttivazione $ DBI_TRACE=1 perl -Mlib=lib 
script/lettereattivazione_server.pl -d
    DBI 1.58-nothread default trace level set to 0x0/1 (pid 7372) at DBI.pm 
line 271 via DBI.pm line 8
[debug] Debug messages enabled
[debug] Loaded plugins:
.----------------------------------------------------------------------------.
| Catalyst::Plugin::ConfigLoader  0.14                                       |
| Catalyst::Plugin::FormValidator  0.02                                      |
| Catalyst::Plugin::StackTrace  0.06                                         |
| Catalyst::Plugin::Static::Simple  0.17                                     |
'----------------------------------------------------------------------------'

[debug] Loaded dispatcher "Catalyst::Dispatcher"
[debug] Loaded engine "Catalyst::Engine::HTTP"
[debug] Found home "/home/marcello/perl/LettereAttivazione"
[debug] Loaded components:
.-----------------------------------------------------------------+----------.
| Class                                                           | Type     |
+-----------------------------------------------------------------+----------+
| LettereAttivazione::WebApp::Controller::AccordiQuadro           | instance |
| LettereAttivazione::WebApp::Controller::Base                    | instance |
| LettereAttivazione::WebApp::Controller::LettereAttivazione      | instance |
| LettereAttivazione::WebApp::Controller::Root                    | instance |
| LettereAttivazione::WebApp::Model::DB::Schema                   | instance |
| LettereAttivazione::WebApp::Model::DB::Schema::AccordiQuadro    | class    |
| LettereAttivazione::WebApp::Model::DB::Schema::AccordiQuadroVi- | class    |
| ew                                                              |          |
| LettereAttivazione::WebApp::Model::DB::Schema::Addenda          | class    |
| LettereAttivazione::WebApp::Model::DB::Schema::LettereAttivazi- | class    |
| one                                                             |          |
| LettereAttivazione::WebApp::Model::DB::Schema::Regioni          | class    |
| LettereAttivazione::WebApp::View::TT::Std                       | instance |
'-----------------------------------------------------------------+----------'

[debug] Loaded Private actions:
.----------------------+--------------------------------------+--------------.
| Private              | Class                                | Method       |
+----------------------+--------------------------------------+--------------+
| /index               | LettereAttivazione::WebApp::Control- | index        |
|                      | ler::Root                            |              |
| /end                 | LettereAttivazione::WebApp::Control- | end          |
|                      | ler::Root                            |              |
| /accordiquadro/crea- | LettereAttivazione::WebApp::Control- | create       |
| te                   | ler::AccordiQuadro                   |              |
| /accordiquadro/defa- | LettereAttivazione::WebApp::Control- | default      |
| ult                  | ler::AccordiQuadro                   |              |
| /accordiquadro/list  | LettereAttivazione::WebApp::Control- | list         |
|                      | ler::AccordiQuadro                   |              |
| /lettereattivazione- | LettereAttivazione::WebApp::Control- | default      |
| /default             | ler::LettereAttivazione              |              |
| /lettereattivazione- | LettereAttivazione::WebApp::Control- | list         |
| /list                | ler::LettereAttivazione              |              |
'----------------------+--------------------------------------+--------------'

[debug] Loaded Path actions:
.-------------------------------------+--------------------------------------.
| Path                                | Private                              |
+-------------------------------------+--------------------------------------+
| /accordiquadro/create               | /accordiquadro/create                |
| /accordiquadro/list                 | /accordiquadro/list                  |
| /lettereattivazione/list            | /lettereattivazione/list             |
'-------------------------------------+--------------------------------------'

[info] Gestione lettere attivazione Enel powered by Catalyst 5.7007
You can connect to your server at http://serverlinux:3000
    -> DBI->connect(dbi:Pg:database=LettereAttivazione, la, ****, 
HASH(0x907f5a0))
    -> DBI->install_driver(Pg) for linux perl=5.008008 pid=7372 ruid=1010 
euid=1010
       install_driver: DBD::Pg version 1.49 loaded from 
/usr/lib/perl5/site_perl/5.8.8/i686-linux/DBD/Pg.pm
    <- install_driver= DBI::dr=HASH(0x907fc90)
    !! warn: 0 CLEARED by call to connect method
    <- connect('database=LettereAttivazione' 'la' ...)= DBI::db=HASH(0x90f357c) 
at DBI.pm line 633
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 685
    <- STORE('PrintError' 1)= 1 at DBI.pm line 685
    <- STORE('AutoCommit' 1)= 1 at DBI.pm line 685
    <- STORE('Username' 'la')= 1 at DBI.pm line 688
    <> FETCH('Username')= 'la' ('Username' from cache) at DBI.pm line 688
    <- connected('dbi:Pg:database=LettereAttivazione' 'la' ...)= undef at 
DBI.pm line 694
    <- connect= DBI::db=HASH(0x90f357c)
    <- STORE('dbi_connect_closure' CODE(0x90ed1c4))= 1 at DBI.pm line 703
    <- STORE('HandleError' CODE(0x90f378c))= 1 at DBI.pm line 782
    <- STORE('ShowErrorStatement' 1)= 1 at DBI.pm line 783
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 784
    <- STORE('PrintError' 0)= 1 at DBI.pm line 785
    <- FETCH('AutoCommit')= 1 at Grouped.pm line 270
    <- FETCH('Driver')= DBI::dr=HASH(0x907fc90) at DBI.pm line 738
    <> FETCH('Name')= 'Pg' ('Name' from cache) at DBI.pm line 738
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- begin_work= 1 at DBI.pm line 809
    <- FETCH('Active')= 1 at DBI.pm line 673
    <- ping= 1 at DBI.pm line 673
    <- FETCH('Driver')= DBI::dr=HASH(0x907fc90) at DBI.pm line 66
    <> FETCH('Name')= 'Pg' ('Name' from cache) at DBI.pm line 66
    <- FETCH('Driver')= DBI::dr=HASH(0x907fc90) at Limit.pm line 301
    <> FETCH('Name')= 'Pg' ('Name' from cache) at Limit.pm line 301
    <- FETCH('Driver')= DBI::dr=HASH(0x907fc90) at Limit.pm line 338
    <> FETCH('Name')= 'Pg' ('Name' from cache) at Limit.pm line 338
    <- prepare_cached('INSERT INTO accordi_quadro (codice, data, descrizione, 
importo_totale, perc_otto) VALUES (?, ?, ?, ?, ?)' HASH(0x910b498) ...)= 
DBI::st=HASH(0x910b51c) at DBI.pm line 1116
    <- bind_param(1 '3' ...)= 1 at DBI.pm line 932
    <- bind_param(2 '2007-01-01' ...)= 1 at DBI.pm line 932
    <- bind_param(3 'description' ...)= 1 at DBI.pm line 932
    <- bind_param(4 100 ...)= 1 at DBI.pm line 932
    <- bind_param(5 65 ...)= 1 at DBI.pm line 932
    !! ERROR: 7 'ERROR:  una chiave duplicata viola il vincolo 
"accordi_quadro_codice_key"
' (err#0)
    <- execute= undef at DBI.pm line 938
    -> HandleError on DBI::st=HASH(0x910b4e0) via CODE(0x90f378c) (undef)
    !! ERROR: 7 CLEARED by call to prepare_cached method
    <- prepare_cached('SELECT COUNT( * ) FROM accordi_quadro me' 
HASH(0x912566c) ...)= DBI::st=HASH(0x8e6beac) at DBI.pm line 1116
    !! ERROR: 7 'ERROR:  current transaction is aborted, commands ignored until 
end of transaction block
' (err#0)
    <- execute= undef at DBI.pm line 938
    -> HandleError on DBI::st=HASH(0x912569c) via CODE(0x90f378c) (undef)
    !! ERROR: 7 CLEARED by call to prepare_cached method
    <- prepare_cached('SELECT COUNT( * ) FROM accordi_quadro me' 
HASH(0x911b784) ...)= DBI::st=HASH(0x8e6beac) at DBI.pm line 1116
    !! ERROR: 7 'ERROR:  current transaction is aborted, commands ignored until 
end of transaction block
' (err#0)
    <- execute= undef at DBI.pm line 938
    -> HandleError on DBI::st=HASH(0x912569c) via CODE(0x90f378c) (undef)
       ERROR: 7 'ERROR:  current transaction is aborted, commands ignored until 
end of transaction block
' (err#0)
    <- FETCH('Active')= 1 at DBI.pm line 673
       ERROR: 7 'ERROR:  current transaction is aborted, commands ignored until 
end of transaction block
' (err#0)
    <- ping= 4 at DBI.pm line 673
    !! ERROR: 7 CLEARED by call to rollback method
    <- rollback= 1 at DBI.pm line 838
_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to