Re: Alter strings that don't belong to the application - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Alter strings that don't belong to the application
Date
Msg-id 29261.1055424573@sss.pgh.pa.us
Whole thread Raw
In response to Alter strings that don't belong to the application  (Dennis Björklund <db@zigo.dhs.org>)
Responses Re: Alter strings that don't belong to the application  (Dennis Björklund <db@zigo.dhs.org>)
List pgsql-hackers
Dennis Björklund <db@zigo.dhs.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


pgsql-hackers by date:

Previous
From: Hans-Jürgen Schönig
Date:
Subject: Re: Pre-allocation of shared memory ...
Next
From: Rod Taylor
Date:
Subject: CVS -Tip compile issue -- FreeBSD 4.8