Re: C function accepting/returning cstring vs. text

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: C function accepting/returning cstring vs. text
Date: 2010-01-27 13:44:02
Message-ID: 20100127134402.GA18603@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 27, 2010 at 02:14:36PM +0100, Ivan Sergio Borgonovo wrote:
> I haven't been able to understand the difference between function
> returning cstring and text and if there is any need to be careful
> about encoding and escaping when copying from the lexeme to a buffer
> that will return a cstring or text.

Well, the difference is that one is a cstring and the other is text.
Seriously though, text is more useful if you want people to be able to
use the result in other functions since on SQL level almost everything
is text. cstring is needed for some APIs but it generally not used
unless necessary.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Christensen 2010-01-27 14:01:04 Re: Patch: psql \whoami option
Previous Message Craig Ringer 2010-01-27 13:41:02 Re: C function accepting/returning cstring vs. text