psql \dFp's behavior - Mailing list pgsql-hackers
From | Guillaume Lelarge |
---|---|
Subject | psql \dFp's behavior |
Date | |
Msg-id | 475ED43D.9070009@lelarge.info Whole thread Raw |
Responses |
Re: psql \dFp's behavior
|
List | pgsql-hackers |
Hi all, I'm not sure psql handles \dFp the right way. The query allows translators to translate some columns' values but forgets to escape the strings. So, here is a patch that escapes these translated strings. Regards. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com Index: src/bin/psql/describe.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v retrieving revision 1.162 diff -c -r1.162 describe.c *** src/bin/psql/describe.c 15 Nov 2007 21:14:42 -0000 1.162 --- src/bin/psql/describe.c 11 Dec 2007 18:04:09 -0000 *************** *** 2069,2112 **** printQueryOpt myopt = pset.popt; initPQExpBuffer(&buf); ! ! printfPQExpBuffer(&buf, ! "SELECT '%s' AS \"%s\", \n" " p.prsstart::pg_catalog.regproc AS \"%s\", \n" ! " pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\" \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT '%s', \n" " p.prstoken::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prstoken, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT '%s', \n" " p.prsend::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prsend, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT '%s', \n" " p.prsheadline::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prsheadline, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT '%s', \n" " p.prslextype::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prslextype, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" ! " WHERE p.oid = '%s' \n", ! _("Start parse"), ! _("Method"), _("Function"), _("Description"), ! oid, ! _("Get next token"), oid, ! _("End parse"), oid, ! _("Get headline"), oid, ! _("Get token types"), oid ); res = PSQLexec(buf.data, false); --- 2069,2114 ---- printQueryOpt myopt = pset.popt; initPQExpBuffer(&buf); ! appendPQExpBuffer(&buf, "SELECT "); ! appendStringLiteralConn(&buf, _("Start parse"), pset.db); ! appendPQExpBuffer(&buf, " AS \"%s\", \n" " p.prsstart::pg_catalog.regproc AS \"%s\", \n" ! " pg_catalog.obj_description(p.prsstart, 'pg_proc') AS \"%s\" \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT ", ! _("Method"), _("Function"), _("Description"), oid); ! appendStringLiteralConn(&buf, _("Get next token"), pset.db); ! appendPQExpBuffer(&buf, ", \n" " p.prstoken::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prstoken, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT ", oid); ! appendStringLiteralConn(&buf, _("End parse"), pset.db); ! appendPQExpBuffer(&buf, ", \n" " p.prsend::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prsend, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT ", oid); ! appendStringLiteralConn(&buf, _("Get headline"), pset.db); ! appendPQExpBuffer(&buf, ", \n" " p.prsheadline::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prsheadline, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" " WHERE p.oid = '%s' \n" "UNION ALL \n" ! "SELECT ", oid); ! appendStringLiteralConn(&buf, _("Get token types"), pset.db); ! appendPQExpBuffer(&buf, ", \n" " p.prslextype::pg_catalog.regproc, \n" " pg_catalog.obj_description(p.prslextype, 'pg_proc') \n" " FROM pg_catalog.pg_ts_parser p \n" ! " WHERE p.oid = '%s' \n", oid ); res = PSQLexec(buf.data, false);
pgsql-hackers by date: