Re: Alter strings that don't belong to the application

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Alter strings that don't belong to the application
Date: 2003-06-12 13:29:33
Message-ID: 29261.1055424573@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?ISO-8859-1?Q?Dennis_Bj=F6rklund?= <db(at)zigo(dot)dhs(dot)org> writes:
> I've been looking into the code of psql to fix a problem with charsets and
> noticed that psql changes the strings it gets back from functions like
> PQfname() and PQgetvalue().

I'd call that a bug in psql. Where do you see it happening exactly?

> Or should I read that the return value is "char *" and not "const char *"
> as it's okay to alter it?

No, I think the return value ought to be treated as const char *.
We're hesitant to actually declare it that way because we'd cause compile
errors in many client applications that aren't being const-paranoid.
But the app has no business modifying those values.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-06-12 13:30:23 CVS -Tip compile issue -- FreeBSD 4.8
Previous Message Robert Treat 2003-06-12 13:21:05 Re: [HACKERS] SAP and MySQL ... [and Benchmark]