Thread: ecpg Oracle compatibility issue

ecpg Oracle compatibility issue

From
Roland Karch
Date:
Hello together,

While porting my TPC-C implementation from Oracle, I discovered the
attached problem with the EXEC SQL COMMIT RELEASE statement.

Bye,
Roland


Attachment

Re: ecpg Oracle compatibility issue

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Roland Karch wrote:
> Hello together,
>
> While porting my TPC-C implementation from Oracle, I discovered the
> attached problem with the EXEC SQL COMMIT RELEASE statement.
>
> Bye,
> Roland
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: ecpg Oracle compatibility issue

From
Bruce Momjian
Date:
I applied the attached patch. Your version looked like it would have
doubled the double-quotes.  As you mentioned, you couldn't get bison to
work, so you weren't able to test it.  Please look over this patch and
make sure it is correct.  Also check the other use of ECPGdisconnect().
Is that correct?  Does it need "CURRENT"?

---------------------------------------------------------------------------

Roland Karch wrote:
> Hello together,
>
> While porting my TPC-C implementation from Oracle, I discovered the
> attached problem with the EXEC SQL COMMIT RELEASE statement.
>
> Bye,
> Roland
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: ecpg Oracle compatibility issue

From
Roland Karch
Date:
On Thu, Dec 12, 2002 at 04:49:30PM -0500, Bruce Momjian wrote:
> I applied the attached patch. Your version looked like it would have
> doubled the double-quotes.

Oops - yes, I got that wrong.

> As you mentioned, you couldn't get bison to
> work, so you weren't able to test it.  Please look over this patch and
> make sure it is correct.

It works fine, just got bison to work on my other computer.

> Also check the other use of ECPGdisconnect().
> Is that correct?  Does it need "CURRENT"?

Yes, it's needed. Supplying a NULL pointer instead results in a segfault
for me. However, it would work if src/interfaces/ecpg/lib/connect.c line
468 was patched - checking for NULL before dereferencing a user-supplied
pointer is generally a good idea.

Re: ecpg Oracle compatibility issue

From
Bruce Momjian
Date:
OK, patch applied. Thanks.

---------------------------------------------------------------------------

Roland Karch wrote:
> On Thu, Dec 12, 2002 at 04:49:30PM -0500, Bruce Momjian wrote:
> > I applied the attached patch. Your version looked like it would have
> > doubled the double-quotes.
>
> Oops - yes, I got that wrong.
>
> > As you mentioned, you couldn't get bison to
> > work, so you weren't able to test it.  Please look over this patch and
> > make sure it is correct.
>
> It works fine, just got bison to work on my other computer.
>
> > Also check the other use of ECPGdisconnect().
> > Is that correct?  Does it need "CURRENT"?
>
> Yes, it's needed. Supplying a NULL pointer instead results in a segfault
> for me. However, it would work if src/interfaces/ecpg/lib/connect.c line
> 468 was patched - checking for NULL before dereferencing a user-supplied
> pointer is generally a good idea.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.204
diff -c -c -r1.204 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y    12 Dec 2002 21:50:01 -0000    1.204
--- src/interfaces/ecpg/preproc/preproc.y    13 Dec 2002 20:27:24 -0000
***************
*** 554,560 ****
              if (connection)
                  mmerror(PARSE_ERROR, ET_ERROR, "no at option for disconnect statement.\n");

!             fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);", $1);
              whenever_action(2);
              free($1);
          }
--- 554,561 ----
              if (connection)
                  mmerror(PARSE_ERROR, ET_ERROR, "no at option for disconnect statement.\n");

!             fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);",
!                     $1 ? $1 : "\"CURRENT\"");
              whenever_action(2);
              free($1);
          }