Re: Pgsql errors, DBI and CGI::Carp

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: Pgsql errors, DBI and CGI::Carp
Дата
Msg-id f11a4afa-23ad-4703-a85c-c6ed53d4e7d9@mm
обсуждение исходный текст
Ответ на Pgsql errors, DBI and CGI::Carp  (Toomas Vendelin <pg@vendelin.com>)
Ответы Re: Pgsql errors, DBI and CGI::Carp  (Toomas Vendelin <pg@vendelin.com>)
Список pgsql-general
    Toomas Vendelin wrote:

> I'm writing CGI scripts in Perl using Postgresql via DBI interface.
> RAISE_ERROR is on.
>
> For some reason (unlike with MySQL), when a Perl script dies from
> Postgresql error, the line number of Perl script where the error
> occurred is not reported, just the SQL statement line number is
given.
> In a longer script looking it may become a tedious task to guess the

> line in script that caused the problem. Is that an expected behavior

> or am I missing something?

It works for me:

$ cat dberr.pl
use CGI::Carp;
use DBI;
my $dbh=DBI->connect("dbi:Pg:dbname=test") or die;
$dbh->do("bogus SQL");

$ perl dberr.pl
[Fri May  1 15:05:08 2009] dberr.pl: DBD::Pg::db do failed: ERROR:
syntax error at or near "bogus"
[Fri May  1 15:05:08 2009] dberr.pl: LINE 1: bogus SQL
[Fri May  1 15:05:08 2009] dberr.pl:         ^ at dberr.pl line 4.

If you run that trivial program in your environment, what output do you
get?

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

В списке pgsql-general по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Re: Mapping output from a SEQUENCE into something non-repeating/colliding but random-looking?
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Re: Connecting to a postgreSQL database with windows CE over wi-fi; failing gracefully