| 1 |
|
| 2 |
# Copyright (c) 2021-2025, PostgreSQL Global Development Group |
| 3 |
|
| 4 |
use strict; |
| 5 |
use warnings FATAL => 'all'; |
| 6 |
use PostgreSQL::Test::Utils; |
| 7 |
use Test::More; |
| 8 |
|
| 9 |
program_help_ok('ecpg'); |
| 10 |
program_version_ok('ecpg'); |
| 11 |
program_options_handling_ok('ecpg'); |
| 12 |
command_fails(['ecpg'], 'ecpg without arguments fails'); |
| 13 |
|
| 14 |
# Test that the ecpg command correctly detects unsupported or disallowed |
| 15 |
# statements in the input file and reports the appropriate error or |
| 16 |
# warning messages. |
| 17 |
command_checks_all( |
| 18 |
[ 'ecpg', 't/err_warn_msg.pgc' ], |
| 19 |
3, |
| 20 |
[qr//], |
| 21 |
[ |
| 22 |
qr/ERROR: AT option not allowed in CONNECT statement/, |
| 23 |
qr/ERROR: AT option not allowed in DISCONNECT statement/, |
| 24 |
qr/ERROR: AT option not allowed in SET CONNECTION statement/, |
| 25 |
qr/ERROR: AT option not allowed in TYPE statement/, |
| 26 |
qr/ERROR: AT option not allowed in WHENEVER statement/, |
| 27 |
qr/ERROR: AT option not allowed in VAR statement/, |
| 28 |
qr/WARNING: COPY FROM STDIN is not implemented/, |
| 29 |
qr/ERROR: using variable "cursor_var" in different declare statements is not supported/, |
| 30 |
qr/ERROR: cursor "duplicate_cursor" is already defined/, |
| 31 |
qr/ERROR: SHOW ALL is not implemented/, |
| 32 |
qr/WARNING: no longer supported LIMIT/, |
| 33 |
qr/WARNING: cursor "duplicate_cursor" has been declared but not opened/, |
| 34 |
qr/WARNING: cursor "duplicate_cursor" has been declared but not opened/, |
| 35 |
qr/WARNING: cursor ":cursor_var" has been declared but not opened/, |
| 36 |
qr/WARNING: cursor ":cursor_var" has been declared but not opened/ |
| 37 |
], |
| 38 |
'ecpg with errors and warnings'); |
| 39 |
|
| 40 |
done_testing(); |