Skip site navigation (1) Skip section navigation (2)

Re: Bytea string operator support

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Bytea string operator support
Date: 2001-09-07 06:47:21
Message-ID: 031c01c13768$f1adf300$0705a8c0@jecw2k1 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
> > > > Here's a patch for bytea string functions. As discussed:
> > > >
> > > > text encode(bytea, 'escape')
> > > > bytea decode(text, 'escape')
> > >
> > > Why are you using \xxx encoding there?  As the 'escape' encoding
> > > is supposed to be 'minimalistic' as it escapes only 2
> > > problematic values, then IMHO it would be better to use
> > > \0 and \\ as escapes - takes less room.
> >
> > Agreed, and I have documented this in the SGML pages.  Knowing this,
> > bytea becomes a much easier format to use.
>
> No problem -- I kind of like the octal style better, but I can see your
> point. I'll wait for awhile for more comments, and then send in a new
patch.

Here's a revised patch. Changes:

1. Now outputs '\\' instead of '\134' when using encode(bytea, 'escape')
Note that I ended up leaving \0 as \000 so that there are no ambiguities
when decoding something like, for example, \0123.

2. Fixed bug in byteain which allowed input values which were not valid
octals (e.g. \789), to be parsed as if they were octals.

Joe


Attachment: bytea_ops_r01.diff
Description: application/octet-stream (13.8 KB)

In response to

pgsql-hackers by date

Next:From: Rene PijlmanDate: 2001-09-07 08:15:01
Subject: Re: [HACKERS] JDBC pg_description update needed for CVS tip
Previous:From: Barry LindDate: 2001-09-07 06:39:53
Subject: Re: [HACKERS] JDBC pg_description update needed for CVS tip

pgsql-patches by date

Next:From: Rene PijlmanDate: 2001-09-07 08:15:01
Subject: Re: [HACKERS] JDBC pg_description update needed for CVS tip
Previous:From: Barry LindDate: 2001-09-07 06:39:53
Subject: Re: [HACKERS] JDBC pg_description update needed for CVS tip

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group