Um, I hate to say "I told you so", but this const-addition has
in fact created more warning messages than it eliminated:
gcc -I../../interfaces/libpq -I../../include -I../../backend -g -O -Wall -Wmissing-prototypes -c psql.c -o psql.o
psql.c: In function `HandleSlashCmds':
psql.c:1833: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2192: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2257: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2265: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2309: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c: In function `main':
psql.c:2982: warning: passing arg 1 of `free' discards `const' from pointer target type
I think this is a fairly graphic demonstration of my assertion that
adding const to application-visible fields is not entirely transparent.
I would like to back this patch out until such time as we are prepared
to fully const-ify libpq's interface (eg, declare PQgetvalue and all
the other accessor functions as returning const char* not just char*).
We shouldn't annoy application programmers a little bit here and a
little bit there --- we should go the whole nine yards at once rather
than forcing them to insert a few more "const"s with each release.
IMHO, anyway.
regards, tom lane