mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +03:00
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
This commit is contained in:
@@ -244,7 +244,7 @@ executeMaintenanceCommand(PGconn *conn, const char *query, bool echo)
|
||||
}
|
||||
|
||||
/*
|
||||
* Check yes/no answer in a localized way. 1=yes, 0=no, -1=neither.
|
||||
* Check yes/no answer in a localized way. 1=yes, 0=no, -1=neither.
|
||||
*/
|
||||
|
||||
/* translator: abbreviation for "yes" */
|
||||
|
@@ -310,6 +310,7 @@ main(int argc, char *argv[])
|
||||
if (roles.head != NULL)
|
||||
{
|
||||
SimpleStringListCell *cell;
|
||||
|
||||
appendPQExpBufferStr(&sql, " IN ROLE ");
|
||||
|
||||
for (cell = roles.head; cell; cell = cell->next)
|
||||
|
@@ -41,7 +41,7 @@ main(int argc, char **argv)
|
||||
|
||||
bool quiet = false;
|
||||
|
||||
PGPing rv;
|
||||
PGPing rv;
|
||||
PQconninfoOption *opts = NULL;
|
||||
PQconninfoOption *defs = NULL;
|
||||
PQconninfoOption *opt;
|
||||
|
@@ -10,9 +10,17 @@ program_options_handling_ok('clusterdb');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['clusterdb', 'postgres'], qr/statement: CLUSTER;/, 'SQL CLUSTER run');
|
||||
issues_sql_like(
|
||||
[ 'clusterdb', 'postgres' ],
|
||||
qr/statement: CLUSTER;/,
|
||||
'SQL CLUSTER run');
|
||||
|
||||
command_fails(['clusterdb', '-t', 'nonexistent', 'postgres'], 'fails with nonexistent table');
|
||||
command_fails([ 'clusterdb', '-t', 'nonexistent', 'postgres' ],
|
||||
'fails with nonexistent table');
|
||||
|
||||
psql 'postgres', 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x';
|
||||
issues_sql_like(['clusterdb', 'postgres', '-t', 'test1'], qr/statement: CLUSTER test1;/, 'cluster specific table');
|
||||
psql 'postgres',
|
||||
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x';
|
||||
issues_sql_like(
|
||||
[ 'clusterdb', 'postgres', '-t', 'test1' ],
|
||||
qr/statement: CLUSTER test1;/,
|
||||
'cluster specific table');
|
||||
|
@@ -6,4 +6,7 @@ use Test::More tests => 1;
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['clusterdb', '-a'], qr/statement: CLUSTER.*statement: CLUSTER/s, 'cluster all databases');
|
||||
issues_sql_like(
|
||||
[ 'clusterdb', '-a' ],
|
||||
qr/statement: CLUSTER.*statement: CLUSTER/s,
|
||||
'cluster all databases');
|
||||
|
@@ -10,7 +10,13 @@ program_options_handling_ok('createdb');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['createdb', 'foobar1'], qr/statement: CREATE DATABASE foobar1/, 'SQL CREATE DATABASE run');
|
||||
issues_sql_like(['createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0'], qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/, 'create database with encoding');
|
||||
issues_sql_like(
|
||||
[ 'createdb', 'foobar1' ],
|
||||
qr/statement: CREATE DATABASE foobar1/,
|
||||
'SQL CREATE DATABASE run');
|
||||
issues_sql_like(
|
||||
[ 'createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0' ],
|
||||
qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/,
|
||||
'create database with encoding');
|
||||
|
||||
command_fails(['createdb', 'foobar1'], 'fails if database already exists');
|
||||
command_fails([ 'createdb', 'foobar1' ], 'fails if database already exists');
|
||||
|
@@ -10,9 +10,15 @@ program_options_handling_ok('createlang');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
command_fails(['createlang', 'plpgsql', 'postgres'], 'fails if language already exists');
|
||||
command_fails(
|
||||
[ 'createlang', 'plpgsql', 'postgres' ],
|
||||
'fails if language already exists');
|
||||
|
||||
psql 'postgres', 'DROP EXTENSION plpgsql';
|
||||
issues_sql_like(['createlang', 'plpgsql', 'postgres'], qr/statement: CREATE EXTENSION "plpgsql"/, 'SQL CREATE EXTENSION run');
|
||||
issues_sql_like(
|
||||
[ 'createlang', 'plpgsql', 'postgres' ],
|
||||
qr/statement: CREATE EXTENSION "plpgsql"/,
|
||||
'SQL CREATE EXTENSION run');
|
||||
|
||||
command_like(['createlang', '--list', 'postgres'], qr/plpgsql/, 'list output');
|
||||
command_like([ 'createlang', '--list', 'postgres' ],
|
||||
qr/plpgsql/, 'list output');
|
||||
|
@@ -10,17 +10,21 @@ program_options_handling_ok('createuser');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['createuser', 'user1'],
|
||||
qr/statement: CREATE ROLE user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
|
||||
'SQL CREATE USER run');
|
||||
issues_sql_like(['createuser', '-L', 'role1'],
|
||||
qr/statement: CREATE ROLE role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
|
||||
'create a non-login role');
|
||||
issues_sql_like(['createuser', '-r', 'user2'],
|
||||
qr/statement: CREATE ROLE user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a CREATEROLE user');
|
||||
issues_sql_like(['createuser', '-s', 'user3'],
|
||||
qr/statement: CREATE ROLE user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a superuser');
|
||||
issues_sql_like(
|
||||
[ 'createuser', 'user1' ],
|
||||
qr/statement: CREATE ROLE user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
|
||||
'SQL CREATE USER run');
|
||||
issues_sql_like(
|
||||
[ 'createuser', '-L', 'role1' ],
|
||||
qr/statement: CREATE ROLE role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
|
||||
'create a non-login role');
|
||||
issues_sql_like(
|
||||
[ 'createuser', '-r', 'user2' ],
|
||||
qr/statement: CREATE ROLE user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a CREATEROLE user');
|
||||
issues_sql_like(
|
||||
[ 'createuser', '-s', 'user3' ],
|
||||
qr/statement: CREATE ROLE user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
|
||||
'create a superuser');
|
||||
|
||||
command_fails(['createuser', 'user1'], 'fails if role already exists');
|
||||
command_fails([ 'createuser', 'user1' ], 'fails if role already exists');
|
||||
|
@@ -11,6 +11,9 @@ my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
psql 'postgres', 'CREATE DATABASE foobar1';
|
||||
issues_sql_like(['dropdb', 'foobar1'], qr/statement: DROP DATABASE foobar1/, 'SQL DROP DATABASE run');
|
||||
issues_sql_like(
|
||||
[ 'dropdb', 'foobar1' ],
|
||||
qr/statement: DROP DATABASE foobar1/,
|
||||
'SQL DROP DATABASE run');
|
||||
|
||||
command_fails(['dropdb', 'nonexistent'], 'fails with nonexistent database');
|
||||
command_fails([ 'dropdb', 'nonexistent' ], 'fails with nonexistent database');
|
||||
|
@@ -10,6 +10,11 @@ program_options_handling_ok('droplang');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['droplang', 'plpgsql', 'postgres'], qr/statement: DROP EXTENSION "plpgsql"/, 'SQL DROP EXTENSION run');
|
||||
issues_sql_like(
|
||||
[ 'droplang', 'plpgsql', 'postgres' ],
|
||||
qr/statement: DROP EXTENSION "plpgsql"/,
|
||||
'SQL DROP EXTENSION run');
|
||||
|
||||
command_fails(['droplang', 'nonexistent', 'postgres'], 'fails with nonexistent language');
|
||||
command_fails(
|
||||
[ 'droplang', 'nonexistent', 'postgres' ],
|
||||
'fails with nonexistent language');
|
||||
|
@@ -11,6 +11,9 @@ my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
psql 'postgres', 'CREATE ROLE foobar1';
|
||||
issues_sql_like(['dropuser', 'foobar1'], qr/statement: DROP ROLE foobar1/, 'SQL DROP ROLE run');
|
||||
issues_sql_like(
|
||||
[ 'dropuser', 'foobar1' ],
|
||||
qr/statement: DROP ROLE foobar1/,
|
||||
'SQL DROP ROLE run');
|
||||
|
||||
command_fails(['dropuser', 'nonexistent'], 'fails with nonexistent user');
|
||||
command_fails([ 'dropuser', 'nonexistent' ], 'fails with nonexistent user');
|
||||
|
@@ -12,10 +12,23 @@ start_test_server $tempdir;
|
||||
|
||||
$ENV{PGOPTIONS} = '--client-min-messages=WARNING';
|
||||
|
||||
issues_sql_like(['reindexdb', 'postgres'], qr/statement: REINDEX DATABASE postgres;/, 'SQL REINDEX run');
|
||||
issues_sql_like(
|
||||
[ 'reindexdb', 'postgres' ],
|
||||
qr/statement: REINDEX DATABASE postgres;/,
|
||||
'SQL REINDEX run');
|
||||
|
||||
psql 'postgres', 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);';
|
||||
issues_sql_like(['reindexdb', 'postgres', '-t', 'test1'], qr/statement: REINDEX TABLE test1;/, 'reindex specific table');
|
||||
issues_sql_like(['reindexdb', 'postgres', '-i', 'test1x'], qr/statement: REINDEX INDEX test1x;/, 'reindex specific index');
|
||||
psql 'postgres',
|
||||
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);';
|
||||
issues_sql_like(
|
||||
[ 'reindexdb', 'postgres', '-t', 'test1' ],
|
||||
qr/statement: REINDEX TABLE test1;/,
|
||||
'reindex specific table');
|
||||
issues_sql_like(
|
||||
[ 'reindexdb', 'postgres', '-i', 'test1x' ],
|
||||
qr/statement: REINDEX INDEX test1x;/,
|
||||
'reindex specific index');
|
||||
|
||||
issues_sql_like(['reindexdb', 'postgres', '-s'], qr/statement: REINDEX SYSTEM postgres;/, 'reindex system tables');
|
||||
issues_sql_like(
|
||||
[ 'reindexdb', 'postgres', '-s' ],
|
||||
qr/statement: REINDEX SYSTEM postgres;/,
|
||||
'reindex system tables');
|
||||
|
@@ -8,4 +8,7 @@ start_test_server $tempdir;
|
||||
|
||||
$ENV{PGOPTIONS} = '--client-min-messages=WARNING';
|
||||
|
||||
issues_sql_like(['reindexdb', '-a'], qr/statement: REINDEX.*statement: REINDEX/s, 'reindex all databases');
|
||||
issues_sql_like(
|
||||
[ 'reindexdb', '-a' ],
|
||||
qr/statement: REINDEX.*statement: REINDEX/s,
|
||||
'reindex all databases');
|
||||
|
@@ -10,8 +10,23 @@ program_options_handling_ok('vacuumdb');
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['vacuumdb', 'postgres'], qr/statement: VACUUM;/, 'SQL VACUUM run');
|
||||
issues_sql_like(['vacuumdb', '-f', 'postgres'], qr/statement: VACUUM \(FULL\);/, 'vacuumdb -f');
|
||||
issues_sql_like(['vacuumdb', '-F', 'postgres'], qr/statement: VACUUM \(FREEZE\);/, 'vacuumdb -F');
|
||||
issues_sql_like(['vacuumdb', '-z', 'postgres'], qr/statement: VACUUM \(ANALYZE\);/, 'vacuumdb -z');
|
||||
issues_sql_like(['vacuumdb', '-Z', 'postgres'], qr/statement: ANALYZE;/, 'vacuumdb -z');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', 'postgres' ],
|
||||
qr/statement: VACUUM;/,
|
||||
'SQL VACUUM run');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '-f', 'postgres' ],
|
||||
qr/statement: VACUUM \(FULL\);/,
|
||||
'vacuumdb -f');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '-F', 'postgres' ],
|
||||
qr/statement: VACUUM \(FREEZE\);/,
|
||||
'vacuumdb -F');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '-z', 'postgres' ],
|
||||
qr/statement: VACUUM \(ANALYZE\);/,
|
||||
'vacuumdb -z');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '-Z', 'postgres' ],
|
||||
qr/statement: ANALYZE;/,
|
||||
'vacuumdb -z');
|
||||
|
@@ -6,4 +6,7 @@ use Test::More tests => 1;
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['vacuumdb', '-a'], qr/statement: VACUUM.*statement: VACUUM/s, 'vacuum all databases');
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '-a' ],
|
||||
qr/statement: VACUUM.*statement: VACUUM/s,
|
||||
'vacuum all databases');
|
||||
|
@@ -6,11 +6,12 @@ use Test::More tests => 1;
|
||||
my $tempdir = tempdir;
|
||||
start_test_server $tempdir;
|
||||
|
||||
issues_sql_like(['vacuumdb', '--analyze-in-stages', 'postgres'],
|
||||
qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
|
||||
issues_sql_like(
|
||||
[ 'vacuumdb', '--analyze-in-stages', 'postgres' ],
|
||||
qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
|
||||
.*statement:\ ANALYZE.*
|
||||
.*statement:\ SET\ default_statistics_target=10;\ RESET\ vacuum_cost_delay;
|
||||
.*statement:\ ANALYZE.*
|
||||
.*statement:\ RESET\ default_statistics_target;
|
||||
.*statement:\ ANALYZE/sx,
|
||||
'analyze three times');
|
||||
'analyze three times');
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
static void vacuum_one_database(const char *dbname, bool full, bool verbose,
|
||||
bool and_analyze, bool analyze_only, bool analyze_in_stages, bool freeze,
|
||||
bool and_analyze, bool analyze_only, bool analyze_in_stages, bool freeze,
|
||||
const char *table, const char *host, const char *port,
|
||||
const char *username, enum trivalue prompt_password,
|
||||
const char *progname, bool echo);
|
||||
@@ -254,7 +254,7 @@ run_vacuum_command(PGconn *conn, const char *sql, bool echo, const char *dbname,
|
||||
|
||||
static void
|
||||
vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyze,
|
||||
bool analyze_only, bool analyze_in_stages, bool freeze, const char *table,
|
||||
bool analyze_only, bool analyze_in_stages, bool freeze, const char *table,
|
||||
const char *host, const char *port,
|
||||
const char *username, enum trivalue prompt_password,
|
||||
const char *progname, bool echo)
|
||||
@@ -334,7 +334,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
|
||||
gettext_noop("Generating medium optimizer statistics (10 targets)"),
|
||||
gettext_noop("Generating default (full) optimizer statistics")
|
||||
};
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -353,7 +353,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
|
||||
|
||||
static void
|
||||
vacuum_all_databases(bool full, bool verbose, bool and_analyze, bool analyze_only,
|
||||
bool analyze_in_stages, bool freeze, const char *maintenance_db,
|
||||
bool analyze_in_stages, bool freeze, const char *maintenance_db,
|
||||
const char *host, const char *port,
|
||||
const char *username, enum trivalue prompt_password,
|
||||
const char *progname, bool echo, bool quiet)
|
||||
@@ -406,7 +406,7 @@ help(const char *progname)
|
||||
printf(_(" -z, --analyze update optimizer statistics\n"));
|
||||
printf(_(" -Z, --analyze-only only update optimizer statistics\n"));
|
||||
printf(_(" --analyze-in-stages only update optimizer statistics, in multiple\n"
|
||||
" stages for faster results\n"));
|
||||
" stages for faster results\n"));
|
||||
printf(_(" -?, --help show this help, then exit\n"));
|
||||
printf(_("\nConnection options:\n"));
|
||||
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
|
||||
|
Reference in New Issue
Block a user