Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B77A9524 for ; Wed, 9 Jan 2013 16:53:41 +0000 (UTC) Received: (qmail 47932 invoked by uid 500); 9 Jan 2013 16:53:41 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 47906 invoked by uid 500); 9 Jan 2013 16:53:41 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 47897 invoked by uid 99); 9 Jan 2013 16:53:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2013 16:53:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2013 16:53:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6820523888CD; Wed, 9 Jan 2013 16:53:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1430957 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java Date: Wed, 09 Jan 2013 16:53:20 -0000 To: derby-commits@db.apache.org From: rhillegas@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130109165320.6820523888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhillegas Date: Wed Jan 9 16:53:20 2013 New Revision: 1430957 URL: http://svn.apache.org/viewvc?rev=1430957&view=rev Log: DERBY-6036: Add a test case to verify that restrictions are pushed through views even though projections aren't. Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java?rev=1430957&r1=1430956&r2=1430957&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java Wed Jan 9 16:53:20 2013 @@ -1093,6 +1093,84 @@ public class RestrictedVTITest extends return actualTypeCount; } + /** + * Verify that if you wrap a RestrictedVTI in a view, selects + * from the view pass the restriction on to the RestrictedVTI. + * However, the projection is not passed through to the view so it + * is not passed on to the RestrictedVTI, as described on DERBY-6036. + * When that issue is addressed, we should adjust this test case. + */ + public void test_12_6036() throws Exception + { + Connection conn = getConnection(); + + goodStatement( conn, "create view v6036 as select * from table( integerList() ) s" ); + + // directly selecting from the vti pushes down both the projection and the restriction + assertResults + ( + conn, + "select s_nr from table( integerList() ) s where ns_r = 3000", + new String[][] + { + { "2000" } + }, + false + ); + assertResults + ( + conn, + "values getLastProjection()", + new String[][] + { + { "[null, S_NR, NS_R, null]" } + }, + false + ); + assertResults + ( + conn, + "values getLastRestriction()", + new String[][] + { + { "\"NS_R\" = 3000" } + }, + false + ); + + // directly selecting from the view only pushes down the restriction + assertResults + ( + conn, + "select s_nr from v6036 where ns_r = 3000", + new String[][] + { + { "2000" } + }, + false + ); + assertResults + ( + conn, + "values getLastProjection()", + new String[][] + { + { "[S_R, S_NR, NS_R, NS_NR]" } + }, + false + ); + assertResults + ( + conn, + "values getLastRestriction()", + new String[][] + { + { "\"NS_R\" = 3000" } + }, + false + ); + } + /////////////////////////////////////////////////////////////////////////////////// // // SQL ROUTINES