Re: Pg + perl + apache
От | Michael L. Artz |
---|---|
Тема | Re: Pg + perl + apache |
Дата | |
Msg-id | 403057E4.9030709@october29.net обсуждение исходный текст |
Ответ на | Re: Pg + perl + apache (Martijn van Oosterhout <kleptog@svana.org>) |
Ответы |
Re: Pg + perl + apache
|
Список | pgsql-general |
Thanks, that did help to debug the application. I found that my errors weren't so random after all ... if I went to a page with a bad query, then I would start getting the error. So, basically, if I grab a DB connection and issue a bad query, then every other query issued via that DB connection will not work because they are in the same transaction? So the following perl snippet: ---------------------------- my $dbh = DBI->connect(@database); # invalid SQL my $sql = "SELECT crap;"; my $sth = $dbh->prepare($sql); $sth->execute(); $sql = "SELECT 1;"; my ($should_be_one) = $dbh->selectrow_array($sql); $dbh->disconnect(); ----------------------------- should throw an error for *both* queries? So I guess I need to issue a commit after I do my queries, or else turn autocommit on. And yes, always using strict and warnings in my scripts, and using Apache::DBI's connection pooling to cache my DB connections. Thanks -Mike Martijn van Oosterhout wrote: >On Sat, Feb 14, 2004 at 04:35:58PM -0500, Michael L. Artz wrote: > > >>I'm having some odd issues, but I'm not sure exactly the cause of them, >>but postgres is the component in the system that is throwing the errors, >>so I thought I'd start here. >> >> > ><snip> > > >>with the corresponding postgresql.log entry being >> >>LOG: statement: SELECT session_key FROM session WHERE user_id = 101 >>ERROR: current transaction is aborted, queries ignored until end of >>transaction block >> >> > >This happens when, within a transaction gets an error, you don't notice and >keep blindly sending queries. > >Scroll up to find the actual error. > >If it's the first transaction in a session, that means someone forgot to >clear their transaction. I guess you could fix it then by sending "abort" >as the first query. > >Hope this helps, > > >
В списке pgsql-general по дате отправления: