cat > script <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
create t1 set a1, a2, a3 integer not null;
create t2 set a4, a5, a6;
create t3 set a7, a8, a9;
insert into t1 values (1, 2, 3, 4, 5, 6, 7, 8, 9);
insert into t2 values (1, 2, 3, 4, 5, 6, 7, 8, 9);
insert into t3 values (1, 2, 3, 4, 5, 6, 7, 8, 9);

create view twice (a, b, c, d, e, f, g, h, i) as select from t1, t2, t1;
select from twice;
insert into twice values (11, 12, 13, 14, 15, 16, 17, 18, 19);
update twice set to 11, 12, 13, 14, 15, 16, 17, 18, 19;
delete from twice;

create view _or_ (a, b, c, d, e, f) as select from t1, t2 where a1 = a4 or a2 = a5;
select from _or_;
insert into _or_ values (11, 12, 13, 14, 15, 16);
update _or_ set to 11, 12, 13, 14, 15, 16;
delete from _or_;

create view _not_ (a, b, c, d, e, f) as select from t1, t2 where not a1 = a4;
select from _not_;
insert into _not_ values (11, 12, 13, 14, 15, 16);
update _not_ set to 11, 12, 13, 14, 15, 16;
delete from _not_;

create view noteq (a, b, c, d, e, f) as select from t1, t2 where a1 != a4;
select from noteq;
insert into noteq values (11, 12, 13, 14, 15, 16);
update noteq set to 11, 12, 13, 14, 15, 16;
delete from noteq;

create view join1 (a, b, c, d, e, f) as select from t1, t2;
select from join1;
insert into join1 values (11, 12, 13, 14, 15, 16);
update join1 set to 11, 12, 13, 14, 15, 16;
delete from join1;

create view join2 (a, b, c, d, e, f, g, h, i) as select from t1, t2, t3
	where a1 = a4;
select from join2;
insert into join2 values (11, 12, 13, 14, 15, 16, 17, 18, 19);
update join2 set to 11, 12, 13, 14, 15, 16, 17, 18, 19;
delete from join2;

create index on t1 set a1;
create index on t2 set a4;
create view key1 (a, b, c, d, e, f) as select from t1, t2 where a1 = a4;
select from key1;
insert into key1 values (11, 12, 13, 14, 15, 16);
update key1 set to 11, 12, 13, 14, 15, 16;
delete from key1;
drop index on t1 set a1;
drop index on t2 set a4;

create unique index on t1(a1);
create unique index on t2 (a4, a6);
create view key2 (a, b, c, d, e, f) as select from t1, t2 where a1 = a4;
select from key2;
insert into key2 values (11, 12, 13, 14, 15, 16);
update key2 set to 11, 12, 13, 14, 15, 16;
delete from key2;

create view equiattr (a, b, c, d, e, f) as select from t1, t2
	where a1 = a4 and a1 = a6;
select from equiattr;
insert into equiattr values (11, 12, 13, 14, 15, 16);
update equiattr set to 11, 12, 13, 14, 15, 16;
delete from equiattr;

create view nonull (a, b, c) as select a1, a2, a5 from t1, t2
	where a1 = a4 and a1 = a6;
select from nonull;
insert into nonull values (11, 12, 13);
update nonull set to 11, 12, 13;
delete from nonull;

create unique index on t2(a5);
create view uniindex (a, b, c) as select a1, a2, a3 from t1, t2
	where a1 = a4 and a1 = a6;
select from uniindex;
insert into uniindex values (11, 12, 13);
update uniindex set to 11, 12, 13;
delete from uniindex;
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 script
cat > stdout <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* * * * * * * * *      a       b       c       d       e       f       g       h       i

     1       2       3       1       2       3       1       2       3
     1       2       3       1       2       3       4       5       6
     1       2       3       1       2       3       7       8       9
     1       2       3       4       5       6       1       2       3
     1       2       3       4       5       6       4       5       6
     1       2       3       4       5       6       7       8       9
     1       2       3       7       8       9       1       2       3
     1       2       3       7       8       9       4       5       6
     1       2       3       7       8       9       7       8       9
     4       5       6       1       2       3       1       2       3
     4       5       6       1       2       3       4       5       6
     4       5       6       1       2       3       7       8       9
     4       5       6       4       5       6       1       2       3
     4       5       6       4       5       6       4       5       6
     4       5       6       4       5       6       7       8       9
     4       5       6       7       8       9       1       2       3
     4       5       6       7       8       9       4       5       6
     4       5       6       7       8       9       7       8       9
     7       8       9       1       2       3       1       2       3
     7       8       9       1       2       3       4       5       6
     7       8       9       1       2       3       7       8       9
     7       8       9       4       5       6       1       2       3
     7       8       9       4       5       6       4       5       6
     7       8       9       4       5       6       7       8       9
     7       8       9       7       8       9       1       2       3
     7       8       9       7       8       9       4       5       6
     7       8       9       7       8       9       7       8       9
* 
*** Error: same table selected twice in view 'twice'
* 
*** Error: same table selected twice in view 'twice'
* 
*** Error: same table selected twice in view 'twice'
* * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: OR conjunction used in view '_or_'
* 
*** Error: OR conjunction used in view '_or_'
* 
*** Error: OR conjunction used in view '_or_'
* * *      a       b       c       d       e       f

     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
* 
*** Error: NOT operator used in view '_not_'
* 
*** Error: NOT operator used in view '_not_'
* 
*** Error: NOT operator used in view '_not_'
* * *      a       b       c       d       e       f

     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
* 
*** Error: join condition without '=' operator in view 'noteq'
* 
*** Error: join condition without '=' operator in view 'noteq'
* 
*** Error: join condition without '=' operator in view 'noteq'
* * *      a       b       c       d       e       f

     1       2       3       1       2       3
     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       4       5       6
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
     7       8       9       7       8       9
* 
*** Error: insufficent join conditions in view 'join1'
* 
*** Error: insufficent join conditions in view 'join1'
* 
*** Error: insufficent join conditions in view 'join1'
* * . *      a       b       c       d       e       f       g       h       i

     1       2       3       1       2       3       1       2       3
     1       2       3       1       2       3       4       5       6
     1       2       3       1       2       3       7       8       9
     4       5       6       4       5       6       1       2       3
     4       5       6       4       5       6       4       5       6
     4       5       6       4       5       6       7       8       9
     7       8       9       7       8       9       1       2       3
     7       8       9       7       8       9       4       5       6
     7       8       9       7       8       9       7       8       9
* 
*** Error: insufficent join conditions in view 'join2'
* 
*** Error: insufficent join conditions in view 'join2'
* 
*** Error: insufficent join conditions in view 'join2'
* * * * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: insufficent keys in view 'key1'
* 
*** Error: insufficent keys in view 'key1'
* 
*** Error: insufficent keys in view 'key1'
* * * * * * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: insufficent keys in view 'key2'
* 
*** Error: insufficent keys in view 'key2'
* 
*** Error: insufficent keys in view 'key2'
* * . *      a       b       c       d       e       f

* 
*** Error: repeated or equated attributes appear in view 'equiattr'
* 
*** Error: repeated or equated attributes appear in view 'equiattr'
* * * . *      a       b       c

* 
*** Error: cannot obtain value for 'not null' attribute in view 'nonull'
* * * * * . *      a       b       c

* 
*** Error: cannot obtain value for 'uniquely indexed' attribute in view 'uniindex'
* * * 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout
cat > tag <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
Test all kind of conditions for delete, update and insert on view.
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 tag
cat > stdout.jp_euc <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* * * * * * * * *      a       b       c       d       e       f       g       h       i

     1       2       3       1       2       3       1       2       3
     1       2       3       1       2       3       4       5       6
     1       2       3       1       2       3       7       8       9
     1       2       3       4       5       6       1       2       3
     1       2       3       4       5       6       4       5       6
     1       2       3       4       5       6       7       8       9
     1       2       3       7       8       9       1       2       3
     1       2       3       7       8       9       4       5       6
     1       2       3       7       8       9       7       8       9
     4       5       6       1       2       3       1       2       3
     4       5       6       1       2       3       4       5       6
     4       5       6       1       2       3       7       8       9
     4       5       6       4       5       6       1       2       3
     4       5       6       4       5       6       4       5       6
     4       5       6       4       5       6       7       8       9
     4       5       6       7       8       9       1       2       3
     4       5       6       7       8       9       4       5       6
     4       5       6       7       8       9       7       8       9
     7       8       9       1       2       3       1       2       3
     7       8       9       1       2       3       4       5       6
     7       8       9       1       2       3       7       8       9
     7       8       9       4       5       6       1       2       3
     7       8       9       4       5       6       4       5       6
     7       8       9       4       5       6       7       8       9
     7       8       9       7       8       9       1       2       3
     7       8       9       7       8       9       4       5       6
     7       8       9       7       8       9       7       8       9
* 
*** Error: VIEW 'twice' ˡƱơ֥뤬ʣꤵƤޤ
* 
*** Error: VIEW 'twice' ˡƱơ֥뤬ʣꤵƤޤ
* 
*** Error: VIEW 'twice' ˡƱơ֥뤬ʣꤵƤޤ
* * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: VIEW '_or_' ˡOR ʸޤ
* 
*** Error: VIEW '_or_' ˡOR ʸޤ
* 
*** Error: VIEW '_or_' ˡOR ʸޤ
* * *      a       b       c       d       e       f

     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
* 
*** Error: VIEW '_not_' ˡNOT ꤵƤޤ
* 
*** Error: VIEW '_not_' ˡNOT ꤵƤޤ
* 
*** Error: VIEW '_not_' ˡNOT ꤵƤޤ
* * *      a       b       c       d       e       f

     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
* 
*** Error: VIEW 'noteq' ˡ'=' ʤ JOIN ͭޤ
* 
*** Error: VIEW 'noteq' ˡ'=' ʤ JOIN ͭޤ
* 
*** Error: VIEW 'noteq' ˡ'=' ʤ JOIN ͭޤ
* * *      a       b       c       d       e       f

     1       2       3       1       2       3
     1       2       3       4       5       6
     1       2       3       7       8       9
     4       5       6       1       2       3
     4       5       6       4       5       6
     4       5       6       7       8       9
     7       8       9       1       2       3
     7       8       9       4       5       6
     7       8       9       7       8       9
* 
*** Error: VIEW 'join1' ˻ꤵ줿 JOINT ԽʬǤ
* 
*** Error: VIEW 'join1' ˻ꤵ줿 JOINT ԽʬǤ
* 
*** Error: VIEW 'join1' ˻ꤵ줿 JOINT ԽʬǤ
* * . *      a       b       c       d       e       f       g       h       i

     1       2       3       1       2       3       1       2       3
     1       2       3       1       2       3       4       5       6
     1       2       3       1       2       3       7       8       9
     4       5       6       4       5       6       1       2       3
     4       5       6       4       5       6       4       5       6
     4       5       6       4       5       6       7       8       9
     7       8       9       7       8       9       1       2       3
     7       8       9       7       8       9       4       5       6
     7       8       9       7       8       9       7       8       9
* 
*** Error: VIEW 'join2' ˻ꤵ줿 JOINT ԽʬǤ
* 
*** Error: VIEW 'join2' ˻ꤵ줿 JOINT ԽʬǤ
* 
*** Error: VIEW 'join2' ˻ꤵ줿 JOINT ԽʬǤ
* * * * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: VIEW 'key1' Υ̵Ǥ
* 
*** Error: VIEW 'key1' Υ̵Ǥ
* 
*** Error: VIEW 'key1' Υ̵Ǥ
* * * * * * *      a       b       c       d       e       f

     1       2       3       1       2       3
     4       5       6       4       5       6
     7       8       9       7       8       9
* 
*** Error: VIEW 'key2' Υ̵Ǥ
* 
*** Error: VIEW 'key2' Υ̵Ǥ
* 
*** Error: VIEW 'key2' Υ̵Ǥ
* * . *      a       b       c       d       e       f

* 
*** Error: VIEW 'equiattr' Ʊȥӥ塼̾ꤵƤޤ
* 
*** Error: VIEW 'equiattr' Ʊȥӥ塼̾ꤵƤޤ
* * * . *      a       b       c

* 
*** Error: VIEW 'nonull' ˡ'not null' ȥӥ塼ϤǤޤ
* * * * * . *      a       b       c

* 
*** Error: VIEW 'uniindex' ˡ'unique index' ȥӥ塼ϤǤޤ
* * * 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout.jp_euc
