pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
bugfix proposal for ecpglib prepare's parse code
2+ messages / 2 participants
[nested] [flat]

* bugfix proposal for ecpglib prepare's parse code
@ 2004-09-30 11:12 Daniel Verite <daniel@manitou-mail.org>
  2004-10-05 10:49 ` Re: bugfix proposal for ecpglib prepare's parse code Michael Meskes <meskes@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Daniel Verite @ 2004-09-30 11:12 UTC (permalink / raw)
  To: pgsql-interfaces

	Hello,

A problem with ecpg reported in pgsql-fr-general:
http://archives.postgresql.org/pgsql-fr-generale/2004-09/msg00024.php
boils down to ecpglib interpreting two consecutive colons as a placeholder
(or maybe two) for a host variable in the context of an EXEC SQL PREPARE :stmt
This leads to failure when '::' is used in the statement as a cast operator, as
it is in the message pointed above.

The small patch below is a fix for this (it applies within pg8.0.0-beta3 to
src/interfaces/ecpg/ecpglib/prepare.c):

*** prepare.c~  Fri May 21 15:50:12 2004
--- prepare.c   Wed Sep 29 17:35:58 2004
***************
*** 46,54 ****
  
                if (!string && *ptr == ':')
                {
!                       *ptr = '?';
!                       for (++ptr; *ptr && isvarchar(*ptr); ptr++)
!                               *ptr = ' ';
                }
        }
  }
--- 46,59 ----
  
                if (!string && *ptr == ':')
                {
!                       if (ptr[1]==':')
!                               ptr+=2; /* skip  '::' */
!                       else
!                       {
!                               *ptr = '?';
!                               for (++ptr; *ptr && isvarchar(*ptr); ptr++)
!                                       *ptr = ' ';
!                       }
                }
        }
  }

Regards,

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




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

* Re: bugfix proposal for ecpglib prepare's parse code
  2004-09-30 11:12 bugfix proposal for ecpglib prepare's parse code Daniel Verite <daniel@manitou-mail.org>
@ 2004-10-05 10:49 ` Michael Meskes <meskes@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 2004-10-05 10:49 UTC (permalink / raw)
  To: Daniel Verite <daniel@manitou-mail.org>; +Cc: pgsql-interfaces

On Thu, Sep 30, 2004 at 01:12:35PM +0200, Daniel Verite wrote:
> A problem with ecpg reported in pgsql-fr-general:
> http://archives.postgresql.org/pgsql-fr-generale/2004-09/msg00024.php
> boils down to ecpglib interpreting two consecutive colons as a placeholder
...

Thanks for the patch. I applied it to HEAD and REL_7_4.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!



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


end of thread, other threads:[~2004-10-05 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-30 11:12 bugfix proposal for ecpglib prepare's parse code Daniel Verite <daniel@manitou-mail.org>
2004-10-05 10:49 ` Michael Meskes <meskes@postgresql.org>

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