Re: [PATCHES] Text <-> C string - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: [PATCHES] Text <-> C string
Date
Msg-id 37ed240d0804161419h9d84f4bkfef2edb4966d23ef@mail.gmail.com
Whole thread Raw
In response to Re: [PATCHES] Text <-> C string  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCHES] Text <-> C string
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Apr 17, 2008 at 1:16 AM, Tom Lane  wrote:
> "Brendan Jurd"  writes:
>
> >> If we don't want to meddle with xmltype/bytea/VarChar at all, we'll
>  >> have to revert those changes, and I'll have to seriously scale back
>  >> the cleanup patch I was about to post.
>
>  > Still not sure where we stand on the above.  To cast, or not to cast?
>
>  I dunno.  I know there was previously some handwaving about representing
>  XML values in some more intelligent fashion than a plain text string,
>  but I have no idea if anyone is likely to do anything about it in the
>  foreseeable future.
>

Well ... if somebody does want to change the representation of xml
down the road, he's going to have to touch all the sites where the
code converts to and from cstring anyway, right?

So the only real difference this will make is that, instead of having
to replace four lines of VARDATA/memcpy per site, he'll have to
replace a single function call.  That doesn't seem like a negative.

With that in mind, please find attached my followup patch.  It cleans
up another 21 sites manually copying between cstring and varlena, for
a net reduction of 115 lines of code.

I didn't attempt to work through every reference to VARDATA, but I did
look at every hit from a  `grep -Rn VARDATA . | grep memcpy`.

All regression tests passed (contrib tests included) on gentoo.

Patch added to commitfest queue.

Cheers,
BJ
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIBm105YBsbHkuyV0RAmqfAKCfyNyFdciqX4QV81sG9MhPt+KXuACfe694
3d/ICZF6yqV6K20X3TVX+So=
=CvRM
-----END PGP SIGNATURE-----

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Lessons from commit fest
Next
From: Tom Lane
Date:
Subject: Re: Timely reporting of COPY errors