2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- MISC
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- BTREE
|
|
|
|
--
|
|
|
|
UPDATE onek
|
1997-04-27 21:28:23 +02:00
|
|
|
SET unique1 = onek.unique1 + 1;
|
2000-01-09 04:50:27 +01:00
|
|
|
UPDATE onek
|
1997-04-27 21:28:23 +02:00
|
|
|
SET unique1 = onek.unique1 - 1;
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- BTREE partial
|
|
|
|
--
|
|
|
|
-- UPDATE onek2
|
|
|
|
-- SET unique1 = onek2.unique1 + 1;
|
|
|
|
--UPDATE onek2
|
|
|
|
-- SET unique1 = onek2.unique1 - 1;
|
|
|
|
--
|
|
|
|
-- BTREE shutting out non-functional updates
|
|
|
|
--
|
|
|
|
-- the following two tests seem to take a long time on some
|
|
|
|
-- systems. This non-func update stuff needs to be examined
|
|
|
|
-- more closely. - jolly (2/22/96)
|
|
|
|
--
|
|
|
|
UPDATE tmp
|
1998-04-26 06:12:15 +02:00
|
|
|
SET stringu1 = reverse_name(onek.stringu1)
|
1997-04-27 21:28:23 +02:00
|
|
|
WHERE onek.stringu1 = 'JBAAAA' and
|
1999-02-02 04:45:56 +01:00
|
|
|
onek.stringu1 = tmp.stringu1;
|
2000-01-09 04:50:27 +01:00
|
|
|
UPDATE tmp
|
1998-04-26 06:12:15 +02:00
|
|
|
SET stringu1 = reverse_name(onek2.stringu1)
|
1997-04-27 21:28:23 +02:00
|
|
|
WHERE onek2.stringu1 = 'JCAAAA' and
|
1999-02-02 04:45:56 +01:00
|
|
|
onek2.stringu1 = tmp.stringu1;
|
2000-01-09 04:50:27 +01:00
|
|
|
DROP TABLE tmp;
|
|
|
|
--UPDATE person*
|
|
|
|
-- SET age = age + 1;
|
|
|
|
--UPDATE person*
|
|
|
|
-- SET age = age + 3
|
|
|
|
-- WHERE name = 'linda';
|
|
|
|
--
|
|
|
|
-- copy
|
|
|
|
--
|
2000-10-27 22:00:22 +02:00
|
|
|
COPY onek TO '@abs_builddir@/results/onek.data';
|
2000-01-09 04:50:27 +01:00
|
|
|
DELETE FROM onek;
|
2000-10-27 22:00:22 +02:00
|
|
|
COPY onek FROM '@abs_builddir@/results/onek.data';
|
2001-07-15 22:16:17 +02:00
|
|
|
SELECT unique1 FROM onek WHERE unique1 < 2 ORDER BY unique1;
|
2000-01-09 04:50:27 +01:00
|
|
|
unique1
|
|
|
|
---------
|
|
|
|
0
|
|
|
|
1
|
1997-04-27 21:28:23 +02:00
|
|
|
(2 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
DELETE FROM onek2;
|
2000-10-27 22:00:22 +02:00
|
|
|
COPY onek2 FROM '@abs_builddir@/results/onek.data';
|
2001-07-15 22:16:17 +02:00
|
|
|
SELECT unique1 FROM onek2 WHERE unique1 < 2 ORDER BY unique1;
|
2000-01-09 04:50:27 +01:00
|
|
|
unique1
|
|
|
|
---------
|
|
|
|
0
|
|
|
|
1
|
1997-04-27 21:28:23 +02:00
|
|
|
(2 rows)
|
|
|
|
|
2000-10-27 22:00:22 +02:00
|
|
|
COPY BINARY stud_emp TO '@abs_builddir@/results/stud_emp.data';
|
2000-01-09 04:50:27 +01:00
|
|
|
DELETE FROM stud_emp;
|
2000-10-27 22:00:22 +02:00
|
|
|
COPY BINARY stud_emp FROM '@abs_builddir@/results/stud_emp.data';
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT * FROM stud_emp;
|
|
|
|
name | age | location | salary | manager | gpa | percent
|
|
|
|
-------+-----+------------+--------+---------+-----+---------
|
|
|
|
jeff | 23 | (8,7.7) | 600 | sharon | 3.5 |
|
|
|
|
cim | 30 | (10.5,4.7) | 400 | | 3.4 |
|
|
|
|
linda | 19 | (0.9,6.1) | 100 | | 2.9 |
|
1997-04-27 21:28:23 +02:00
|
|
|
(3 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
-- COPY aggtest FROM stdin;
|
|
|
|
-- 56 7.8
|
|
|
|
-- 100 99.097
|
|
|
|
-- 0 0.09561
|
|
|
|
-- 42 324.78
|
|
|
|
-- .
|
|
|
|
-- COPY aggtest TO stdout;
|
|
|
|
--
|
|
|
|
-- inheritance stress test
|
|
|
|
--
|
|
|
|
SELECT * FROM a_star*;
|
|
|
|
class | a
|
|
|
|
-------+----
|
|
|
|
a | 1
|
|
|
|
a | 2
|
|
|
|
a |
|
|
|
|
b | 3
|
|
|
|
b | 4
|
|
|
|
b |
|
|
|
|
b |
|
|
|
|
c | 5
|
|
|
|
c | 6
|
|
|
|
c |
|
|
|
|
c |
|
|
|
|
d | 7
|
|
|
|
d | 8
|
|
|
|
d | 9
|
|
|
|
d | 10
|
|
|
|
d |
|
|
|
|
d | 11
|
|
|
|
d | 12
|
|
|
|
d | 13
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d | 14
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
e | 15
|
|
|
|
e | 16
|
|
|
|
e | 17
|
|
|
|
e |
|
|
|
|
e | 18
|
|
|
|
e |
|
|
|
|
e |
|
|
|
|
f | 19
|
|
|
|
f | 20
|
|
|
|
f | 21
|
|
|
|
f | 22
|
|
|
|
f |
|
|
|
|
f | 24
|
|
|
|
f | 25
|
|
|
|
f | 26
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f | 27
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
1997-04-27 21:28:23 +02:00
|
|
|
(50 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT *
|
1997-04-27 21:28:23 +02:00
|
|
|
FROM b_star* x
|
2000-01-09 04:50:27 +01:00
|
|
|
WHERE x.b = text 'bumble' or x.a < 3;
|
|
|
|
class | a | b
|
|
|
|
-------+---+--------
|
|
|
|
b | | bumble
|
1997-04-27 21:28:23 +02:00
|
|
|
(1 row)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT class, a
|
|
|
|
FROM c_star* x
|
|
|
|
WHERE x.c ~ text 'hi';
|
|
|
|
class | a
|
|
|
|
-------+----
|
|
|
|
c | 5
|
|
|
|
c |
|
|
|
|
d | 7
|
|
|
|
d | 8
|
|
|
|
d | 10
|
|
|
|
d |
|
|
|
|
d | 12
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
e | 15
|
|
|
|
e | 16
|
|
|
|
e |
|
|
|
|
e |
|
|
|
|
f | 19
|
|
|
|
f | 20
|
|
|
|
f | 21
|
|
|
|
f |
|
|
|
|
f | 24
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
1997-04-27 21:28:23 +02:00
|
|
|
(22 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT class, b, c
|
1997-04-27 21:28:23 +02:00
|
|
|
FROM d_star* x
|
|
|
|
WHERE x.a < 100;
|
2000-01-09 04:50:27 +01:00
|
|
|
class | b | c
|
|
|
|
-------+---------+------------
|
|
|
|
d | grumble | hi sunita
|
|
|
|
d | stumble | hi koko
|
|
|
|
d | rumble |
|
|
|
|
d | | hi kristin
|
|
|
|
d | fumble |
|
|
|
|
d | | hi avi
|
|
|
|
d | |
|
|
|
|
d | |
|
1997-04-27 21:28:23 +02:00
|
|
|
(8 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT class, c FROM e_star* x WHERE x.c NOTNULL;
|
|
|
|
class | c
|
|
|
|
-------+-------------
|
|
|
|
e | hi carol
|
|
|
|
e | hi bob
|
|
|
|
e | hi michelle
|
|
|
|
e | hi elisa
|
|
|
|
f | hi claire
|
|
|
|
f | hi mike
|
|
|
|
f | hi marcel
|
|
|
|
f | hi keith
|
|
|
|
f | hi marc
|
|
|
|
f | hi allison
|
|
|
|
f | hi jeff
|
|
|
|
f | hi carl
|
1997-04-27 21:28:23 +02:00
|
|
|
(12 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT * FROM f_star* x WHERE x.c ISNULL;
|
|
|
|
class | a | c | e | f
|
|
|
|
-------+----+---+-----+-------------------------------------------
|
|
|
|
f | 22 | | -7 | ((111,555),(222,666),(333,777),(444,888))
|
|
|
|
f | 25 | | -9 |
|
|
|
|
f | 26 | | | ((11111,33333),(22222,44444))
|
|
|
|
f | | | -11 | ((1111111,3333333),(2222222,4444444))
|
|
|
|
f | 27 | | |
|
|
|
|
f | | | -12 |
|
|
|
|
f | | | | ((11111111,33333333),(22222222,44444444))
|
|
|
|
f | | | |
|
1997-04-27 21:28:23 +02:00
|
|
|
(8 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
-- grouping and aggregation on inherited sets have been busted in the past...
|
|
|
|
SELECT sum(a) FROM a_star*;
|
|
|
|
sum
|
|
|
|
-----
|
|
|
|
355
|
1999-06-06 19:41:01 +02:00
|
|
|
(1 row)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT class, sum(a) FROM a_star* GROUP BY class;
|
|
|
|
class | sum
|
|
|
|
-------+-----
|
|
|
|
a | 3
|
|
|
|
b | 7
|
|
|
|
c | 11
|
|
|
|
d | 84
|
|
|
|
e | 66
|
|
|
|
f | 184
|
1999-06-06 19:41:01 +02:00
|
|
|
(6 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
ALTER TABLE f_star RENAME COLUMN f TO ff;
|
|
|
|
ALTER TABLE e_star* RENAME COLUMN e TO ee;
|
|
|
|
ALTER TABLE d_star* RENAME COLUMN d TO dd;
|
|
|
|
ALTER TABLE c_star* RENAME COLUMN c TO cc;
|
|
|
|
ALTER TABLE b_star* RENAME COLUMN b TO bb;
|
|
|
|
ALTER TABLE a_star* RENAME COLUMN a TO aa;
|
|
|
|
SELECT class, aa
|
1997-04-27 21:28:23 +02:00
|
|
|
FROM a_star* x
|
|
|
|
WHERE aa ISNULL;
|
2000-01-09 04:50:27 +01:00
|
|
|
class | aa
|
|
|
|
-------+----
|
|
|
|
a |
|
|
|
|
b |
|
|
|
|
b |
|
|
|
|
c |
|
|
|
|
c |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
d |
|
|
|
|
e |
|
|
|
|
e |
|
|
|
|
e |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
|
|
|
f |
|
1997-04-27 21:28:23 +02:00
|
|
|
(24 rows)
|
|
|
|
|
2000-06-10 07:19:26 +02:00
|
|
|
-- As of Postgres 7.1, ALTER implicitly recurses,
|
|
|
|
-- so this should be same as ALTER a_star*
|
2000-01-09 04:50:27 +01:00
|
|
|
ALTER TABLE a_star RENAME COLUMN aa TO foo;
|
|
|
|
SELECT class, foo
|
2000-06-10 07:19:26 +02:00
|
|
|
FROM a_star* x
|
1997-04-27 21:28:23 +02:00
|
|
|
WHERE x.foo >= 2;
|
2000-01-09 04:50:27 +01:00
|
|
|
class | foo
|
|
|
|
-------+-----
|
|
|
|
a | 2
|
2000-06-10 07:19:26 +02:00
|
|
|
b | 3
|
|
|
|
b | 4
|
|
|
|
c | 5
|
|
|
|
c | 6
|
|
|
|
d | 7
|
|
|
|
d | 8
|
|
|
|
d | 9
|
|
|
|
d | 10
|
|
|
|
d | 11
|
|
|
|
d | 12
|
|
|
|
d | 13
|
|
|
|
d | 14
|
|
|
|
e | 15
|
|
|
|
e | 16
|
|
|
|
e | 17
|
|
|
|
e | 18
|
|
|
|
f | 19
|
|
|
|
f | 20
|
|
|
|
f | 21
|
|
|
|
f | 22
|
|
|
|
f | 24
|
|
|
|
f | 25
|
|
|
|
f | 26
|
|
|
|
f | 27
|
|
|
|
(25 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
ALTER TABLE a_star RENAME COLUMN foo TO aa;
|
|
|
|
SELECT *
|
1997-04-27 21:28:23 +02:00
|
|
|
from a_star*
|
|
|
|
WHERE aa < 1000;
|
2000-01-09 04:50:27 +01:00
|
|
|
class | aa
|
|
|
|
-------+----
|
|
|
|
a | 1
|
|
|
|
a | 2
|
|
|
|
b | 3
|
|
|
|
b | 4
|
|
|
|
c | 5
|
|
|
|
c | 6
|
|
|
|
d | 7
|
|
|
|
d | 8
|
|
|
|
d | 9
|
|
|
|
d | 10
|
|
|
|
d | 11
|
|
|
|
d | 12
|
|
|
|
d | 13
|
|
|
|
d | 14
|
|
|
|
e | 15
|
|
|
|
e | 16
|
|
|
|
e | 17
|
|
|
|
e | 18
|
|
|
|
f | 19
|
|
|
|
f | 20
|
|
|
|
f | 21
|
|
|
|
f | 22
|
|
|
|
f | 24
|
|
|
|
f | 25
|
|
|
|
f | 26
|
|
|
|
f | 27
|
1997-04-27 21:28:23 +02:00
|
|
|
(26 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
ALTER TABLE f_star ADD COLUMN f int4;
|
|
|
|
UPDATE f_star SET f = 10;
|
|
|
|
ALTER TABLE e_star* ADD COLUMN e int4;
|
|
|
|
--UPDATE e_star* SET e = 42;
|
|
|
|
SELECT * FROM e_star*;
|
|
|
|
class | aa | cc | ee | e
|
|
|
|
-------+----+-------------+-----+---
|
|
|
|
e | 15 | hi carol | -1 |
|
|
|
|
e | 16 | hi bob | |
|
|
|
|
e | 17 | | -2 |
|
|
|
|
e | | hi michelle | -3 |
|
|
|
|
e | 18 | | |
|
|
|
|
e | | hi elisa | |
|
|
|
|
e | | | -4 |
|
|
|
|
f | 19 | hi claire | -5 |
|
|
|
|
f | 20 | hi mike | -6 |
|
|
|
|
f | 21 | hi marcel | |
|
|
|
|
f | 22 | | -7 |
|
|
|
|
f | | hi keith | -8 |
|
|
|
|
f | 24 | hi marc | |
|
|
|
|
f | 25 | | -9 |
|
|
|
|
f | 26 | | |
|
|
|
|
f | | hi allison | -10 |
|
|
|
|
f | | hi jeff | |
|
|
|
|
f | | | -11 |
|
|
|
|
f | 27 | | |
|
|
|
|
f | | hi carl | |
|
|
|
|
f | | | -12 |
|
|
|
|
f | | | |
|
|
|
|
f | | | |
|
1997-04-27 21:28:23 +02:00
|
|
|
(23 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
ALTER TABLE a_star* ADD COLUMN a text;
|
2002-10-21 22:31:52 +02:00
|
|
|
NOTICE: ALTER TABLE: merging definition of column "a" for child d_star
|
2000-01-09 04:50:27 +01:00
|
|
|
--UPDATE b_star*
|
|
|
|
-- SET a = text 'gazpacho'
|
|
|
|
-- WHERE aa > 4;
|
|
|
|
SELECT class, aa, a FROM a_star*;
|
|
|
|
class | aa | a
|
|
|
|
-------+----+---
|
|
|
|
a | 1 |
|
|
|
|
a | 2 |
|
|
|
|
a | |
|
|
|
|
b | 3 |
|
|
|
|
b | 4 |
|
|
|
|
b | |
|
|
|
|
b | |
|
|
|
|
c | 5 |
|
|
|
|
c | 6 |
|
|
|
|
c | |
|
|
|
|
c | |
|
|
|
|
d | 7 |
|
|
|
|
d | 8 |
|
|
|
|
d | 9 |
|
|
|
|
d | 10 |
|
|
|
|
d | |
|
|
|
|
d | 11 |
|
|
|
|
d | 12 |
|
|
|
|
d | 13 |
|
|
|
|
d | |
|
|
|
|
d | |
|
|
|
|
d | |
|
|
|
|
d | 14 |
|
|
|
|
d | |
|
|
|
|
d | |
|
|
|
|
d | |
|
|
|
|
d | |
|
|
|
|
e | 15 |
|
|
|
|
e | 16 |
|
|
|
|
e | 17 |
|
|
|
|
e | |
|
|
|
|
e | 18 |
|
|
|
|
e | |
|
|
|
|
e | |
|
|
|
|
f | 19 |
|
|
|
|
f | 20 |
|
|
|
|
f | 21 |
|
|
|
|
f | 22 |
|
|
|
|
f | |
|
|
|
|
f | 24 |
|
|
|
|
f | 25 |
|
|
|
|
f | 26 |
|
|
|
|
f | |
|
|
|
|
f | |
|
|
|
|
f | |
|
|
|
|
f | 27 |
|
|
|
|
f | |
|
|
|
|
f | |
|
|
|
|
f | |
|
|
|
|
f | |
|
1997-04-27 21:28:23 +02:00
|
|
|
(50 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- versions
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- postquel functions
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- mike does post_hacking,
|
|
|
|
-- joe and sally play basketball, and
|
|
|
|
-- everyone else does nothing.
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT p.name, name(p.hobbies) FROM ONLY person p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name
|
|
|
|
-------+-------------
|
|
|
|
mike | posthacking
|
|
|
|
joe | basketball
|
|
|
|
sally | basketball
|
1997-04-27 21:28:23 +02:00
|
|
|
(3 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- as above, but jeff also does post_hacking.
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT p.name, name(p.hobbies) FROM person* p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name
|
|
|
|
-------+-------------
|
|
|
|
mike | posthacking
|
|
|
|
joe | basketball
|
|
|
|
sally | basketball
|
|
|
|
jeff | posthacking
|
1997-04-27 21:28:23 +02:00
|
|
|
(4 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- the next two queries demonstrate how functions generate bogus duplicates.
|
|
|
|
-- this is a "feature" ..
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name
|
|
|
|
-------------+---------------
|
|
|
|
basketball | hightops
|
|
|
|
posthacking | advil
|
|
|
|
posthacking | peet's coffee
|
|
|
|
skywalking | guts
|
1997-04-27 21:28:23 +02:00
|
|
|
(4 rows)
|
|
|
|
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name
|
|
|
|
-------------+---------------
|
|
|
|
posthacking | advil
|
|
|
|
posthacking | peet's coffee
|
|
|
|
posthacking | advil
|
|
|
|
posthacking | peet's coffee
|
|
|
|
basketball | hightops
|
|
|
|
basketball | hightops
|
|
|
|
skywalking | guts
|
1997-04-27 21:28:23 +02:00
|
|
|
(7 rows)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- mike needs advil and peet's coffee,
|
|
|
|
-- joe and sally need hightops, and
|
|
|
|
-- everyone else is fine.
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
-------+-------------+---------------
|
|
|
|
mike | posthacking | advil
|
|
|
|
mike | posthacking | peet's coffee
|
|
|
|
joe | basketball | hightops
|
|
|
|
sally | basketball | hightops
|
1999-09-24 02:25:33 +02:00
|
|
|
(4 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- as above, but jeff needs advil and peet's coffee as well.
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
-------+-------------+---------------
|
|
|
|
mike | posthacking | advil
|
|
|
|
mike | posthacking | peet's coffee
|
|
|
|
joe | basketball | hightops
|
|
|
|
sally | basketball | hightops
|
|
|
|
jeff | posthacking | advil
|
|
|
|
jeff | posthacking | peet's coffee
|
1999-09-24 02:25:33 +02:00
|
|
|
(6 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
|
|
|
-- just like the last two, but make sure that the target list fixup and
|
|
|
|
-- unflattening is being done correctly.
|
|
|
|
--
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
---------------+-------+-------------
|
|
|
|
advil | mike | posthacking
|
|
|
|
peet's coffee | mike | posthacking
|
|
|
|
hightops | joe | basketball
|
|
|
|
hightops | sally | basketball
|
1999-09-24 02:25:33 +02:00
|
|
|
(4 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
---------------+-------+-------------
|
|
|
|
advil | mike | posthacking
|
|
|
|
peet's coffee | mike | posthacking
|
|
|
|
hightops | joe | basketball
|
|
|
|
hightops | sally | basketball
|
|
|
|
advil | jeff | posthacking
|
|
|
|
peet's coffee | jeff | posthacking
|
1999-09-24 02:25:33 +02:00
|
|
|
(6 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
---------------+-------------+-------
|
|
|
|
advil | posthacking | mike
|
|
|
|
peet's coffee | posthacking | mike
|
|
|
|
hightops | basketball | joe
|
|
|
|
hightops | basketball | sally
|
1999-09-24 02:25:33 +02:00
|
|
|
(4 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2002-03-21 17:02:16 +01:00
|
|
|
SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p;
|
2000-01-09 04:50:27 +01:00
|
|
|
name | name | name
|
|
|
|
---------------+-------------+-------
|
|
|
|
advil | posthacking | mike
|
|
|
|
peet's coffee | posthacking | mike
|
|
|
|
hightops | basketball | joe
|
|
|
|
hightops | basketball | sally
|
|
|
|
advil | posthacking | jeff
|
|
|
|
peet's coffee | posthacking | jeff
|
1999-09-24 02:25:33 +02:00
|
|
|
(6 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
SELECT user_relns() AS user_relns
|
1997-04-27 21:28:23 +02:00
|
|
|
ORDER BY user_relns;
|
2000-01-09 04:50:27 +01:00
|
|
|
user_relns
|
|
|
|
---------------------
|
2000-06-10 07:19:26 +02:00
|
|
|
a
|
2000-01-09 04:50:27 +01:00
|
|
|
a_star
|
|
|
|
abstime_tbl
|
|
|
|
aggtest
|
|
|
|
arrtest
|
2000-06-10 07:19:26 +02:00
|
|
|
b
|
2000-01-09 04:50:27 +01:00
|
|
|
b_star
|
|
|
|
box_tbl
|
|
|
|
bprime
|
|
|
|
bt_f8_heap
|
|
|
|
bt_i4_heap
|
|
|
|
bt_name_heap
|
|
|
|
bt_txt_heap
|
2000-06-10 07:19:26 +02:00
|
|
|
c
|
2000-01-09 04:50:27 +01:00
|
|
|
c_star
|
|
|
|
char_tbl
|
|
|
|
check2_tbl
|
|
|
|
check_seq
|
|
|
|
check_tbl
|
|
|
|
circle_tbl
|
|
|
|
city
|
|
|
|
copy_tbl
|
2000-06-10 07:19:26 +02:00
|
|
|
d
|
2000-01-09 04:50:27 +01:00
|
|
|
d_star
|
2000-09-12 07:42:20 +02:00
|
|
|
date_tbl
|
2000-01-09 04:50:27 +01:00
|
|
|
default_seq
|
|
|
|
default_tbl
|
|
|
|
defaultexpr_tbl
|
|
|
|
dept
|
|
|
|
e_star
|
|
|
|
emp
|
|
|
|
equipment_r
|
|
|
|
f_star
|
|
|
|
fast_emp4000
|
|
|
|
float4_tbl
|
|
|
|
float8_tbl
|
2001-08-28 01:23:35 +02:00
|
|
|
func_index_heap
|
2000-01-09 04:50:27 +01:00
|
|
|
hash_f8_heap
|
|
|
|
hash_i4_heap
|
|
|
|
hash_name_heap
|
|
|
|
hash_txt_heap
|
|
|
|
hobbies_r
|
|
|
|
iexit
|
|
|
|
ihighway
|
|
|
|
inet_tbl
|
|
|
|
insert_seq
|
|
|
|
insert_tbl
|
|
|
|
int2_tbl
|
|
|
|
int4_tbl
|
|
|
|
int8_tbl
|
All regression tests pass except for rules.sql (unrelated).
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:27:27 +01:00
|
|
|
interval_tbl
|
2000-01-09 04:50:27 +01:00
|
|
|
iportaltest
|
|
|
|
lseg_tbl
|
|
|
|
num_data
|
|
|
|
num_exp_add
|
|
|
|
num_exp_div
|
|
|
|
num_exp_ln
|
|
|
|
num_exp_log10
|
|
|
|
num_exp_mul
|
|
|
|
num_exp_power_10_ln
|
|
|
|
num_exp_sqrt
|
|
|
|
num_exp_sub
|
|
|
|
num_result
|
|
|
|
onek
|
|
|
|
onek2
|
|
|
|
path_tbl
|
|
|
|
person
|
|
|
|
point_tbl
|
|
|
|
polygon_tbl
|
|
|
|
ramp
|
|
|
|
random_tbl
|
|
|
|
real_city
|
|
|
|
reltime_tbl
|
|
|
|
road
|
2000-02-20 03:16:02 +01:00
|
|
|
serialtest
|
|
|
|
serialtest_f2_seq
|
2000-01-09 04:50:27 +01:00
|
|
|
shighway
|
|
|
|
slow_emp4000
|
|
|
|
street
|
|
|
|
stud_emp
|
|
|
|
student
|
|
|
|
subselect_tbl
|
|
|
|
tenk1
|
|
|
|
tenk2
|
|
|
|
text_tbl
|
2000-09-12 07:42:20 +02:00
|
|
|
time_tbl
|
All regression tests pass except for rules.sql (unrelated).
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
2000-02-16 18:27:27 +01:00
|
|
|
timestamp_tbl
|
2001-09-28 10:00:11 +02:00
|
|
|
timestamptz_tbl
|
|
|
|
timetz_tbl
|
2000-01-09 04:50:27 +01:00
|
|
|
tinterval_tbl
|
|
|
|
toyemp
|
|
|
|
varchar_tbl
|
|
|
|
xacttest
|
2001-09-28 10:00:11 +02:00
|
|
|
(93 rows)
|
1997-04-27 21:28:23 +02:00
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
|
2001-06-05 01:27:23 +02:00
|
|
|
SELECT hobbies_by_name('basketball');
|
|
|
|
hobbies_by_name
|
|
|
|
-----------------
|
|
|
|
joe
|
|
|
|
(1 row)
|
|
|
|
|
2000-01-09 04:50:27 +01:00
|
|
|
--
|
2000-11-20 21:36:57 +01:00
|
|
|
-- check that old-style C functions work properly with TOASTed values
|
|
|
|
--
|
|
|
|
create table oldstyle_test(i int4, t text);
|
|
|
|
insert into oldstyle_test values(null,null);
|
|
|
|
insert into oldstyle_test values(0,'12');
|
|
|
|
insert into oldstyle_test values(1000,'12');
|
|
|
|
insert into oldstyle_test values(0, repeat('x', 50000));
|
|
|
|
select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test;
|
|
|
|
i | length | octet_length | oldstyle_length
|
|
|
|
------+--------+--------------+-----------------
|
|
|
|
| | |
|
|
|
|
0 | 2 | 2 | 2
|
|
|
|
1000 | 2 | 2 | 1002
|
2001-11-20 23:22:24 +01:00
|
|
|
0 | 50000 | 50000 | 50000
|
2000-11-20 21:36:57 +01:00
|
|
|
(4 rows)
|
|
|
|
|
|
|
|
drop table oldstyle_test;
|
|
|
|
--
|
2000-01-09 04:50:27 +01:00
|
|
|
-- functional joins
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- instance rules
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- rewrite rules
|
|
|
|
--
|