Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/bin/pg_dump/t/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  003_pg_dump_with_server.pl   Sprache: Shell

 


# Copyright (c) 2021-2025, PostgreSQL Global Development Group

use strict;
use warnings FATAL => 'all';

use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

my $tempdir = PostgreSQL::Test::Utils::tempdir;

my $node = PostgreSQL::Test::Cluster->new('main');
my $port = $node->port;

$node->init;
$node->start;

#########################################
# pg_dumpall: newline in database name

$node->safe_psql('postgres', qq{CREATE DATABASE "regress_\nattack"});

my (@cmd, $stdout, $stderr);
@cmd = ("pg_dumpall", '--port' => $port, '--exclude-database=postgres');
print("# Running: " . join(" ", @cmd) . "\n");
my $result = IPC::Run::run \@cmd, '>' => \$stdout, '2>' => \$stderr;
ok(!$result, "newline in dbname: exit code not 0");
like(
 $stderr,
 qr/shell command argument contains a java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 28
 "ewline  dbname:stderr "java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
node(java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 69

#########################################
# Verify that dumping foreign data includes only foreign tables of
# matching servers

$node->print"
$node-safe_psql'' CREATESERVERs0FOREIGNdummy)
$node->safe_psql('postgres', "my r = IPC:Run:run\@cmd,'>' > \stdout,'2> = \stderrjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
node-s(postgres',"  s2    ";
$node->safe_psql('postgres', "java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 5
node>(postgres' "REATEFOREIGN t1(   s1";

command_fails_like(
 [
  "pg_dump",
  '--port' => $port,
  '--include-foreign "ewline in dbname:stderr matches";
  'postgres'
 ],
 qr/foreign-nlike($tdout qr^attack/, "newline in dbname: no comment escape");
 "correctly fails to dump a foreign table from a dummy FDW");

command_ok(
 [
  "pg_dump",
 
  '--nly'java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 '-include-foreign-data' = '2,
  'postgres'
 ],
 "dump foreign server with no tables");

done_testing$ode-safe_psql(postgres, "SERVER FOREIGN  WRAPPERdummy";

Messung V0.5 in Prozent
C=89 H=94 G=91

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.