Subject: | Make DBD::Pg test suite work on an EnterpriseDB server |
see subject:
--8<--- patch.diff
diff -purd a/t/10_pg_error_field.t b/t/10_pg_error_field.t
--- a/t/10_pg_error_field.t 2020-02-03 17:59:32.000000000 +0100
+++ b/t/10_pg_error_field.t 2020-03-23 14:50:31.611866463 +0100
@@ -41,6 +41,8 @@ like ($@, qr{Invalid error field}, $t);
my $test_table = 'dbdpg_error_field_test';
+my $pgvstring = $dbh->selectall_arrayref('SELECT VERSION()')->[0][0];
+my $source_file = $pgvstring =~ /EnterpriseDB/i ? "edb_redwood_casts.c" : "int.c";
my $fields = qq{
pg_diag_severity_nonlocalized | 100001 | undef | ERROR | ERROR | ERROR | ERROR
pg_diag_severity | 70400 | undef | ERROR | ERROR | ERROR | ERROR
@@ -57,7 +59,7 @@ pg_diag_table_name,table | 9
pg_diag_column_name,column | 90300 | undef | undef | undef | undef | undef
pg_diag_datatype_name,datatype,type | 90300 | undef | undef | undef | undef | undef
pg_diag_constraint_name,constraint | 90400 | undef | undef | undef | rainbow | undef
-pg_diag_source_file | 70400 | undef | int.c | parse_ | execMain.c | undef
+pg_diag_source_file | 70400 | undef | $source_file | parse_ | execMain.c | undef
pg_diag_source_line | 70400 | undef | number | number | number | undef
pg_diag_source_function | 70400 | undef | int4div | Column | ExecConstraints | undef
};
diff -purd a/t/dbdpg_test_setup.pl b/t/dbdpg_test_setup.pl
--- a/t/dbdpg_test_setup.pl 2020-02-03 15:47:31.000000000 +0100
+++ b/t/dbdpg_test_setup.pl 2020-03-23 14:25:59.351742962 +0100
@@ -307,7 +307,7 @@ version: $version
};
last GETHANDLE if $@; ## Fail - initdb bad
$version = 0;
- if (!defined $info or ($info !~ /Postgres/i and $info !~ /run as root/)) {
+ if (!defined $info or ($info !~ /Postgres|EnterpriseDB/i and $info !~ /run as root/)) {
if (defined $info) {
if ($info !~ /\w/) {
$@ = 'initdb not found: cannot run full tests without a Postgres database';
@@ -343,7 +343,7 @@ version: $version
$info = qx{$pg_ctl --help 2>&1};
};
last GETHANDLE if $@; ## Fail - pg_ctl bad
- if (!defined $info or ($info !~ /\@[a-z.-]*?postgresql\.org/ and $info !~ /run as root/)) {
+ if (!defined $info or ($info !~ /\@(?:[a-z.-]*?postgresql\.org|enterprisedb\.com)/ and $info !~ /run as root/)) {
$@ = defined $initdb ? "Bad pg_ctl output: $info" : 'Bad pg_ctl output';
last GETHANDLE; ## Fail - pg_ctl bad
}
-->8---
Linux 4.12.14-lp151.28.36-default [openSUSE Leap 15.1] HP Z600 Xeon(R) CPU E5645 @ 2.40GHz/1596(6 cores) x86_64 24075 Mb
This is perl 5, version 28, subversion 0 (v5.28.0) built for x86_64-linux-thread-multi-ld
# DBI Version 1.642
# DBD::Pg Version 3.10.4
# Perl Version 5.28.0
# OS linux
# PostgreSQL (compiled) 120203
# PostgreSQL (target) 120002
# PostgreSQL (reported) PostgreSQL 12.2 (EnterpriseDB Advanced Server 12.2.3) on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux) 4.8.5, 64-bit
# Default port 5444
# DBI_DSN dbi:Pg:db="postgres";port=5440;host=<pwd>/dbdpg_test_database/data/socket
# DBI_USER merijn
# Test schema dbd_pg_testschema
# LANG en_US.UTF-8
# array_nulls on
# backslash_quote safe_encoding
# client_encoding UTF8
# server_encoding UTF8
# standard_conforming_strings on
# Adjusted: initdb
All tests successful.
Files=17, Tests=2860, 27 wallclock secs ( 0.50 usr 0.04 sys + 6.51 cusr 0.70 csys = 7.75 CPU)
Result: PASS