[svn:DBD-Pg] r12602 - DBD-Pg/trunk/t

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Tue Mar 10 17:01:08 2009
New Revision: 12602

Modified:
   DBD-Pg/trunk/t/09arrays.t

Log:
Quick test for empty arrays, based on query from bug 43930.


Modified: DBD-Pg/trunk/t/09arrays.t
==============================================================================
--- DBD-Pg/trunk/t/09arrays.t	(original)
+++ DBD-Pg/trunk/t/09arrays.t	Tue Mar 10 17:01:08 2009
@@ -18,7 +18,7 @@
 if (! defined $dbh) {
 	plan skip_all => 'Connection to database failed, cannot continue testing';
 }
-plan tests => 248;
+plan tests => 250;
 
 isnt ($dbh, undef, 'Connect to database for array testing');
 
@@ -631,5 +631,17 @@
 	$sth->finish();
 }
 
+
+## Quick test of empty arrays
+my $expected = $pgversion >= 80300 ? [[[]]] : [[undef]];
+
+$t=q{Empty int array is returned properly};
+$result = $dbh->selectall_arrayref(q{SELECT array(SELECT 12345::int WHERE 1=0)::int[]});
+is_deeply ($result, $expected, $t);
+
+$t=q{Empty text array is returned properly};
+$result = $dbh->selectall_arrayref(q{SELECT array(SELECT 'empty'::text WHERE 1=0)::text[]});
+is_deeply ($result, $expected, $t);
+
 cleanup_database($dbh,'test');
 $dbh->disconnect;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.