Compare commits

..

No commits in common. "64e77b496af61ee31189ba69b40e785e11e9967f" and "3e2e0d5ad7fcb89d18a71cbfc885ef184e1b6f2e" have entirely different histories.

3 changed files with 23 additions and 33 deletions

View File

@ -4908,7 +4908,7 @@ initPopulateTable(PGconn *con, const char *table, int64 base,
initRowMethod init_row) initRowMethod init_row)
{ {
int n; int n;
int64 k; int k;
int chars = 0; int chars = 0;
PGresult *res; PGresult *res;
PQExpBufferData sql; PQExpBufferData sql;

View File

@ -46,6 +46,25 @@ $node->safe_psql('postgres',
. "CREATE TYPE enum1 AS ENUM ('foo', 'bar', 'baz', 'BLACK');\n" . "CREATE TYPE enum1 AS ENUM ('foo', 'bar', 'baz', 'BLACK');\n"
. "CREATE PUBLICATION some_publication;\n"); . "CREATE PUBLICATION some_publication;\n");
# Developers would not appreciate this test adding a bunch of junk to
# their ~/.psql_history, so be sure to redirect history into a temp file.
# We might as well put it in the test log directory, so that buildfarm runs
# capture the result for possible debugging purposes.
my $historyfile = "${PostgreSQL::Test::Utils::log_path}/010_psql_history.txt";
$ENV{PSQL_HISTORY} = $historyfile;
# Another pitfall for developers is that they might have a ~/.inputrc
# file that changes readline's behavior enough to affect this test.
# So ignore any such file.
$ENV{INPUTRC} = '/dev/null';
# Unset $TERM so that readline/libedit won't use any terminal-dependent
# escape sequences; that leads to way too many cross-version variations
# in the output.
delete $ENV{TERM};
# Some versions of readline inspect LS_COLORS, so for luck unset that too.
delete $ENV{LS_COLORS};
# In a VPATH build, we'll be started in the source directory, but we want # In a VPATH build, we'll be started in the source directory, but we want
# to run in the build directory so that we can use relative paths to # to run in the build directory so that we can use relative paths to
# access the tab_comp_dir subdirectory; otherwise the output from filename # access the tab_comp_dir subdirectory; otherwise the output from filename
@ -72,13 +91,8 @@ open $FH, ">", "tab_comp_dir/afile456"
print $FH "other stuff\n"; print $FH "other stuff\n";
close $FH; close $FH;
# Arrange to capture, not discard, the interactive session's history output.
# Put it in the test log directory, so that buildfarm runs capture the result
# for possible debugging purposes.
my $historyfile = "${PostgreSQL::Test::Utils::log_path}/010_psql_history.txt";
# fire up an interactive psql session # fire up an interactive psql session
my $h = $node->interactive_psql('postgres', history_file => $historyfile); my $h = $node->interactive_psql('postgres');
# Simple test case: type something and see if psql responds as expected # Simple test case: type something and see if psql responds as expected
sub check_completion sub check_completion

View File

@ -2128,17 +2128,14 @@ Errors occurring later are the caller's problem.
Be sure to "quit" the returned object when done with it. Be sure to "quit" the returned object when done with it.
The only extra parameter currently accepted is
=over =over
=item extra_params => ['--single-transaction'] =item extra_params => ['--single-transaction']
If given, it must be an array reference containing additional parameters to B<psql>. If given, it must be an array reference containing additional parameters to B<psql>.
=item history_file => B<path>
Cause the interactive B<psql> session to write its command history to B<path>.
If not given, the history is sent to B</dev/null>.
=back =back
This requires IO::Pty in addition to IPC::Run. This requires IO::Pty in addition to IPC::Run.
@ -2151,27 +2148,6 @@ sub interactive_psql
local %ENV = $self->_get_env(); local %ENV = $self->_get_env();
# Since the invoked psql will believe it's interactive, it will use
# readline/libedit if available. We need to adjust some environment
# settings to prevent unwanted side-effects.
# Developers would not appreciate tests adding a bunch of junk to
# their ~/.psql_history, so redirect readline history somewhere else.
# If the calling script doesn't specify anything, just bit-bucket it.
$ENV{PSQL_HISTORY} = $params{history_file} || '/dev/null';
# Another pitfall for developers is that they might have a ~/.inputrc
# file that changes readline's behavior enough to affect the test.
# So ignore any such file.
$ENV{INPUTRC} = '/dev/null';
# Unset TERM so that readline/libedit won't use any terminal-dependent
# escape sequences; that leads to way too many cross-version variations
# in the output.
delete $ENV{TERM};
# Some versions of readline inspect LS_COLORS, so for luck unset that too.
delete $ENV{LS_COLORS};
my @psql_params = ( my @psql_params = (
$self->installed_command('psql'), $self->installed_command('psql'),
'-XAt', '-d', $self->connstr($dbname)); '-XAt', '-d', $self->connstr($dbname));