byteain() doesn't parse correctly

From: Jered Floyd <jered(at)permabit(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: dev-server(at)permabit(dot)com
Subject: byteain() doesn't parse correctly
Date: 2001-02-07 08:16:17
Message-ID: 87ofwesyb2.fsf@irregular-apocalypse.permabit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Jered Floyd
Your email address : jered(at)permabit(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : x86

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.17

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.3

Compiler used (example: gcc 2.8.0) : gcc 2.95.2

Please enter a FULL description of your problem:
------------------------------------------------

byteain() in backend/utils/adt/varlena.c is just wrong. It can't parse
'\\', claiming 'Bad input string for type bytea'. No, really.

More curious is that it can't handle '\134' either, implying that
multiple levels of parsing are going on. But, it *can* parse
'\\\\' as \\. This boggles the mind.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

SELECT '\\'::bytea;
SELECT '\134'::bytea;
SELECT '\\\\'::bytea;

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

This routine is cherry fondue; extremely nasty, but we can't prosecute
for that. It needs a good rewrite, and an audit of the parse chain in
general wouldn't hurt.

As with the previous 2 bugs, I suspect this is something I'll just do
when I port my 7.0.3 routines for making BYTEAs more first-class
citizens to 7.1. I'd be tickled if you beat me to it, though.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter T Mount 2001-02-07 09:02:20 Re: 7.1beta4 jdbc problem on freebsd 4.2 with JSDK 1.1.8.
Previous Message Jered Floyd 2001-02-07 08:15:06 JDBC driver doesn't allow access to BYTEA types via get/setBytes()