pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: pgsql-interfaces@postgresql.org
Subject: bugfix proposal for ecpglib prepare's parse code
Date: Thu, 30 Sep 2004 13:12:35 +0200
Message-ID: <20040930131206.2513124@localhost> (raw)

	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




view thread (2+ messages)  latest in thread

Message-ID: <20040930131206.2513124@localhost>
Permalink:  ../20040930131206.2513124@localhost/
Also on:    postgresql.org/message-id/20040930131206.2513124@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: daniel@manitou-mail.org
  Subject: Re: bugfix proposal for ecpglib prepare's parse code
  In-Reply-To: <20040930131206.2513124@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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