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

Re: Text <-> C string

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brendan Jurd" <direvus(at)gmail(dot)com>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Text <-> C string
Date: 2007-09-21 23:09:02
Message-ID: 27654.1190416142@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
"Brendan Jurd" <direvus(at)gmail(dot)com> writes:
> I just noticed a couple of macros defined in src/include/tsearch/ts_utils.h:

> #define TextPGetCString(t)
> DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(t)))
> #define CStringGetTextP(c) DatumGetTextP(DirectFunctionCall1(textin,
> CStringGetDatum(c)))

> Seems these would actually be convenient in quite a lot of places in
> the backend.  Is there any downside to moving these two into
> src/include/postgres.h?

I think if you look around you'll find several similar things in various
contrib modules.  It would make some sense to try to unify all this.
I'm not particularly for making it macros in postgres.h though ---
that's no help if the macros require referencing stuff in builtins.h.

On grounds of code-space savings I think it might be worth making
these things be simple functions declared in builtins.h; that would
also make it much easier to change their implementations.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Guillaume SmetDate: 2007-09-22 08:37:22
Subject: Re: like/ilike improvements
Previous:From: Tom LaneDate: 2007-09-21 22:53:56
Subject: Re: Eliminate more detoast copies for packed varlenas

pgsql-patches by date

Next:From: Guillaume SmetDate: 2007-09-22 08:37:22
Subject: Re: like/ilike improvements
Previous:From: Tom LaneDate: 2007-09-21 22:53:56
Subject: Re: Eliminate more detoast copies for packed varlenas

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