Re: PQescapeBytea v 7.2.3 BUG? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PQescapeBytea v 7.2.3 BUG?
Date
Msg-id 652.1037021917@sss.pgh.pa.us
Whole thread Raw
In response to PQescapeBytea v 7.2.3 BUG?  (Reid Thompson <reid.thompson@ateb.com>)
List pgsql-hackers
Reid Thompson <reid.thompson@ateb.com> writes:
> should
>      sprintf(buffer, "%c", 0x5C);
>      readsz = 1;
>      buffer2Ptr =(unsigned char *) PQescapeBytea(buffer, readsz, &esclen);
>      for (ctr = 0; ctr < strlen(buffer2Ptr); ctr++)
>      {
>          printf("char[%d] is [%c]\n", ctr, buffer2Ptr[ctr]);
>      }
>      printf("esclen is [%d]\n", esclen);
>      printf("buffer2Ptr is [%s]\n", buffer2Ptr); 
> result in the following output?

> char[0] is [\]
> char[1] is [\]
> char[2] is [\]
> char[3] is [\]
> esclen is [5]
> buffer2Ptr is [\\\\]

Looks okay to me.  Note the 7.2 manual mistakenly claims that esclen
doesn't include the trailing null in the output.  According to the
current manual, it does.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Reid Thompson
Date:
Subject: PQescapeBytea v 7.2.3 BUG?
Next
From: Dennis Björklund
Date:
Subject: Re: Implicit coercions, choosing types for constants, etc