Re: review: psql: edit function, show function commands patch
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Jan Urbański <wulczer@wulczer.org>, Postgres - Hackers <pgsql-hackers@postgresql.org>
Date: 2010-08-14T14:09:04Z
Lists: pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes: > attached updated \sf implementation. It is little bit simplyfied with > support a pager and output forwarding. Formating was updated per Tom's > request. Applied with corrections --- mostly, fixing it to not trash the query buffer, which would certainly not be expected behavior for such a command. Also, as previously mentioned, I took out the line number argument, which seemed to me to have little if any use-case while substantially complicating the code. (It's not so much that it cost a lot in the patch as submitted, it's that it *would* cost a lot if you were honoring it in the pager calculation...) One other thing: I took a look at the pg_get_functiondef() code and realized that in fact it does NOT guarantee that the function body will start with "AS $function...". In languages with a nonnull probin field, that's not what the line will look like. I think though that looking for just "AS " at the start of the line is sufficient for our purposes here. I will go change the \ef and \sf code for that. regards, tom lane