Extend psql's \e and \ef commands so that a line number can be specified,
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 12 Aug 2010 00:40:59 +0000 (00:40 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 12 Aug 2010 00:40:59 +0000 (00:40 +0000)
commit568e709372abad30075c299be28956b5922219b4
treea442b37de7ab7a32d59d4612f92fe3d1a5fe1ffa
parenta4a3ef344e189d714d06224892e636c3153e8103
Extend psql's \e and \ef commands so that a line number can be specified,
and the editor's cursor will be initially placed on that line.  In \e the
lines are counted with respect to the query buffer, while in \ef they are
counted with line 1 = first line of function body.  These choices are useful
for positioning the cursor on the line of a previously-reported error.

To avoid assumptions about what switch the user's editor takes for this
purpose, invent a new psql variable EDITOR_LINENUMBER_SWITCH with (at
present) no default value.

One incompatibility from previous behavior is that "\e 1234" will now
take "1234" as a line number not a file name.  There are at least two
ways to select a numerically-named file if you really want to.

Pavel Stehule, reviewed by Jan Urbanski, with further editing by Robert Haas
and Tom Lane
doc/src/sgml/ref/psql-ref.sgml
src/backend/utils/adt/ruleutils.c
src/bin/psql/command.c
src/bin/psql/help.c