8 SET unique1 = onek.unique1 + 1;
10 SET unique1 = onek.unique1 - 1;
15 -- SET unique1 = onek2.unique1 + 1;
17 -- SET unique1 = onek2.unique1 - 1;
19 -- BTREE shutting out non-functional updates
21 -- the following two tests seem to take a long time on some
22 -- systems. This non-func update stuff needs to be examined
23 -- more closely. - jolly (2/22/96)
26 SET stringu1 = reverse_name(onek.stringu1)
28 WHERE onek.stringu1 = 'JBAAAA' and
29 onek.stringu1 = tmp.stringu1;
31 SET stringu1 = reverse_name(onek2.stringu1)
33 WHERE onek2.stringu1 = 'JCAAAA' and
34 onek2.stringu1 = tmp.stringu1;
40 -- WHERE name = 'linda';
44 COPY onek TO '@abs_builddir@/results/onek.data';
46 COPY onek FROM '@abs_builddir@/results/onek.data';
47 SELECT unique1 FROM onek WHERE unique1 < 2 ORDER BY unique1;
55 COPY onek2 FROM '@abs_builddir@/results/onek.data';
56 SELECT unique1 FROM onek2 WHERE unique1 < 2 ORDER BY unique1;
63 COPY BINARY stud_emp TO '@abs_builddir@/results/stud_emp.data';
65 COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data';
66 SELECT * FROM stud_emp;
67 name | age | location | salary | manager | gpa | percent
68 -------+-----+------------+--------+---------+-----+---------
69 jeff | 23 | (8,7.7) | 600 | sharon | 3.5 |
70 cim | 30 | (10.5,4.7) | 400 | | 3.4 |
71 linda | 19 | (0.9,6.1) | 100 | | 2.9 |
74 -- COPY aggtest FROM stdin;
80 -- COPY aggtest TO stdout;
82 -- inheritance stress test
84 SELECT * FROM a_star*;
141 WHERE x.b = text 'bumble' or x.a < 3;
149 WHERE x.c ~ text 'hi';
180 -------+---------+------------
181 d | grumble | hi sunita
182 d | stumble | hi koko
191 SELECT class, c FROM e_star* x WHERE x.c NOTNULL;
193 -------+-------------
208 SELECT * FROM f_star* x WHERE x.c ISNULL;
209 class | a | c | e | f
210 -------+----+---+-----+-------------------------------------------
211 f | 22 | | -7 | ((111,555),(222,666),(333,777),(444,888))
213 f | 26 | | | ((11111,33333),(22222,44444))
214 f | | | -11 | ((1111111,3333333),(2222222,4444444))
217 f | | | | ((11111111,33333333),(22222222,44444444))
221 -- grouping and aggregation on inherited sets have been busted in the past...
222 SELECT sum(a) FROM a_star*;
228 SELECT class, sum(a) FROM a_star* GROUP BY class ORDER BY class;
239 ALTER TABLE f_star RENAME COLUMN f TO ff;
240 ALTER TABLE e_star* RENAME COLUMN e TO ee;
241 ALTER TABLE d_star* RENAME COLUMN d TO dd;
242 ALTER TABLE c_star* RENAME COLUMN c TO cc;
243 ALTER TABLE b_star* RENAME COLUMN b TO bb;
244 ALTER TABLE a_star* RENAME COLUMN a TO aa;
276 -- As of Postgres 7.1, ALTER implicitly recurses,
277 -- so this should be same as ALTER a_star*
278 ALTER TABLE a_star RENAME COLUMN aa TO foo;
311 ALTER TABLE a_star RENAME COLUMN foo TO aa;
345 ALTER TABLE f_star ADD COLUMN f int4;
346 UPDATE f_star SET f = 10;
347 ALTER TABLE e_star* ADD COLUMN e int4;
348 --UPDATE e_star* SET e = 42;
349 SELECT * FROM e_star*;
350 class | aa | cc | ee | e
351 -------+----+-------------+-----+---
352 e | 15 | hi carol | -1 |
355 e | | hi michelle | -3 |
359 f | 19 | hi claire | -5 |
360 f | 20 | hi mike | -6 |
361 f | 21 | hi marcel | |
363 f | | hi keith | -8 |
367 f | | hi allison | -10 |
377 ALTER TABLE a_star* ADD COLUMN a text;
378 NOTICE: merging definition of column "a" for child "d_star"
380 -- SET a = text 'gazpacho'
382 SELECT class, aa, a FROM a_star*;
441 -- postquel functions
444 -- mike does post_hacking,
445 -- joe and sally play basketball, and
446 -- everyone else does nothing.
448 SELECT p.name, name(p.hobbies) FROM ONLY person p;
450 -------+-------------
457 -- as above, but jeff also does post_hacking.
459 SELECT p.name, name(p.hobbies) FROM person* p;
461 -------+-------------
469 -- the next two queries demonstrate how functions generate bogus duplicates.
470 -- this is a "feature" ..
472 SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r
475 -------------+---------------
476 basketball | hightops
478 posthacking | peet's coffee
482 SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r;
484 -------------+---------------
486 posthacking | peet's coffee
488 posthacking | peet's coffee
489 basketball | hightops
490 basketball | hightops
495 -- mike needs advil and peet's coffee,
496 -- joe and sally need hightops, and
497 -- everyone else is fine.
499 SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p;
501 -------+-------------+---------------
502 mike | posthacking | advil
503 mike | posthacking | peet's coffee
504 joe | basketball | hightops
505 sally | basketball | hightops
509 -- as above, but jeff needs advil and peet's coffee as well.
511 SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p;
513 -------+-------------+---------------
514 mike | posthacking | advil
515 mike | posthacking | peet's coffee
516 joe | basketball | hightops
517 sally | basketball | hightops
518 jeff | posthacking | advil
519 jeff | posthacking | peet's coffee
523 -- just like the last two, but make sure that the target list fixup and
524 -- unflattening is being done correctly.
526 SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p;
528 ---------------+-------+-------------
529 advil | mike | posthacking
530 peet's coffee | mike | posthacking
531 hightops | joe | basketball
532 hightops | sally | basketball
535 SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p;
537 ---------------+-------+-------------
538 advil | mike | posthacking
539 peet's coffee | mike | posthacking
540 hightops | joe | basketball
541 hightops | sally | basketball
542 advil | jeff | posthacking
543 peet's coffee | jeff | posthacking
546 SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p;
548 ---------------+-------------+-------
549 advil | posthacking | mike
550 peet's coffee | posthacking | mike
551 hightops | basketball | joe
552 hightops | basketball | sally
555 SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p;
557 ---------------+-------------+-------
558 advil | posthacking | mike
559 peet's coffee | posthacking | mike
560 hightops | basketball | joe
561 hightops | basketball | sally
562 advil | posthacking | jeff
563 peet's coffee | posthacking | jeff
566 SELECT user_relns() AS user_relns
569 ---------------------
673 SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer')));
679 SELECT hobbies_by_name('basketball');
685 SELECT name, overpaid(emp.*) FROM emp;
697 -- Try a few cases with SQL-spec row constructor expressions
699 SELECT * FROM equipment(ROW('skywalking', 'mer'));
705 SELECT name(equipment(ROW('skywalking', 'mer')));
711 SELECT *, name(equipment(h.*)) FROM hobbies_r h;
713 -------------+--------+---------------
714 posthacking | mike | advil
715 posthacking | mike | peet's coffee
716 posthacking | jeff | advil
717 posthacking | jeff | peet's coffee
718 basketball | joe | hightops
719 basketball | sally | hightops
723 SELECT *, (equipment(CAST((h.*) AS hobbies_r))).name FROM hobbies_r h;
725 -------------+--------+---------------
726 posthacking | mike | advil
727 posthacking | mike | peet's coffee
728 posthacking | jeff | advil
729 posthacking | jeff | peet's coffee
730 basketball | joe | hightops
731 basketball | sally | hightops
736 -- check that old-style C functions work properly with TOASTed values
738 create table oldstyle_test(i int4, t text);
739 insert into oldstyle_test values(null,null);
740 insert into oldstyle_test values(0,'12');
741 insert into oldstyle_test values(1000,'12');
742 insert into oldstyle_test values(0, repeat('x', 50000));
743 select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test;
744 i | length | octet_length | oldstyle_length
745 ------+--------+--------------+-----------------
749 0 | 50000 | 50000 | 50000
752 drop table oldstyle_test;