postgresql/src
Tom Lane 2ec477dc81 Cope with Readline's failure to track SIGWINCH events outside of input.
It emerges that libreadline doesn't notice terminal window size change
events unless they occur while collecting input.  This is easy to stumble
over if you resize the window while using a pager to look at query output,
but it can be demonstrated without any pager involvement.  The symptom is
that queries exceeding one line are misdisplayed during subsequent input
cycles, because libreadline has the wrong idea of the screen dimensions.

The safest, simplest way to fix this is to call rl_reset_screen_size()
just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)
for every command; but since it only happens when reading from a tty, the
performance impact should be negligible.  A more valid objection is that
this still leaves a tiny window during entry to readline() wherein delivery
of SIGWINCH will be missed; but the practical consequences of that are
probably negligible.  In any case, there doesn't seem to be any good way to
avoid the race, since readline exposes no functions that seem safe to call
from a generic signal handler --- rl_reset_screen_size() certainly isn't.

It turns out that we also need an explicit rl_initialize() call, else
rl_reset_screen_size() dumps core when called before the first readline()
call.

rl_reset_screen_size() is not present in old versions of libreadline,
so we need a configure test for that.  (rl_initialize() is present at
least back to readline 4.0, so we won't bother with a test for it.)
We would need a configure test anyway since libedit's emulation of
libreadline doesn't currently include such a function.  Fortunately,
libedit seems not to have any corresponding bug.

Merlin Moncure, adjusted a bit by me
2015-12-16 16:59:35 -05:00
..
backend Speed up CREATE INDEX CONCURRENTLY's TID sort. 2015-12-16 15:23:45 -05:00
bin Cope with Readline's failure to track SIGWINCH events outside of input. 2015-12-16 16:59:35 -05:00
common pgindent run for 9.5 2015-05-23 21:35:49 -04:00
include Cope with Readline's failure to track SIGWINCH events outside of input. 2015-12-16 16:59:35 -05:00
interfaces Fix out-of-memory error handling in ParameterDescription message processing. 2015-12-14 18:19:10 +02:00
makefiles Remove support for Unix systems without the POSIX signal APIs. 2015-08-31 12:56:10 -04:00
pl Instruct Coverity using an assertion. 2015-12-05 03:04:17 -05:00
port Adopt the GNU convention for handling tar-archive members exceeding 8GB. 2015-11-21 20:21:31 -05:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Mark CHECK constraints declared NOT VALID valid if created with table. 2015-12-16 07:43:56 -05:00
timezone Update time zone data files to tzdata release 2015g. 2015-10-02 19:15:39 -04:00
tools Move buffer I/O and content LWLocks out of the main tranche. 2015-12-15 13:32:54 -05:00
tutorial Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
.gitignore
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Make prove_installcheck remove the old log directory, if any. 2015-10-11 20:36:07 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00