Subject: | DBD-Pg 3.74 table_info test fails on non-empty database |
Date: | Tue, 4 Dec 2018 16:07:34 +0000 |
To: | "bug-DBD-Pg [...] rt.cpan.org" <bug-DBD-Pg [...] rt.cpan.org> |
From: | "Buchanan, Matt" <Matthew.Buchanan [...] Mercy.Net> |
When running "make test" on DBD-Pg 3.74 against a database that contains schemas other than those created by the test cases, the 'DB handle method "table_info" returns proper TABLE_NAME' fails. More specifically, it fails when there exist tables in schemas that sort before "dbd_pg_testschema", like "a.test". The test succeeds when I run it on a newly-created database, or when I rename the existing schema "a" to "x" so it sorts after "dbd_pg_testschema."
Distribution: DBD-Pg-3.7.4
Perl version: This is perl 5, version 24, subversion 4 (v5.24.4) built for OpenBSD.amd64-openbsd-thread-multi
Operating system: OpenBSD hnab.example.com 6.4 GENERIC.MP#1 amd64
Diff that fixes the problem:
==========================================================
--- t/03dbmethod.t.orig Sat Jan 27 21:09:38 2018
+++ t/03dbmethod.t Tue Dec 4 09:26:00 2018
@@ -502,7 +502,7 @@
ok ($number, $t);
$t=q{DB handle method "table_info" works when called with a 'TABLE' last argument};
-$sth = $dbh->table_info( '', '', '', q{'TABLE'});
+$sth = $dbh->table_info( '', $schema, '', q{'TABLE'});
# Check required minimum fields
$t='DB handle method "table_info" returns fields required by DBI';
==========================================================
Output of failed "make test":
==========================================================
DBD-Pg-3.7.4$ export DBI_DSN=dbi:Pg:dbname=testdb
DBD-Pg-3.7.4$ export DBI_USER=dbdpg
DBD-Pg-3.7.4$ export DBI_PASS=dbdpg
DBD-Pg-3.7.4$ make test
Running Mkbootstrap for DBD::Pg ()
chmod 644 "Pg.bs"
PGINITDB="/usr/local/pgsql-11.1/bin/initdb" PERL_DL_NONLAZY=1 "/usr/local/perl5/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test
t/00basic.t ......... ok
t/01connect.t ....... 1/15 #
# DBI Version 1.642
# DBD::Pg Version 3.7.4
# Perl Version 5.24.4
# OS openbsd
# PostgreSQL (compiled) 110001
# PostgreSQL (target) 110001
# PostgreSQL (reported) PostgreSQL 11.1 on x86_64-unknown-openbsd6.4, compiled by gcc (GCC) 4.2.1 20070719 , 64-bit
# Default port 5432
# DBI_DSN dbi:Pg:db="testdb"
# DBI_USER dbdpg
# Test schema dbd_pg_testschema
# array_nulls on
# backslash_quote safe_encoding
# client_encoding UTF8
# server_encoding SQL_ASCII
# standard_conforming_strings on
t/01connect.t ....... ok
t/01constants.t ..... ok
t/02attribs.t ....... ok
t/03dbmethod.t ...... 94/562
# Failed test 'DB handle method "table_info" returns proper TABLE_NAME'
# at t/03dbmethod.t line 522.
# got: 'crmtimer_log'
# expected: 'dbd_pg_test'
t/03dbmethod.t ...... 274/562 # Looks like you failed 1 test of 562.
t/03dbmethod.t ...... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/562 subtests
(less 6 skipped subtests: 555 okay)
t/03smethod.t ....... ok
t/04misc.t .......... ok
t/06bytea.t ......... ok
t/07copy.t .......... ok
t/08async.t ......... ok
t/09arrays.t ........ ok
t/12placeholders.t .. ok
t/20savepoints.t .... ok
t/30unicode.t ....... ok
t/99cleanup.t ....... ok
Test Summary Report
-------------------
t/03dbmethod.t (Wstat: 256 Tests: 562 Failed: 1)
Failed test: 98
Non-zero exit status: 1
Files=16, Tests=1941, 28 wallclock secs ( 0.36 usr 0.18 sys + 5.28 cusr 1.05 csys = 6.87 CPU)
Result: FAIL
Failed 1/16 test programs. 1/1941 subtests failed.
*** Error 255 in .../DBD-Pg-3.7.4 (Makefile:964 'test_dynamic')
==========================================================
Schemas in the database:
==========================================================
testdb=# \dn
List of schemas
Name | Owner
-----------+-------------
crm | mbb
dbdpg | dbdpg
<16 more schemas snipped>
testdb=# \dt crm.*
List of relations
Schema | Name | Type | Owner
--------+--------------+-------+-------
crm | crmtimer_log | table | mbb
(1 row)
==========================================================
Output of successful "make test":
==========================================================
DBD-Pg-3.7.4$ createdb dbddb
DBD-Pg-3.7.4$ export DBI_DSN=dbi:Pg:dbname=dbddb
DBD-Pg-3.7.4$ make test
PGINITDB="/usr/local/pgsql-11.1/bin/initdb" PERL_DL_NONLAZY=1 "/usr/local/perl5/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test
t/00basic.t ......... ok
t/01connect.t ....... 1/15 #
# DBI Version 1.642
# DBD::Pg Version 3.7.4
# Perl Version 5.24.4
# OS openbsd
# PostgreSQL (compiled) 110001
# PostgreSQL (target) 110001
# PostgreSQL (reported) PostgreSQL 11.1 on x86_64-unknown-openbsd6.4, compiled by gcc (GCC) 4.2.1 20070719 , 64-bit
# Default port 5432
# DBI_DSN dbi:Pg:db="dbddb"
# DBI_USER dbdpg
# Test schema dbd_pg_testschema
# array_nulls on
# backslash_quote safe_encoding
# client_encoding UTF8
# server_encoding SQL_ASCII
# standard_conforming_strings on
t/01connect.t ....... ok
t/01constants.t ..... ok
t/02attribs.t ....... ok
t/03dbmethod.t ...... ok
t/03smethod.t ....... ok
t/04misc.t .......... ok
t/06bytea.t ......... ok
t/07copy.t .......... ok
t/08async.t ......... ok
t/09arrays.t ........ ok
t/12placeholders.t .. ok
t/20savepoints.t .... ok
t/30unicode.t ....... ok
t/99cleanup.t ....... ok
All tests successful.
Files=16, Tests=1941, 25 wallclock secs ( 0.35 usr 0.11 sys + 5.46 cusr 1.19 csys = 7.11 CPU)
Result: PASS
==========================================================
This electronic mail and any attached documents are intended solely for the named addressee(s) and contain confidential information. If you are not an addressee, or responsible for delivering this email to an addressee, you have received this email in error and are notified that reading, copying, or disclosing this email is prohibited. If you received this email in error, immediately reply to the sender and delete the message completely from your computer system.