~ubuntu-branches/ubuntu/gutsy/libpgjava/gutsy

« back to all changes in this revision

Viewing changes to src/pl/tcl/test/test_queries.sql

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
insert into T_pkey1 values (1, 'key1-1', 'test key');
 
3
insert into T_pkey1 values (1, 'key1-2', 'test key');
 
4
insert into T_pkey1 values (1, 'key1-3', 'test key');
 
5
insert into T_pkey1 values (2, 'key2-1', 'test key');
 
6
insert into T_pkey1 values (2, 'key2-2', 'test key');
 
7
insert into T_pkey1 values (2, 'key2-3', 'test key');
 
8
 
 
9
insert into T_pkey2 values (1, 'key1-1', 'test key');
 
10
insert into T_pkey2 values (1, 'key1-2', 'test key');
 
11
insert into T_pkey2 values (1, 'key1-3', 'test key');
 
12
insert into T_pkey2 values (2, 'key2-1', 'test key');
 
13
insert into T_pkey2 values (2, 'key2-2', 'test key');
 
14
insert into T_pkey2 values (2, 'key2-3', 'test key');
 
15
 
 
16
select * from T_pkey1;
 
17
 
 
18
-- key2 in T_pkey2 should have upper case only
 
19
select * from T_pkey2;
 
20
 
 
21
insert into T_pkey1 values (1, 'KEY1-3', 'should work');
 
22
 
 
23
-- Due to the upper case translation in trigger this must fail
 
24
insert into T_pkey2 values (1, 'KEY1-3', 'should fail');
 
25
 
 
26
insert into T_dta1 values ('trec 1', 1, 'key1-1');
 
27
insert into T_dta1 values ('trec 2', 1, 'key1-2');
 
28
insert into T_dta1 values ('trec 3', 1, 'key1-3');
 
29
 
 
30
-- Must fail due to unknown key in T_pkey1
 
31
insert into T_dta1 values ('trec 4', 1, 'key1-4');
 
32
 
 
33
insert into T_dta2 values ('trec 1', 1, 'KEY1-1');
 
34
insert into T_dta2 values ('trec 2', 1, 'KEY1-2');
 
35
insert into T_dta2 values ('trec 3', 1, 'KEY1-3');
 
36
 
 
37
-- Must fail due to unknown key in T_pkey2
 
38
insert into T_dta2 values ('trec 4', 1, 'KEY1-4');
 
39
 
 
40
select * from T_dta1;
 
41
 
 
42
select * from T_dta2;
 
43
 
 
44
update T_pkey1 set key2 = 'key2-9' where key1 = 2 and key2 = 'key2-1';
 
45
update T_pkey1 set key2 = 'key1-9' where key1 = 1 and key2 = 'key1-1';
 
46
delete from T_pkey1 where key1 = 2 and key2 = 'key2-2';
 
47
delete from T_pkey1 where key1 = 1 and key2 = 'key1-2';
 
48
 
 
49
update T_pkey2 set key2 = 'KEY2-9' where key1 = 2 and key2 = 'KEY2-1';
 
50
update T_pkey2 set key2 = 'KEY1-9' where key1 = 1 and key2 = 'KEY1-1';
 
51
delete from T_pkey2 where key1 = 2 and key2 = 'KEY2-2';
 
52
delete from T_pkey2 where key1 = 1 and key2 = 'KEY1-2';
 
53
 
 
54
select * from T_pkey1;
 
55
select * from T_pkey2;
 
56
select * from T_dta1;
 
57
select * from T_dta2;
 
58
 
 
59
select tcl_avg(key1) from T_pkey1;
 
60
select tcl_sum(key1) from T_pkey1;
 
61
select tcl_avg(key1) from T_pkey2;
 
62
select tcl_sum(key1) from T_pkey2;
 
63
 
 
64
-- The following should return NULL instead of 0
 
65
select tcl_avg(key1) from T_pkey1 where key1 = 99;
 
66
select tcl_sum(key1) from T_pkey1 where key1 = 99;
 
67
 
 
68
select 1 @< 2;
 
69
select 100 @< 4;
 
70
 
 
71
select * from T_pkey1 order by key1 using @<, key2;
 
72
select * from T_pkey2 order by key1 using @<, key2;
 
73