pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ECPG: AUTOCOMMIT and CURSORs
3+ messages / 2 participants
[nested] [flat]

* ECPG: AUTOCOMMIT and CURSORs
@ 2010-10-04 19:07 A J <s5aly@yahoo.com>
  2010-10-04 21:20 ` Re: ECPG: AUTOCOMMIT and CURSORs Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 3+ messages in thread

From: A J @ 2010-10-04 19:07 UTC (permalink / raw)
  To: pgsql-admin

I am seeing some funny behavior on using both:
EXEC SQL SET AUTOCOMMIT TO ON;
and
CURSORS (EXEC SQL DECLARE ............., EXEC SQL FETCH NEXT FROM .............)

On autocommit on (either through above method or precompiling with -t option), 
the cursor does not return any rows. On disabling autocommit, I get the required 
number of rows from the cursor.

Any idea what could be going on ? 

Thanks!
AJ


      

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: ECPG: AUTOCOMMIT and CURSORs
  2010-10-04 19:07 ECPG: AUTOCOMMIT and CURSORs A J <s5aly@yahoo.com>
@ 2010-10-04 21:20 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2010-10-05 17:51   ` Re: ECPG: AUTOCOMMIT and CURSORs A J <s5aly@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Kevin Grittner @ 2010-10-04 21:20 UTC (permalink / raw)
  To: pgsql-admin; A J <s5aly@yahoo.com>

A J <s5aly@yahoo.com> wrote:
 
> I am seeing some funny behavior on using both:
> EXEC SQL SET AUTOCOMMIT TO ON;
> and
> CURSORS (EXEC SQL DECLARE ............., EXEC SQL FETCH NEXT FROM 
> .............)
> 
> On autocommit on (either through above method or precompiling with
> -t option), 
> the cursor does not return any rows. On disabling autocommit, I
> get the required number of rows from the cursor.
> 
> Any idea what could be going on ? 
 
Are you inside of a transaction?  How does the WITH or WITHOUT HOLD
function in ECPG?  From the manual:
 
http://www.postgresql.org/docs/current/interactive/sql-declare.html
 
"WITHOUT HOLD specifies that the cursor cannot be used outside of
the transaction that created it. If neither WITHOUT HOLD nor WITH
HOLD is specified, WITHOUT HOLD is the default."
 
-Kevin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: ECPG: AUTOCOMMIT and CURSORs
  2010-10-04 19:07 ECPG: AUTOCOMMIT and CURSORs A J <s5aly@yahoo.com>
  2010-10-04 21:20 ` Re: ECPG: AUTOCOMMIT and CURSORs Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2010-10-05 17:51   ` A J <s5aly@yahoo.com>
  0 siblings, 0 replies; 3+ messages in thread

From: A J @ 2010-10-05 17:51 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; pgsql-admin

That would explain it. I was neither in a transaction nor did any explicit HOLD. 
Thanks Kevin.



________________________________
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-admin@postgresql.org; A J <s5aly@yahoo.com>
Sent: Mon, October 4, 2010 5:20:14 PM
Subject: Re: [ADMIN] ECPG: AUTOCOMMIT and CURSORs

A J <s5aly@yahoo.com> wrote:

> I am seeing some funny behavior on using both:
> EXEC SQL SET AUTOCOMMIT TO ON;
> and
> CURSORS (EXEC SQL DECLARE ............., EXEC SQL FETCH NEXT FROM 
> .............)
> 
> On autocommit on (either through above method or precompiling with
> -t option), 
> the cursor does not return any rows. On disabling autocommit, I
> get the required number of rows from the cursor.
> 
> Any idea what could be going on ? 

Are you inside of a transaction?  How does the WITH or WITHOUT HOLD
function in ECPG?  From the manual:

http://www.postgresql.org/docs/current/interactive/sql-declare.html

"WITHOUT HOLD specifies that the cursor cannot be used outside of
the transaction that created it. If neither WITHOUT HOLD nor WITH
HOLD is specified, WITHOUT HOLD is the default."

-Kevin



      

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-10-05 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-10-04 19:07 ECPG: AUTOCOMMIT and CURSORs A J <s5aly@yahoo.com>
2010-10-04 21:20 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-10-05 17:51   ` A J <s5aly@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox