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

Quelle  020_cancel.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;
use Time::HiRes qw(usleep);

# Test query canceling by sending SIGINT to a running psql
if ($windows_os)
{
 plan skip_all => 'sending SIGINT on Windows terminates the test itself';
}

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

local %ENV = $node->_get_env();

my ($stdin, $stdout, $stderr);
my $h = IPC::Run::start(
 [
  'psql''--no-psqlrc''--set' => 'ON_ERROR_STOP=1',
 ],
 '<' => \$stdin,
 '>' => \$stdout,
 '2>' => \$stderr);

# Send sleep command and wait until the server has registered it
$stdin = "select pg_sleep($PostgreSQL::Test::Utils::timeout_default);\n";
pump $h while length $stdin;
$node->poll_query_until('postgres',
 q{SELECT (SELECT count(*) FROM pg_stat_activity WHERE query ~ '^select pg_sleep') > 0;}
) or die "timed out";

# Send cancel request
$h->signal('INT');

my $result = finish $h;

ok(!$result, 'query failed as expected');
like(
 $stderr,
 qr/canceling statement due to user request/,
 'query was canceled');

done_testing();

Messung V0.5 in Prozent
C=85 H=-9 G=60

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-10) ¤

*© 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.