Re: [GENERAL] What does this mean ? - Mailing list pgsql-general

From Adam Haberlach
Subject Re: [GENERAL] What does this mean ?
Date
Msg-id 19990626110320.A24520@ricochet.net
Whole thread Raw
In response to Re: [GENERAL] What does this mean ?  (Mario Jorge Nunes Filipe <mjnf@neptuno.sc.uevora.pt>)
List pgsql-general
On Fri, Jun 25, 1999 at 05:01:29PM +0100, Mario Jorge Nunes Filipe wrote:
> Thomas Reinke wrote:
> >
> > You have already started a transaction and haven't yet
> > finished it.
> >
> > E.g.
> >
> > psql template;
> > BEGIN;
> > BEGIN;
>
>     Not that i don't believe you but i think that in my case that is a tid
> bit impossible. The error comes from a php script. On that script i open
> the connection, then i do a select and then the begin. So there isn't
> anyother begin. I've tryed to run an abort before that but it still
> doen't return a result, althoug there is no message error either.
>
>     I really need help here, because i really need this thing working with
> transactions. Just in case here is the code:
>
> pg_Exec($conn, "abort");
> $result = @pg_Exec($conn, "begin");
> if (!$result);
>   $msg ="sac-pcgra (2):".addslashes(pg_ErrorMessage($conn));
>   $msg = chop($msg);
>   echo "<script>alert(\"$msg\");history.go(-1)</script>";
>   pg_Close($conn);
>   exit;
> }

    Here is some code from one of my projects (displays the top 15
speakers in a database of irc transactions).  I don't bother to post
a COMMIT in this case because it is just a select.  On another system,
I do get warning (not error) messages about not COMMITing transactions,
btw.

        $pgconn = pg_connect("socket", "5432", "", "", "slashnet");

        $result = pg_exec($pgconn, "BEGIN");
        $result = pg_exec($pgconn, "DECLARE foo CURSOR FOR select nick, count(*) as tcoun
t from messages group by nick order by tcount desc");
        $result = pg_exec($pgconn, "FETCH 15 IN foo");
        $rows = pg_numrows($result);



pgsql-general by date:

Previous
From: Karl DeBisschop
Date:
Subject: Re: [GENERAL] Questions regarding OID
Next
From: Kenneth Been
Date:
Subject: large object minimum storage