-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
--
--   http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied.  See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
--=============================================================
-- TestMV517
-- ----------- 
-- SQLParser Flags tests
--=============================================================

obey TESTMV517(CLEAN_UP);
obey TESTMV517(SET_UP);

log LOGMV517 clear;

-- Run Tests

	obey TESTMV517(TEST1);
	obey TESTMV517(TEST2);
	obey TESTMV517(TEST3);

-- Clean and Exit
log;

obey TESTMV517(CLEAN_UP);
exit;

----------------------------------------------------------------
?section TEST1

-- PASS
create mv T_517_MV1
  refresh on request 
  initialize on create 
  as select count(a) as c_a
  from T_517_T1;
ALTER MV T_517_MV1 attribute all mvs allowed;

----------------------------------------------------------------
?section TEST2

insert into T_517_T1 values (1), (3);
-- PASS
refresh T_517_MV1 outfile REFRESH.LOG;
log;
sh cat REFRESH.LOG | awk -f FILTER_TIME.AWK >> LOGMV517;
log LOGMV517;

----------------------------------------------------------------
?section TEST3

insert into T_517_T1 values (5), (23);

-- Fail
internal refresh T_517_MV1 from singledelta T_517_T1 between 100 and 101 de level 0 use no rangelog use no iudlog;


-- Fail
internal refresh T_517_MV1 recompute;

set PARSERFLAGS 3;

-- PASS
internal refresh T_517_MV1 from singledelta T_517_T1 between 100 and 101 de level 0 use no rangelog use no iudlog;


-- PASS
internal refresh T_517_MV1 recompute;

----------------------------------------------------------------
?section SET_UP

set schema catmvs.mvschm;
create table T_517_T1 (a int);
ALTER TABLE T_517_T1 attribute all mvs allowed;

----------------------------------------------------------------
?section CLEAN_UP

set schema catmvs.mvschm;
drop mv T_517_MV1;
drop table T_517_T1;
