internals.ps
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:626k
- n 2025 900 m 2925 900 l gs col-1 s gr
- % Polyline
- n 2475 900 m 2475 1170 l gs col-1 s gr
- % Polyline
- n 2025 675 m 2925 675 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 2250 630 m
- gs 1 -1 sc (A_Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2340 855 m
- gs 1 -1 sc (AND) col-1 sh gr
- % Polyline
- n 3060 1575 m 3960 1575 l 3960 2295 l 3060 2295 l cp gs col-1 s gr
- % Polyline
- n 3060 2025 m 3960 2025 l gs col-1 s gr
- % Polyline
- n 3510 2025 m 3510 2295 l gs col-1 s gr
- % Polyline
- n 3060 1800 m 3960 1800 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3285 1755 m
- gs 1 -1 sc (A_Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 1980 m
- gs 1 -1 sc (NOT) col-1 sh gr
- % Polyline
- n 3060 2025 m 3510 2295 l gs col-1 s gr
- % Polyline
- n 3510 2025 m 3060 2295 l gs col-1 s gr
- % Polyline
- n 3285 2970 m 4185 2970 l 4185 3690 l 3285 3690 l cp gs col-1 s gr
- % Polyline
- n 3285 3420 m 4185 3420 l gs col-1 s gr
- % Polyline
- n 3735 3420 m 3735 3690 l gs col-1 s gr
- % Polyline
- n 3285 3195 m 4185 3195 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3510 3150 m
- gs 1 -1 sc (A_Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3600 3375 m
- gs 1 -1 sc (AND) col-1 sh gr
- % Polyline
- gs clippath
- 800 2617 m 694 2680 l 758 2575 l 643 2689 l 686 2732 l cp clip
- n 1215 2160 m 675 2700 l gs col-1 s gr gr
- % arrowhead
- n 800 2617 m 694 2680 l 758 2575 l 779 2596 l 800 2617 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2122 2575 m 2185 2680 l 2080 2617 l 2194 2732 l 2237 2689 l cp clip
- n 1665 2160 m 2205 2700 l gs col-1 s gr gr
- % arrowhead
- n 2122 2575 m 2185 2680 l 2080 2617 l 2101 2596 l 2122 2575 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1579 1518 m 1462 1560 l 1546 1468 l 1411 1558 l 1444 1608 l cp clip
- n 2250 1035 m 1440 1575 l gs col-1 s gr gr
- % arrowhead
- n 1579 1518 m 1462 1560 l 1546 1468 l 1562 1493 l 1579 1518 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3411 1458 m 3494 1550 l 3378 1508 l 3513 1598 l 3546 1548 l cp clip
- n 2707 1025 m 3517 1565 l gs col-1 s gr gr
- % arrowhead
- n 3411 1458 m 3494 1550 l 3378 1508 l 3395 1483 l 3411 1458 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3765 2823 m 3735 2943 l 3705 2823 l 3705 2985 l 3765 2985 l cp clip
- n 3735 2160 m 3735 2970 l gs col-1 s gr gr
- % arrowhead
- n 3765 2823 m 3735 2943 l 3705 2823 l 3735 2823 l 3765 2823 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3095 4012 m 2989 4075 l 3053 3970 l 2938 4084 l 2981 4127 l cp clip
- n 3510 3555 m 2970 4095 l gs col-1 s gr gr
- % arrowhead
- n 3095 4012 m 2989 4075 l 3053 3970 l 3074 3991 l 3095 4012 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 4417 3970 m 4480 4075 l 4375 4012 l 4489 4127 l 4532 4084 l cp clip
- n 3960 3555 m 4500 4095 l gs col-1 s gr gr
- % arrowhead
- n 4417 3970 m 4480 4075 l 4375 4012 l 4396 3991 l 4417 3970 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 45 3555 m 1305 3555 l gs col-1 s gr
- % Polyline
- n 45 3285 m 1305 3285 l gs col-1 s gr
- % Polyline
- n 45 2700 m 1305 2700 l 1305 3825 l 45 3825 l cp gs col-1 s gr
- % Polyline
- n 1035 2925 m 1035 3825 l gs col-1 s gr
- % Polyline
- n 45 2925 m 1305 2925 l gs col-1 s gr
- % Polyline
- n 1035 3285 m 1305 3555 l gs col-1 s gr
- % Polyline
- n 1035 3555 m 1305 3285 l gs col-1 s gr
- % Polyline
- n 1305 3555 m 1035 3825 l gs col-1 s gr
- % Polyline
- n 1035 3555 m 1305 3825 l gs col-1 s gr
- % Polyline
- n 1575 3555 m 2835 3555 l gs col-1 s gr
- % Polyline
- n 1575 3285 m 2835 3285 l gs col-1 s gr
- % Polyline
- n 1575 2700 m 2835 2700 l 2835 3825 l 1575 3825 l cp gs col-1 s gr
- % Polyline
- n 2565 2925 m 2565 3825 l gs col-1 s gr
- % Polyline
- n 1575 2925 m 2835 2925 l gs col-1 s gr
- % Polyline
- n 2565 3285 m 2835 3555 l gs col-1 s gr
- % Polyline
- n 2565 3555 m 2835 3285 l gs col-1 s gr
- % Polyline
- n 2835 3555 m 2565 3825 l gs col-1 s gr
- % Polyline
- n 2565 3555 m 2835 3825 l gs col-1 s gr
- % Polyline
- n 2340 4950 m 3600 4950 l gs col-1 s gr
- % Polyline
- n 2340 4680 m 3600 4680 l gs col-1 s gr
- % Polyline
- n 2340 4095 m 3600 4095 l 3600 5220 l 2340 5220 l cp gs col-1 s gr
- % Polyline
- n 3330 4320 m 3330 5220 l gs col-1 s gr
- % Polyline
- n 2340 4320 m 3600 4320 l gs col-1 s gr
- % Polyline
- n 3330 4680 m 3600 4950 l gs col-1 s gr
- % Polyline
- n 3330 4950 m 3600 4680 l gs col-1 s gr
- % Polyline
- n 3600 4950 m 3330 5220 l gs col-1 s gr
- % Polyline
- n 3330 4950 m 3600 5220 l gs col-1 s gr
- % Polyline
- n 3870 4950 m 5130 4950 l gs col-1 s gr
- % Polyline
- n 3870 4680 m 5130 4680 l gs col-1 s gr
- % Polyline
- n 3870 4095 m 5130 4095 l 5130 5220 l 3870 5220 l cp gs col-1 s gr
- % Polyline
- n 4860 4320 m 4860 5220 l gs col-1 s gr
- % Polyline
- n 3870 4320 m 5130 4320 l gs col-1 s gr
- % Polyline
- n 4860 4680 m 5130 4950 l gs col-1 s gr
- % Polyline
- n 4860 4950 m 5130 4680 l gs col-1 s gr
- % Polyline
- n 5130 4950 m 4860 5220 l gs col-1 s gr
- % Polyline
- n 4860 4950 m 5130 5220 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 585 3150 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 315 2880 m
- gs 1 -1 sc (SeqScan (A)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2115 3150 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1845 2880 m
- gs 1 -1 sc (SeqScan (B)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2880 4545 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2610 4275 m
- gs 1 -1 sc (SeqScan (C)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4410 4545 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4140 4275 m
- gs 1 -1 sc (SeqScan (D)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 90 3465 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 90 3735 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1620 3465 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1620 3735 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2385 4860 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2385 5130 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3915 4860 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3915 5130 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- showpage
- $F2psEnd
- rs
- %%EndDocument
- @endspecial 604 2688 a(Figure)g(3.11:)j Fp(Oper)o(ator)e(tr)n(ee)h
- Ft(for)d Fl(()p Fk(A)h Fo([)f Fk(B)r Fl())p Fo(n)p
- Fl(()p Fk(C)k Fo(\)d Fk(D)q Fl())198 2864 y Ft(The)24
- b(rule)f Fr(SelectStmt)g Ft(transforms)f(the)i Fp(oper)o(ator)g(tr)n
- (ee)g Ft(b)o(uilt)f(of)g Fr(A)p 1552 2864 V 18 w(Expr)g
- Ft(nodes)h(into)f(an)198 2924 y Fp(oper)o(ator)d(tr)n(ee)g
- Ft(using)g Fr(Expr)f Ft(nodes)g(by)g(a)h(call)f(to)h(the)f(function)f
- Fr(A)p 1447 2924 V 18 w(Expr)p 1585 2924 V 18 w(to)p
- 1663 2924 V 17 w(Expr())h Ft(which)198 2984 y(additionally)13
- b(replaces)h(e)o(v)o(ery)f Fr(OR)g Ft(node)h(by)f(an)h
- Fr(AND)f Ft(node)h(and)f(vice)h(v)o(ersa.)20 b(This)14
- b(is)g(performed)e(in)198 3044 y(order)g(to)g(be)g(able)h(to)f(use)h
- (the)f(function)g Fr(cnfify())f Ft(later)h(on.)198
- 3163 y(The)j Fp(tr)o(ansformations)g Ft(follo)o(wing)e(the)h
- Fp(parser)h Ft(e)o(xpect)g(a)f Fr(SelectStmt)g Ft(node)g(to)g(be)h
- (returned)e(by)198 3223 y(the)g(rule)f Fr(SelectStmt)f
- Ft(and)i(not)f(an)h Fp(oper)o(ator)g(tr)n(ee)p Ft(.)18
- b(So)12 b(if)g(the)g(rule)h Fr(select)p 1640 3223 V 17
- w(w)p 1687 3223 V 18 w(o)p 1735 3223 V 18 w(sort)f Ft(hands)198
- 3283 y(back)h(such)h(a)f(node)g((meaning)g(that)g(the)g(query)f(did)h
- (not)g(contain)g(an)o(y)g(set)h(operations))e(we)h(just)h(ha)o(v)o(e)
- 198 3342 y(to)f(attach)h(the)g(data)f(structure)g(b)o(uilt)g(up)h(by)f
- (the)h Fr(sort)p 1171 3342 V 17 w(clause)f Ft(rule)g(and)h(are)g
- ( 02nished,)g(b)o(ut)f(when)198 3402 y(we)g(get)f(an)g
- Fp(oper)o(ator)h(tr)n(ee)g Ft(we)g(ha)o(v)o(e)g(to)f(perform)f(the)h
- (follo)o(wing)f(steps:)p eop
- %%Page: 102 102
- 102 101 bop 270 60 a Ft(102)57 b Fm(CHAPTER)14 b(3.)28
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 345 234 y Fo( 17)25 b Ft(Create)17 b(a)h( 03at)f(list)g(of)g(all)h
- Fr(SelectStmt)e Ft(nodes)i(of)f(the)g Fp(oper)o(ator)i(tr)n(ee)f
- Ft((by)f(a)g(call)h(to)f(the)395 294 y(function)8 b
- Fr(create)p 753 294 15 2 v 18 w(select)p 951 294 V 17
- w(list())p Ft())h(and)h(attach)g(the)f(list)h(to)g(the)g( 02eld)f
- Fr(unionClause)395 354 y Ft(of)i(the)i(leftmost)f Fr(SelectStmt)f
- Ft((see)i(ne)o(xt)f(step).)345 463 y Fo( 17)25 b Ft(Find)d(the)i
- (leftmost)e(leaf)h(()p Fr(SelectStmt)f Ft(node))h(of)g(the)g
- Fp(oper)o(ator)h(tr)n(ee)g Ft((this)f(is)h(auto-)395
- 523 y(matically)h(the)h( 02rst)f(member)g(of)g(the)h(abo)o(v)o(e)g
- (created)g(list)g(because)g(of)g(the)f(technique)395
- 583 y Fr(create)p 578 583 V 17 w(select)p 775 583 V 17
- w(list())12 b Ft(uses)h(to)f(create)h(the)f(list).)345
- 692 y Fo( 17)25 b Ft(Attach)e(the)g(whole)g Fp(oper)o(ator)h(tr)n(ee)g
- Ft((including)e(the)i(leftmost)e(node)h(itself))g(to)g(the)g( 02eld)
- 395 752 y Fr(intersectClause)10 b Ft(of)i(the)h(leftmost)e
- Fr(SelectStmt)h Ft(node.)345 861 y Fo( 17)25 b Ft(Attach)32
- b(the)g(data)h(structure)f(b)o(uilt)g(up)g(by)h(the)f
- Fr(sort)p 1480 861 V 18 w(clause)g Ft(rule)g(to)g(the)g( 02eld)395
- 921 y Fr(sortClause)11 b Ft(of)h(the)g(leftmost)g Fr(SelectStmt)f
- Ft(node.)345 1030 y Fo( 17)25 b Ft(Hand)16 b(back)g(the)g(leftmost)g
- Fr(SelectStmt)f Ft(node)h((with)g(the)g Fp(oper)o(ator)h(tr)n(ee)p
- Ft(,)h(the)e(list)g(of)g(all)395 1090 y Fr(SelectStmt)11
- b Ft(nodes)i(and)f(the)g Fr(sortClause)g Ft(attached)g(to)g(it).)270
- 1197 y(Figure)i(3.12)i(sho)o(ws)g(the)f( 02nal)g(data)g(structure)g
- (deri)o(v)o(ed)f(from)g(the)i Fp(oper)o(ator)g(tr)n(ee)g
- Ft(sho)o(wn)f(in)g( 02gure)270 1257 y(3.11)e(handed)f(back)g(by)h(the)
- f Fr(SelectStmt)f Ft(rule:)465 3167 y @beginspecial 145
- @llx 212 @lly 466 @urx 579 @ury 3210 @rwi @setspecial
- %%BeginDocument: figures/union_intersect_select.ps
- %Magnification: 1.05
- /$F2psDict 200 dict def
- $F2psDict begin
- $F2psDict /mtrx matrix put
- /col-1 {0 setgray} bind def
- /col0 {0.000 0.000 0.000 srgb} bind def
- /col1 {0.000 0.000 1.000 srgb} bind def
- /col2 {0.000 1.000 0.000 srgb} bind def
- /col3 {0.000 1.000 1.000 srgb} bind def
- /col4 {1.000 0.000 0.000 srgb} bind def
- /col5 {1.000 0.000 1.000 srgb} bind def
- /col6 {1.000 1.000 0.000 srgb} bind def
- /col7 {1.000 1.000 1.000 srgb} bind def
- /col8 {0.000 0.000 0.560 srgb} bind def
- /col9 {0.000 0.000 0.690 srgb} bind def
- /col10 {0.000 0.000 0.820 srgb} bind def
- /col11 {0.530 0.810 1.000 srgb} bind def
- /col12 {0.000 0.560 0.000 srgb} bind def
- /col13 {0.000 0.690 0.000 srgb} bind def
- /col14 {0.000 0.820 0.000 srgb} bind def
- /col15 {0.000 0.560 0.560 srgb} bind def
- /col16 {0.000 0.690 0.690 srgb} bind def
- /col17 {0.000 0.820 0.820 srgb} bind def
- /col18 {0.560 0.000 0.000 srgb} bind def
- /col19 {0.690 0.000 0.000 srgb} bind def
- /col20 {0.820 0.000 0.000 srgb} bind def
- /col21 {0.560 0.000 0.560 srgb} bind def
- /col22 {0.690 0.000 0.690 srgb} bind def
- /col23 {0.820 0.000 0.820 srgb} bind def
- /col24 {0.500 0.190 0.000 srgb} bind def
- /col25 {0.630 0.250 0.000 srgb} bind def
- /col26 {0.750 0.380 0.000 srgb} bind def
- /col27 {1.000 0.500 0.500 srgb} bind def
- /col28 {1.000 0.630 0.630 srgb} bind def
- /col29 {1.000 0.750 0.750 srgb} bind def
- /col30 {1.000 0.880 0.880 srgb} bind def
- /col31 {1.000 0.840 0.000 srgb} bind def
- end
- save
- 132.5 582.5 translate
- 1 -1 scale
- /cp {closepath} bind def
- /ef {eofill} bind def
- /gr {grestore} bind def
- /gs {gsave} bind def
- /sa {save} bind def
- /rs {restore} bind def
- /l {lineto} bind def
- /m {moveto} bind def
- /rm {rmoveto} bind def
- /n {newpath} bind def
- /s {stroke} bind def
- /sh {show} bind def
- /slc {setlinecap} bind def
- /slj {setlinejoin} bind def
- /slw {setlinewidth} bind def
- /srgb {setrgbcolor} bind def
- /rot {rotate} bind def
- /sc {scale} bind def
- /sd {setdash} bind def
- /ff {findfont} bind def
- /sf {setfont} bind def
- /scf {scalefont} bind def
- /sw {stringwidth} bind def
- /tr {translate} bind def
- /tnt {dup dup currentrgbcolor
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
- bind def
- /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
- 4 -2 roll mul srgb} bind def
- /DrawSplineSection {
- /y3 exch def
- /x3 exch def
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- /xa x1 x2 x1 sub 0.666667 mul add def
- /ya y1 y2 y1 sub 0.666667 mul add def
- /xb x3 x2 x3 sub 0.666667 mul add def
- /yb y3 y2 y3 sub 0.666667 mul add def
- x1 y1 lineto
- xa ya xb yb x3 y3 curveto
- } def
- /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
- /$F2psEnd {$F2psEnteredState restore end} def
- $F2psBegin
- 10 setmiterlimit
- n 0 792 m 0 0 l 612 0 l 612 792 l cp clip
- 0.06299 0.06299 sc
- 7.500 slw
- % Polyline
- n 1800 1350 m 2700 1350 l 2700 2070 l 1800 2070 l cp gs col-1 s gr
- % Polyline
- n 1800 1800 m 2700 1800 l gs col-1 s gr
- % Polyline
- n 1800 1575 m 2700 1575 l gs col-1 s gr
- % Polyline
- n 2430 1800 m 2430 2070 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 2160 1755 m
- gs 1 -1 sc (OR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2115 1530 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1980 1980 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 225 2475 m 1125 2475 l 1125 3195 l 225 3195 l cp gs col-1 s gr
- % Polyline
- n 225 2925 m 1125 2925 l gs col-1 s gr
- % Polyline
- n 225 2700 m 1125 2700 l gs col-1 s gr
- % Polyline
- n 855 2925 m 855 3195 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 540 2880 m
- gs 1 -1 sc (AND) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 540 2655 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 360 3105 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 1350 2925 m 1890 2925 l 1890 3195 l 1350 3195 l cp gs col-1 s gr
- % Polyline
- n 1620 2925 m 1620 3195 l gs col-1 s gr
- % Polyline
- n 2115 2925 m 2655 2925 l 2655 3195 l 2115 3195 l cp gs col-1 s gr
- % Polyline
- n 2385 2925 m 2385 3195 l gs col-1 s gr
- % Polyline
- n 2385 2925 m 2655 3195 l gs col-1 s gr
- % Polyline
- n 2655 2925 m 2385 3195 l gs col-1 s gr
- % Polyline
- n 2925 1800 m 3465 1800 l 3465 2070 l 2925 2070 l cp gs col-1 s gr
- % Polyline
- n 3195 1800 m 3195 2070 l gs col-1 s gr
- % Polyline
- n 3690 1800 m 4230 1800 l 4230 2070 l 3690 2070 l cp gs col-1 s gr
- % Polyline
- n 3960 1800 m 3960 2070 l gs col-1 s gr
- % Polyline
- n 3960 1800 m 4230 2070 l gs col-1 s gr
- % Polyline
- n 4230 1800 m 3960 2070 l gs col-1 s gr
- % Polyline
- gs clippath
- 3543 1905 m 3663 1935 l 3543 1965 l 3705 1965 l 3705 1905 l cp clip
- n 3330 1935 m 3690 1935 l gs col-1 s gr gr
- % arrowhead
- n 3543 1905 m 3663 1935 l 3543 1965 l 3543 1935 l 3543 1905 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1710 810 m 2250 810 l 2250 1080 l 1710 1080 l cp gs col-1 s gr
- % Polyline
- n 1980 810 m 1980 1080 l gs col-1 s gr
- % Polyline
- n 3240 810 m 3780 810 l 3780 1080 l 3240 1080 l cp gs col-1 s gr
- % Polyline
- n 3510 810 m 3510 1080 l gs col-1 s gr
- % Polyline
- n 4005 810 m 4545 810 l 4545 1080 l 4005 1080 l cp gs col-1 s gr
- % Polyline
- n 4275 810 m 4275 1080 l gs col-1 s gr
- % Polyline
- n 4275 810 m 4545 1080 l gs col-1 s gr
- % Polyline
- n 4545 810 m 4275 1080 l gs col-1 s gr
- % Polyline
- n 2475 810 m 3015 810 l 3015 1080 l 2475 1080 l cp gs col-1 s gr
- % Polyline
- n 2745 810 m 2745 1080 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 2340 420 m
- gs 1 -1 sc (SelectStmt (B)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2430 225 m
- gs 1 -1 sc (Pointer to) col-1 sh gr
- % Polyline
- n 2925 2475 m 3825 2475 l 3825 3195 l 2925 3195 l cp gs col-1 s gr
- % Polyline
- n 2925 2925 m 3825 2925 l gs col-1 s gr
- % Polyline
- n 2925 2700 m 3825 2700 l gs col-1 s gr
- % Polyline
- n 3555 2925 m 3555 3195 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3240 2880 m
- gs 1 -1 sc (NOT) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3240 2655 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3105 3105 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 4050 2925 m 4590 2925 l 4590 3195 l 4050 3195 l cp gs col-1 s gr
- % Polyline
- n 4320 2925 m 4320 3195 l gs col-1 s gr
- % Polyline
- n 4320 2925 m 4590 3195 l gs col-1 s gr
- % Polyline
- n 4590 2925 m 4320 3195 l gs col-1 s gr
- % Polyline
- n 2340 3600 m 3240 3600 l 3240 4320 l 2340 4320 l cp gs col-1 s gr
- % Polyline
- n 2340 4050 m 3240 4050 l gs col-1 s gr
- % Polyline
- n 2340 3825 m 3240 3825 l gs col-1 s gr
- % Polyline
- n 2970 4050 m 2970 4320 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 2700 4005 m
- gs 1 -1 sc (OR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2655 3780 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2520 4230 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 3465 4050 m 4005 4050 l 4005 4320 l 3465 4320 l cp gs col-1 s gr
- % Polyline
- n 3735 4050 m 3735 4320 l gs col-1 s gr
- % Polyline
- n 4230 4050 m 4770 4050 l 4770 4320 l 4230 4320 l cp gs col-1 s gr
- % Polyline
- n 4500 4050 m 4500 4320 l gs col-1 s gr
- % Polyline
- n 4500 4050 m 4770 4320 l gs col-1 s gr
- % Polyline
- n 4770 4050 m 4500 4320 l gs col-1 s gr
- % Polyline
- gs clippath
- 3318 4155 m 3438 4185 l 3318 4215 l 3480 4215 l 3480 4155 l cp clip
- n 3105 4185 m 3465 4185 l gs col-1 s gr gr
- % arrowhead
- n 3318 4155 m 3438 4185 l 3318 4215 l 3318 4185 l 3318 4155 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 4083 4155 m 4203 4185 l 4083 4215 l 4245 4215 l 4245 4155 l cp clip
- n 3870 4185 m 4230 4185 l gs col-1 s gr gr
- % arrowhead
- n 4083 4155 m 4203 4185 l 4083 4215 l 4083 4185 l 4083 4155 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1203 3030 m 1323 3060 l 1203 3090 l 1365 3090 l 1365 3030 l cp clip
- n 990 3060 m 1350 3060 l gs col-1 s gr gr
- % arrowhead
- n 1203 3030 m 1323 3060 l 1203 3090 l 1203 3060 l 1203 3030 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2778 1905 m 2898 1935 l 2778 1965 l 2940 1965 l 2940 1905 l cp clip
- n 2565 1935 m 2925 1935 l gs col-1 s gr gr
- % arrowhead
- n 2778 1905 m 2898 1935 l 2778 1965 l 2778 1935 l 2778 1905 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1968 3030 m 2088 3060 l 1968 3090 l 2130 3090 l 2130 3030 l cp clip
- n 1755 3060 m 2115 3060 l gs col-1 s gr gr
- % arrowhead
- n 1968 3030 m 2088 3060 l 1968 3090 l 1968 3060 l 1968 3030 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2328 915 m 2448 945 l 2328 975 l 2490 975 l 2490 915 l cp clip
- n 2115 945 m 2475 945 l gs col-1 s gr gr
- % arrowhead
- n 2328 915 m 2448 945 l 2328 975 l 2328 945 l 2328 915 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3858 915 m 3978 945 l 3858 975 l 4020 975 l 4020 915 l cp clip
- n 3645 945 m 4005 945 l gs col-1 s gr gr
- % arrowhead
- n 3858 915 m 3978 945 l 3858 975 l 3858 945 l 3858 915 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3093 915 m 3213 945 l 3093 975 l 3255 975 l 3255 915 l cp clip
- n 2880 945 m 3240 945 l gs col-1 s gr gr
- % arrowhead
- n 3093 915 m 3213 945 l 3093 975 l 3093 945 l 3093 915 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1563 915 m 1683 945 l 1563 975 l 1725 975 l 1725 915 l cp clip
- n 1350 945 m 1710 945 l gs col-1 s gr gr
- % arrowhead
- n 1563 915 m 1683 945 l 1563 975 l 1563 945 l 1563 915 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3903 3030 m 4023 3060 l 3903 3090 l 4065 3090 l 4065 3030 l cp clip
- n 3690 3060 m 4050 3060 l gs col-1 s gr gr
- % arrowhead
- n 3903 3030 m 4023 3060 l 3903 3090 l 3903 3060 l 3903 3030 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 225 4455 m 1485 4455 l gs col-1 s gr
- % Polyline
- n 225 4185 m 1485 4185 l gs col-1 s gr
- % Polyline
- n 225 3600 m 1485 3600 l 1485 4725 l 225 4725 l cp gs col-1 s gr
- % Polyline
- n 1215 3825 m 1215 4725 l gs col-1 s gr
- % Polyline
- n 225 3825 m 1485 3825 l gs col-1 s gr
- % Polyline
- n 1215 4185 m 1485 4455 l gs col-1 s gr
- % Polyline
- n 1215 4455 m 1485 4185 l gs col-1 s gr
- % Polyline
- n 1215 4455 m 1485 4725 l gs col-1 s gr
- % Polyline
- n 1485 4455 m 1215 4725 l gs col-1 s gr
- % Polyline
- n 2025 5580 m 3285 5580 l gs col-1 s gr
- % Polyline
- n 2025 5310 m 3285 5310 l gs col-1 s gr
- % Polyline
- n 2025 4725 m 3285 4725 l 3285 5850 l 2025 5850 l cp gs col-1 s gr
- % Polyline
- n 3015 4950 m 3015 5850 l gs col-1 s gr
- % Polyline
- n 2025 4950 m 3285 4950 l gs col-1 s gr
- % Polyline
- n 3015 5310 m 3285 5580 l gs col-1 s gr
- % Polyline
- n 3015 5580 m 3285 5310 l gs col-1 s gr
- % Polyline
- n 3015 5580 m 3285 5850 l gs col-1 s gr
- % Polyline
- n 3285 5580 m 3015 5850 l gs col-1 s gr
- % Polyline
- n 3825 5580 m 5085 5580 l gs col-1 s gr
- % Polyline
- n 3825 5310 m 5085 5310 l gs col-1 s gr
- % Polyline
- n 3825 4725 m 5085 4725 l 5085 5850 l 3825 5850 l cp gs col-1 s gr
- % Polyline
- n 4815 4950 m 4815 5850 l gs col-1 s gr
- % Polyline
- n 3825 4950 m 5085 4950 l gs col-1 s gr
- % Polyline
- n 4815 5310 m 5085 5580 l gs col-1 s gr
- % Polyline
- n 4815 5580 m 5085 5310 l gs col-1 s gr
- % Polyline
- n 4815 5580 m 5085 5850 l gs col-1 s gr
- % Polyline
- n 5085 5580 m 4815 5850 l gs col-1 s gr
- % Polyline
- n 225 1080 m 1485 1080 l gs col-1 s gr
- % Polyline
- n 225 810 m 1485 810 l gs col-1 s gr
- % Polyline
- n 225 225 m 1485 225 l 1485 1350 l 225 1350 l cp gs col-1 s gr
- % Polyline
- n 1215 450 m 1215 1350 l gs col-1 s gr
- % Polyline
- n 225 450 m 1485 450 l gs col-1 s gr
- % Open spline
- gs clippath
- 2150 1238 m 2228 1333 l 2114 1286 l 2244 1383 l 2280 1335 l cp clip
- n 1350.0 1215.0 m 1710.0 1215.0 l
- 1710.0 1215.0 2070.0 1215.0 2160.0 1282.5 DrawSplineSection
- 2250.0 1350.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2150 1238 m 2228 1333 l 2114 1286 l 2132 1262 l 2150 1238 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 996 3548 m 877 3585 l 964 3497 l 826 3583 l 858 3633 l cp clip
- n 2250.0 3060.0 m 2205.0 3195.0 l
- 2205.0 3195.0 2160.0 3330.0 1687.5 3352.5 DrawSplineSection
- 1687.5 3352.5 1215.0 3375.0 1035.0 3487.5 DrawSplineSection
- 855.0 3600.0 l gs col-1 s gr
- gr
- % arrowhead
- n 996 3548 m 877 3585 l 964 3497 l 980 3522 l 996 3548 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 840 1499 m 857 1376 l 899 1493 l 883 1332 l 824 1338 l cp clip
- n 1485.0 3060.0 m 1462.5 2722.5 l
- 1462.5 2722.5 1440.0 2385.0 1170.0 2092.5 DrawSplineSection
- 1170.0 2092.5 900.0 1800.0 877.5 1575.0 DrawSplineSection
- 855.0 1350.0 l gs col-1 s gr
- gr
- % arrowhead
- n 840 1499 m 857 1376 l 899 1493 l 870 1496 l 840 1499 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 807 2404 m 695 2457 l 769 2358 l 644 2462 l 683 2508 l cp clip
- n 3060.0 1935.0 m 3037.5 2070.0 l
- 3037.5 2070.0 3015.0 2205.0 1980.0 2227.5 DrawSplineSection
- 1980.0 2227.5 945.0 2250.0 810.0 2362.5 DrawSplineSection
- 675.0 2475.0 l gs col-1 s gr
- gr
- % arrowhead
- n 807 2404 m 695 2457 l 769 2358 l 788 2381 l 807 2404 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3487 2375 m 3391 2453 l 3439 2339 l 3342 2469 l 3390 2505 l cp clip
- n 3825.0 1935.0 m 3802.5 2070.0 l
- 3802.5 2070.0 3780.0 2205.0 3645.0 2250.0 DrawSplineSection
- 3645.0 2250.0 3510.0 2295.0 3442.5 2385.0 DrawSplineSection
- 3375.0 2475.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3487 2375 m 3391 2453 l 3439 2339 l 3463 2357 l 3487 2375 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 989 157 m 876 208 l 951 110 l 825 211 l 862 258 l cp clip
- n 1845.0 945.0 m 1845.0 630.0 l
- 1845.0 630.0 1845.0 315.0 1755.0 202.5 DrawSplineSection
- 1755.0 202.5 1665.0 90.0 1372.5 67.5 DrawSplineSection
- 1372.5 67.5 1080.0 45.0 967.5 135.0 DrawSplineSection
- 855.0 225.0 l gs col-1 s gr
- gr
- % arrowhead
- n 989 157 m 876 208 l 951 110 l 970 133 l 989 157 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2644 606 m 2731 518 l 2695 636 l 2778 498 l 2727 467 l cp clip
- n 2610.0 945.0 m 2610.0 832.5 l
- 2610.0 832.5 2610.0 720.0 2677.5 607.5 DrawSplineSection
- 2745.0 495.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2644 606 m 2731 518 l 2695 636 l 2669 621 l 2644 606 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3511 563 m 3623 511 l 3549 610 l 3675 509 l 3638 462 l cp clip
- n 3375.0 945.0 m 3397.5 810.0 l
- 3397.5 810.0 3420.0 675.0 3532.5 585.0 DrawSplineSection
- 3645.0 495.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3511 563 m 3623 511 l 3549 610 l 3530 587 l 3511 563 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 4488 527 m 4610 505 l 4513 582 l 4661 516 l 4637 461 l cp clip
- n 4140.0 945.0 m 4185.0 810.0 l
- 4185.0 810.0 4230.0 675.0 4432.5 585.0 DrawSplineSection
- 4635.0 495.0 l gs col-1 s gr
- gr
- % arrowhead
- n 4488 527 m 4610 505 l 4513 582 l 4501 555 l 4488 527 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2927 3539 m 2811 3584 l 2892 3490 l 2760 3584 l 2795 3633 l cp clip
- n 4185.0 3060.0 m 4162.5 3195.0 l
- 4162.5 3195.0 4140.0 3330.0 3622.5 3352.5 DrawSplineSection
- 3622.5 3352.5 3105.0 3375.0 2947.5 3487.5 DrawSplineSection
- 2790.0 3600.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2927 3539 m 2811 3584 l 2892 3490 l 2910 3515 l 2927 3539 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2780 4642 m 2674 4705 l 2738 4600 l 2623 4714 l 2666 4757 l cp clip
- n 3600.0 4185.0 m 3555.0 4297.5 l
- 3555.0 4297.5 3510.0 4410.0 3195.0 4455.0 DrawSplineSection
- 3195.0 4455.0 2880.0 4500.0 2767.5 4612.5 DrawSplineSection
- 2655.0 4725.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2780 4642 m 2674 4705 l 2738 4600 l 2759 4621 l 2780 4642 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 4437 4576 m 4446 4699 l 4380 4595 l 4431 4749 l 4488 4730 l cp clip
- n 4365.0 4185.0 m 4365.0 4320.0 l
- 4365.0 4320.0 4365.0 4455.0 4410.0 4590.0 DrawSplineSection
- 4455.0 4725.0 l gs col-1 s gr
- gr
- % arrowhead
- n 4437 4576 m 4446 4699 l 4380 4595 l 4409 4586 l 4437 4576 l cp gs 0.00 setgray ef gr col-1 s
- /Times-Roman ff 150.00 scf sf
- 3330 420 m
- gs 1 -1 sc (SelectStmt (C)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3420 225 m
- gs 1 -1 sc (Pointer to) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4320 420 m
- gs 1 -1 sc (SelectStmt (D)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4410 225 m
- gs 1 -1 sc (Pointer to) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 765 4050 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 405 3780 m
- gs 1 -1 sc (SelectStmt (B)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2565 5175 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2205 4905 m
- gs 1 -1 sc (SelectStmt (C)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4365 5175 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 4005 4905 m
- gs 1 -1 sc (SelectStmt (D)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 765 675 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 405 405 m
- gs 1 -1 sc (SelectStmt (A)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 990 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 1260 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 4365 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 4635 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2070 5490 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2070 5760 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3870 5490 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3870 5760 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- showpage
- $F2psEnd
- rs
- %%EndDocument
- @endspecial 537 3277 a(Figure)g(3.12:)16 b(Data)c(structure)g(handed)g
- (back)h(by)f Fr(SelectStmt)g Ft(rule)p eop
- %%Page: 103 103
- 103 102 bop 198 60 a Fm(3.8.)26 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)327
- b Ft(103)198 234 y(Here)26 b(is)g(a)g(description)g(of)f(the)h(abo)o(v)
- o(e)g(used)h(functions.)56 b(The)o(y)26 b(can)g(be)g(found)g(in)f(the)h
- ( 02le)198 294 y Fk(:)8 b(:)g(:)p Fr(/src/backend/parser/anlayze.c)p
- Ft(.)273 398 y Fo( 17)25 b Fr(create)p 506 398 15 2
- v 17 w(select)p 703 398 V 17 w(list())p Ft(:)323 457
- y(This)15 b(function)f(steps)i(through)e(the)h Fp(tr)n(ee)g
- Ft(handed)g(to)g(it)f(by)h(the)g(parameter)f Fr(ptr)h
- Ft(and)g(creates)323 517 y(a)h(list)g(of)g(all)g Fr(SelectStmt)f
- Ft(nodes)h(found.)27 b(The)17 b(list)f(is)g(handed)g(back)h(by)f(the)g
- (parameter)323 577 y Fr(select)p 506 577 V 17 w(list)p
- Ft(.)f(The)e(function)f(uses)h(a)g(recursi)o(v)o(e)f
- Fp(depth)g( 02rst)g(sear)n(c)o(h)i Ft(algorithm)d(to)h(e)o(xam-)323
- 637 y(ine)g(the)g Fp(tr)n(ee)h Ft(leading)g(to)f(the)g(fact)g(that)g
- (the)h(leftmost)e Fr(SelectStmt)h Ft(node)g(will)g(appear)g( 02rst)323
- 696 y(in)g(the)g(created)g(list.)382 821 y Fr(void)382
- 881 y(create_select_list(Node)28 b(*ptr,)h(List)g(**select_list,)950
- 941 y(bool)h(*unionall_present))382 1001 y({)442 1060
- y(if(IsA(ptr,)f(SelectStmt)))442 1120 y({)502 1180
- y(*select_list)f(=)i(lappend(*select_list,)e(ptr);)502
- 1240 y(if(((SelectStmt)g(*)ptr)->unionall)g(==)i(TRUE))562
- 1299 y(*unionall_present)e(=)h(TRUE;)502 1359 y(return;)442
- 1419 y(})442 1539 y(/*)h(Recursively)e(call)i(for)f(all)h(arguments.)
- 472 1598 y(*)g(A)g(NOT)f(expr)h(has)f(no)h(lexpr!)472
- 1658 y(*/)442 1718 y(if)g((((A_Expr)f(*)ptr)->lexpr)f(!=)i(NULL))
- 502 1778 y(create_select_list(((A_Expr)d(*)ptr)->lexpr,)1010
- 1837 y(select_list,)h(unionall_present);)442 1897 y
- (create_select_list(((A_Expr)f(*)ptr)->rexpr,)1010
- 1957 y(select_list,)h(unionall_present);)323 2017 y(})273
- 2142 y Fo( 17)d Fr(A)p 356 2142 V 17 w(Expr)p 493 2142
- V 18 w(to)p 571 2142 V 18 w(Expr())p Ft(:)323 2201
- y(This)14 b(function)e(recursi)o(v)o(ely)h(steps)h(through)e(the)i
- Fp(oper)o(ator)g(tr)n(ee)g Ft(handed)f(to)g(it)g(by)h(the)f(param-)323
- 2261 y(eter)k Fr(ptr)g Ft(and)h(replaces)g Fr(A)p 826
- 2261 V 18 w(Expr)f Ft(nodes)h(by)f Fr(Expr)h Ft(nodes.)31
- b(Additionally)17 b(it)g(e)o(xchanges)323 2321 y Fr(AND)e
- Ft(nodes)h(with)g Fr(OR)f Ft(nodes)h(and)g(vice)g(v)o(ersa.)27
- b(The)16 b(reason)g(for)f(this)h(e)o(xchange)g(is)g(easy)g(to)323
- 2381 y(understand.)27 b(W)l(e)17 b(implement)e Fp(intersect)i
- Ft(and)f Fp(e)o(xcept)h Ft(clauses)g(by)f(re)o(writing)f(these)i
- (queries)323 2441 y(to)d(semantically)h(equi)o(v)o(alent)f(queries)h
- (that)g(use)g Fr(IN)g Ft(and)g Fr(NOT)29 b(IN)15 b Ft(subselects.)25
- b(T)l(o)15 b(be)g(able)323 2500 y(to)d(use)h(all)f(three)h(operations)f
- (()p Fp(unions)p Ft(,)h Fp(intersects)g Ft(and)f Fp(e)o(xcepts)p
- Ft())h(in)f(one)h(comple)o(x)g(query)m(,)f(we)323 2560
- y(ha)o(v)o(e)18 b(to)g(translate)h(the)f(queries)g(into)g
- Fp(Disjunctive)g(Normal)h(F)-5 b(orm)19 b Ft((DNF).)f(Unfortunately)
- 323 2620 y(there)12 b(is)g(no)h(function)e Fr(dnfify())p
- Ft(,)i(b)o(ut)f(there)g(is)h(a)g(function)e Fr(cnfify())h
- Ft(which)g(produces)323 2680 y(DNF)17 b(when)g(we)h(e)o(xchange)g
- Fr(AND)g Ft(nodes)g(with)f Fr(OR)g Ft(nodes)h(and)g(vice)f(v)o(ersa)h
- (before)f(calling)323 2739 y Fr(cnfify())11 b Ft(and)h(e)o(xchange)h
- (them)f(again)g(in)h(the)f(result.)382 2864 y Fr(Node)30
- b(*)382 2924 y(A_Expr_to_Expr(Node)e(*ptr,)831 2984
- y(bool)h(*intersect_present))382 3044 y({)442 3103 y(Node)h(*result;)
- 442 3223 y(switch(nodeTag(ptr)))442 3283 y({)502
- 3342 y(case)f(T_A_Expr:)502 3402 y({)p eop
- %%Page: 104 104
- 104 103 bop 270 60 a Ft(104)60 b Fm(CHAPTER)14 b(3.)25
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 634 234 y Fr(A_Expr)29 b(*a)h(=)f((A_Expr)g(*)ptr;)634
- 354 y(switch)g((a->oper))634 413 y({)693 473 y(case)h(AND:)693
- 533 y({)753 593 y(Expr)g(*expr)f(=)h(makeNode(Expr);)753
- 653 y(Node)g(*lexpr)f(=)843 712 y(A_Expr_to_Expr(((A_Expr)e
- (*)ptr)->lexpr,)1291 772 y(intersect_present);)753
- 832 y(Node)j(*rexpr)f(=)843 892 y(A_Expr_to_Expr(((A_Expr)e
- (*)ptr)->rexpr,)1291 951 y(intersect_present);)753
- 1071 y(*intersect_present)h(=)i(TRUE;)753 1191 y(expr->typeOid)f(=)g
- (BOOLOID;)753 1250 y(expr->opType)g(=)h(OR_EXPR;)753
- 1310 y(expr->args)f(=)h(makeList(lexpr,)e(rexpr,)h(-1);)753
- 1370 y(result)g(=)h((Node)g(*))f(expr;)753 1430 y(break;)693
- 1489 y(})693 1549 y(case)h(OR:)693 1609 y({)753 1669
- y(Expr)g(*expr)f(=)h(makeNode(Expr);)753 1729 y(Node)g(*lexpr)f(=)843
- 1788 y(A_Expr_to_Expr(((A_Expr)e(*)ptr)->lexpr,)1291
- 1848 y(intersect_present);)753 1908 y(Node)j(*rexpr)f(=)843
- 1968 y(A_Expr_to_Expr(((A_Expr)e(*)ptr)->rexpr,)1291
- 2027 y(intersect_present);)753 2147 y(expr->typeOid)i(=)g(BOOLOID;)753
- 2207 y(expr->opType)g(=)h(AND_EXPR;)753 2267 y(expr->args)f(=)h
- (makeList(lexpr,)e(rexpr,)h(-1);)753 2326 y(result)g(=)h((Node)g
- (*))f(expr;)753 2386 y(break;)693 2446 y(})693 2506
- y(case)h(NOT:)693 2565 y({)753 2625 y(Expr)g(*expr)f(=)h
- (makeNode(Expr);)753 2685 y(Node)g(*rexpr)f(=)843 2745
- y(A_Expr_to_Expr(((A_Expr)e(*)ptr)->rexpr,)1291
- 2804 y(intersect_present);)753 2924 y(expr->typeOid)i(=)g(BOOLOID;)753
- 2984 y(expr->opType)g(=)h(NOT_EXPR;)753 3044 y(expr->args)f(=)h
- (makeList(rexpr,)e(-1);)753 3103 y(result)h(=)h((Node)g(*))f(expr;)
- 753 3163 y(break;)693 3223 y(})634 3283 y(})634 3342
- y(break;)574 3402 y(})p eop
- %%Page: 105 105
- 105 104 bop 198 60 a Fm(3.8.)29 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)324
- b Ft(105)502 234 y Fr(default:)502 294 y({)562 354 y(result)29
- b(=)h(ptr;)502 413 y(})442 473 y(})382 533 y(})382 593
- y(return)g(result;)323 653 y(})198 787 y Ft(Note)11 b(that)g(the)g
- Fr(stmtmulti)f Ft(and)h Fr(OptStmtMulti)f Ft(rules)h(had)g(to)g(be)g
- (changed)g(in)g(order)f(to)h(a)o(v)o(oid)198 847 y Fp(shift/r)n(educe)
- 16 b Ft(con 03icts.)26 b(The)17 b(old)e(rules)h(allo)o(wed)g(an)g(in)n
- (v)o(alid)f(syntax)h((e.g.)26 b(the)16 b(concatenation)g(of)198
- 907 y(two)c(statements)i(without)e(a)i(';')e(inbetween))h(which)g
- (will)g(be)g(pre)o(v)o(ented)g(no)o(w)m(.)k(The)d(ne)o(w)f(rules)g(ha)o
- (v)o(e)198 967 y(the)f(second)h(line)f(commented)g(out)g(as)h(sho)o(wn)
- f(belo)o(w:)258 1082 y Fr(stmtmulti)208 b(:)60 b(stmtmulti)29
- b(stmt)g(';')646 1142 y(/*)h(|)60 b(stmtmulti)29 b(stmt)g(*/)736
- 1201 y(|)60 b(stmt)29 b(';')736 1261 y(;)258 1381 y(OptStmtMulti)118
- b(:)60 b(OptStmtMulti)28 b(OptimizableStmt)g(';')646
- 1440 y(/*)i(|)60 b(OptStmtMulti)28 b(OptimizableStmt)g(*/)736
- 1500 y(|)60 b(OptimizableStmt)28 b(';')736 1560 y(;)198
- 1714 y Fn(T)l(ransf)o(ormations)198 1814 y Ft(This)17
- b(step)g(normally)f(transforms)f(e)o(v)o(ery)i Fr(SelectStmt)e
- Ft(node)i(found)f(into)g(a)g Fr(Query)h Ft(node)f(and)198
- 1874 y(does)f(a)f(lot)g(of)g(transformations)f(to)h(the)h
- Fp(tar)n(getlist)p Ft(,)g(the)f Fr(where)g Ft(quali 02cation)f(etc.)22
- b(As)15 b(mentioned)198 1934 y(abo)o(v)o(e)d(this)g(stage)g(e)o(xpects)
- g(a)g Fr(SelectStmt)f Ft(node)g(and)h(cannot)g(handle)f(an)h
- Fr(A)p 1603 1934 15 2 v 18 w(Expr)f Ft(node.)k(That')m(s)198
- 1994 y(why)d(we)h(did)f(the)g(changes)h(to)f(the)g Fp(oper)o(ator)h(tr)
- n(ee)h Ft(sho)o(wn)e(in)g( 02gure)g(3.12.)198 2113 y(In)g(this)g
- (stage)h(only)f(v)o(ery)g(fe)o(w)g(changes)h(ha)o(v)o(e)g(been)f
- (necessary:)273 2224 y Fo( 17)25 b Ft(The)13 b(transformation)e(of)h
- (the)g(list)h(attached)g(to)f Fr(unionClause)f Ft(is)i(pre)o(v)o
- (ented.)j(The)d(ra)o(w)g(list)323 2284 y(is)g(no)o(w)h(passed)g
- (through)f(instead)g(and)h(the)f(necessary)i(transformations)d(are)h
- (performed)f(at)i(a)323 2344 y(later)e(point)f(in)i(time.)273
- 2459 y Fo( 17)25 b Ft(The)20 b(additionally)e(introduced)h( 02eld)g
- Fr(intersectClause)f Ft(is)h(also)h(passed)g(untouched)323
- 2519 y(through)11 b(this)h(stage.)198 2630 y(The)29 b(changes)f
- (described)g(in)g(the)g(abo)o(v)o(e)g(paragraph)g(ha)o(v)o(e)g(been)g
- (applied)g(to)g(the)g(functions)198 2690 y Fr(transformInsertStmt())
- 17 b Ft(and)i Fr(transformSelectStmt())e Ft(which)i(are)g(contained)
- 198 2749 y(in)12 b(the)h( 02le)f Fk(:)c(:)g(:)p Fr
- (/src/backend/parser/analyze.c)p Ft(:)273 2861 y Fo( 17)25
- b Fr(transformInsertStmt())p Ft(:)382 2995 y Fr(static)30
- b(Query)f(*)382 3055 y(transformInsertStmt(ParseState)e(*pstate,)980
- 3115 y(InsertStmt)i(*stmt))382 3175 y({)1159 3235 y(.)1159
- 3294 y(.)1159 3354 y(.)p eop
- %%Page: 106 106
- 106 105 bop 270 60 a Ft(106)57 b Fm(CHAPTER)14 b(3.)28
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 514 234 y Fr(/*)30 b(Just)f(pass)h(through)f(the)g(unionClause)g(and)
- 544 294 y(*)h(intersectClause.)e(We)i(will)f(process)g(it)h(in)544
- 354 y(*)g(the)f(function)g(Except_Intersect_Rewrite())544
- 413 y(*/)514 473 y(qry->unionClause)f(=)i(stmt->unionClause;)514
- 533 y(qry->intersectClause)e(=)i(stmt->intersectClause;)1231
- 593 y(.)1231 653 y(.)1231 712 y(.)514 832 y(return)f((Query)h(*))f
- (qry;)454 892 y(})345 1043 y Fo( 17)c Fr(transformSelectStmt())p
- Ft(:)454 1180 y Fr(static)30 b(Query)f(*)454 1240 y
- (transformSelectStmt(ParseState)e(*pstate,)1052 1300
- y(SelectStmt)i(*stmt))454 1360 y({)1231 1419 y(.)1231
- 1479 y(.)1231 1539 y(.)514 1599 y(/*)h(Just)f(pass)h(through)f(the)g
- (unionClause)g(and)544 1658 y(*)h(intersectClause.)e(We)i(will)f
- (process)g(it)h(in)544 1718 y(*)g(the)f(function)g
- (Except_Intersect_Rewrite())544 1778 y(*/)514 1838
- y(qry->unionClause)f(=)i(stmt->unionClause;)514 1898
- y(qry->intersectClause)e(=)i(stmt->intersectClause;)1231
- 1957 y(.)1231 2017 y(.)1231 2077 y(.)514 2137 y(return)f((Query)h(*))
- f(qry;)454 2196 y(})270 2353 y Fn(The)12 b(Rewrite)h(System)270
- 2455 y Ft(In)24 b(this)h(stage)g(the)f(information)f(contained)h(in)g
- (the)h Fp(oper)o(ator)g(tr)n(ee)g Ft(attached)g(to)f(the)g(topmost)270
- 2515 y Fr(SelectStmt)18 b Ft(node)i(is)g(used)g(to)f(form)f(a)i(tree)f
- (of)g Fr(Query)g Ft(nodes)h(representing)f(the)g(re)o(written)270
- 2574 y(query)c((i.e.)25 b(the)15 b(semantically)g(equi)o(v)o(alent)g
- (query)g(that)g(contains)h(only)f Fp(union)g Ft(b)o(ut)g(no)g
- Fp(intersect)h Ft(or)270 2634 y Fp(e)o(xcept)d Ft(operations).)270
- 2754 y(The)g(follo)o(wing)e(steps)i(ha)o(v)o(e)g(to)f(be)g(performed:)
- 345 2867 y Fo( 17)25 b Ft(Sa)o(v)o(e)16 b(the)g Fr(sortClause)p
- Ft(,)g Fr(uniqueFlag)p Ft(,)g Fr(targetList)f Ft( 02elds)h(etc.)27
- b(of)16 b(the)f(topmost)395 2926 y Fr(Query)f Ft(node)g(because)h(the)f
- (topmost)h(node)f(may)g(change)h(during)e(the)i(re)o(write)e(process)i
- ((re-)395 2986 y(member)f((only))f(the)i(topmost)g
- Fr(SelectStmt)f Ft(node)h(has)g(already)f(been)h(transformed)f(to)h(a)
- 395 3046 y Fr(Query)c Ft(node).)345 3163 y Fo( 17)25
- b Ft(Recursi)o(v)o(ely)12 b(step)h(through)e(the)h Fp(oper)o(ator)h(tr)
- n(ee)g Ft(and)g(transform)e(e)o(v)o(ery)h Fr(SelectStmt)f
- Ft(node)395 3223 y(to)18 b(a)h Fr(Query)f Ft(node)g(using)h(the)f
- (function)g Fr(intersect)p 1440 3223 15 2 v 17 w(tree)p
- 1577 3223 V 17 w(analyze())g Ft(described)395 3283
- y(belo)o(w)m(.)d(The)d(one)g(node)g(already)f(transformed)g((the)h
- (topmost)f(node))h(is)g(still)g(contained)f(in)h(the)395
- 3342 y Fp(oper)o(ator)j(tr)n(ee)g Ft(and)f(must)g(not)h(be)f
- (transformed)f(again)h(because)h(this)g(would)e(cause)j(troubles)395
- 3402 y(in)c(the)g Fp(tr)o(ansforming)h(logic)p Ft(.)p
- eop
- %%Page: 107 107
- 107 106 bop 198 60 a Fm(3.8.)26 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)327
- b Ft(107)433 2199 y @beginspecial 173 @llx 194 @lly 439
- @urx 597 @ury 2660 @rwi @setspecial
- %%BeginDocument: figures/union_intersect_dnf.ps
- %Magnification: 1.05
- /$F2psDict 200 dict def
- $F2psDict begin
- $F2psDict /mtrx matrix put
- /col-1 {0 setgray} bind def
- /col0 {0.000 0.000 0.000 srgb} bind def
- /col1 {0.000 0.000 1.000 srgb} bind def
- /col2 {0.000 1.000 0.000 srgb} bind def
- /col3 {0.000 1.000 1.000 srgb} bind def
- /col4 {1.000 0.000 0.000 srgb} bind def
- /col5 {1.000 0.000 1.000 srgb} bind def
- /col6 {1.000 1.000 0.000 srgb} bind def
- /col7 {1.000 1.000 1.000 srgb} bind def
- /col8 {0.000 0.000 0.560 srgb} bind def
- /col9 {0.000 0.000 0.690 srgb} bind def
- /col10 {0.000 0.000 0.820 srgb} bind def
- /col11 {0.530 0.810 1.000 srgb} bind def
- /col12 {0.000 0.560 0.000 srgb} bind def
- /col13 {0.000 0.690 0.000 srgb} bind def
- /col14 {0.000 0.820 0.000 srgb} bind def
- /col15 {0.000 0.560 0.560 srgb} bind def
- /col16 {0.000 0.690 0.690 srgb} bind def
- /col17 {0.000 0.820 0.820 srgb} bind def
- /col18 {0.560 0.000 0.000 srgb} bind def
- /col19 {0.690 0.000 0.000 srgb} bind def
- /col20 {0.820 0.000 0.000 srgb} bind def
- /col21 {0.560 0.000 0.560 srgb} bind def
- /col22 {0.690 0.000 0.690 srgb} bind def
- /col23 {0.820 0.000 0.820 srgb} bind def
- /col24 {0.500 0.190 0.000 srgb} bind def
- /col25 {0.630 0.250 0.000 srgb} bind def
- /col26 {0.750 0.380 0.000 srgb} bind def
- /col27 {1.000 0.500 0.500 srgb} bind def
- /col28 {1.000 0.630 0.630 srgb} bind def
- /col29 {1.000 0.750 0.750 srgb} bind def
- /col30 {1.000 0.880 0.880 srgb} bind def
- /col31 {1.000 0.840 0.000 srgb} bind def
- end
- save
- 149.0 635.5 translate
- 1 -1 scale
- /cp {closepath} bind def
- /ef {eofill} bind def
- /gr {grestore} bind def
- /gs {gsave} bind def
- /sa {save} bind def
- /rs {restore} bind def
- /l {lineto} bind def
- /m {moveto} bind def
- /rm {rmoveto} bind def
- /n {newpath} bind def
- /s {stroke} bind def
- /sh {show} bind def
- /slc {setlinecap} bind def
- /slj {setlinejoin} bind def
- /slw {setlinewidth} bind def
- /srgb {setrgbcolor} bind def
- /rot {rotate} bind def
- /sc {scale} bind def
- /sd {setdash} bind def
- /ff {findfont} bind def
- /sf {setfont} bind def
- /scf {scalefont} bind def
- /sw {stringwidth} bind def
- /tr {translate} bind def
- /tnt {dup dup currentrgbcolor
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
- bind def
- /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
- 4 -2 roll mul srgb} bind def
- /DrawSplineSection {
- /y3 exch def
- /x3 exch def
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- /xa x1 x2 x1 sub 0.666667 mul add def
- /ya y1 y2 y1 sub 0.666667 mul add def
- /xb x3 x2 x3 sub 0.666667 mul add def
- /yb y3 y2 y3 sub 0.666667 mul add def
- x1 y1 lineto
- xa ya xb yb x3 y3 curveto
- } def
- /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
- /$F2psEnd {$F2psEnteredState restore end} def
- $F2psBegin
- 10 setmiterlimit
- n 0 792 m 0 0 l 612 0 l 612 792 l cp clip
- 0.06299 0.06299 sc
- 7.500 slw
- % Polyline
- n 675 810 m 675 1350 l 405 1350 l 405 810 l cp gs col-1 s gr
- % Polyline
- n 675 1080 m 405 1080 l gs col-1 s gr
- % Polyline
- n 675 4095 m 675 4635 l 405 4635 l 405 4095 l cp gs col-1 s gr
- % Polyline
- n 675 4365 m 405 4365 l gs col-1 s gr
- % Polyline
- n 675 4365 m 405 4635 l gs col-1 s gr
- % Polyline
- n 675 4635 m 405 4365 l gs col-1 s gr
- % Polyline
- gs clippath
- 888 4200 m 1008 4230 l 888 4260 l 1050 4260 l 1050 4200 l cp clip
- n 1035 4230 m 540 4230 l gs col-1 s gr gr
- % arrowhead
- n 888 4200 m 1008 4230 l 888 4260 l 888 4230 l 888 4200 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 2925 4905 m 3825 4905 l 3825 5625 l 2925 5625 l cp gs col-1 s gr
- % Polyline
- n 2925 5355 m 3825 5355 l gs col-1 s gr
- % Polyline
- n 2925 5130 m 3825 5130 l gs col-1 s gr
- % Polyline
- n 3555 5355 m 3555 5625 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3240 5310 m
- gs 1 -1 sc (NOT) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3240 5085 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3105 5535 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 4050 5355 m 4590 5355 l 4590 5625 l 4050 5625 l cp gs col-1 s gr
- % Polyline
- n 4320 5355 m 4320 5625 l gs col-1 s gr
- % Polyline
- n 4320 5355 m 4590 5625 l gs col-1 s gr
- % Polyline
- n 4590 5355 m 4320 5625 l gs col-1 s gr
- % Polyline
- gs clippath
- 3903 5460 m 4023 5490 l 3903 5520 l 4065 5520 l 4065 5460 l cp clip
- n 3690 5490 m 4050 5490 l gs col-1 s gr gr
- % arrowhead
- n 3903 5460 m 4023 5490 l 3903 5520 l 3903 5490 l 3903 5460 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 2160 4365 m 2700 4365 l 2700 4635 l 2160 4635 l cp gs col-1 s gr
- % Polyline
- n 2430 4365 m 2430 4635 l gs col-1 s gr
- % Polyline
- n 2925 4365 m 3465 4365 l 3465 4635 l 2925 4635 l cp gs col-1 s gr
- % Polyline
- n 3195 4365 m 3195 4635 l gs col-1 s gr
- % Polyline
- n 3195 4365 m 3465 4635 l gs col-1 s gr
- % Polyline
- n 3465 4365 m 3195 4635 l gs col-1 s gr
- % Polyline
- gs clippath
- 2778 4470 m 2898 4500 l 2778 4530 l 2940 4530 l 2940 4470 l cp clip
- n 2565 4500 m 2925 4500 l gs col-1 s gr gr
- % arrowhead
- n 2778 4470 m 2898 4500 l 2778 4530 l 2778 4500 l 2778 4470 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1035 3915 m 1935 3915 l 1935 4635 l 1035 4635 l cp gs col-1 s gr
- % Polyline
- n 1035 4365 m 1935 4365 l gs col-1 s gr
- % Polyline
- n 1035 4140 m 1935 4140 l gs col-1 s gr
- % Polyline
- n 1665 4365 m 1665 4635 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 1395 4320 m
- gs 1 -1 sc (OR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1350 4095 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1215 4545 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 2925 1620 m 3825 1620 l 3825 2340 l 2925 2340 l cp gs col-1 s gr
- % Polyline
- n 2925 2070 m 3825 2070 l gs col-1 s gr
- % Polyline
- n 2925 1845 m 3825 1845 l gs col-1 s gr
- % Polyline
- n 3555 2070 m 3555 2340 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3240 2025 m
- gs 1 -1 sc (NOT) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3240 1800 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3105 2250 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 4050 2070 m 4590 2070 l 4590 2340 l 4050 2340 l cp gs col-1 s gr
- % Polyline
- n 4320 2070 m 4320 2340 l gs col-1 s gr
- % Polyline
- n 4320 2070 m 4590 2340 l gs col-1 s gr
- % Polyline
- n 4590 2070 m 4320 2340 l gs col-1 s gr
- % Polyline
- gs clippath
- 3903 2175 m 4023 2205 l 3903 2235 l 4065 2235 l 4065 2175 l cp clip
- n 3690 2205 m 4050 2205 l gs col-1 s gr gr
- % arrowhead
- n 3903 2175 m 4023 2205 l 3903 2235 l 3903 2205 l 3903 2175 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 2160 1080 m 2700 1080 l 2700 1350 l 2160 1350 l cp gs col-1 s gr
- % Polyline
- n 2430 1080 m 2430 1350 l gs col-1 s gr
- % Polyline
- n 2925 1080 m 3465 1080 l 3465 1350 l 2925 1350 l cp gs col-1 s gr
- % Polyline
- n 3195 1080 m 3195 1350 l gs col-1 s gr
- % Polyline
- n 3195 1080 m 3465 1350 l gs col-1 s gr
- % Polyline
- n 3465 1080 m 3195 1350 l gs col-1 s gr
- % Polyline
- gs clippath
- 2778 1185 m 2898 1215 l 2778 1245 l 2940 1245 l 2940 1185 l cp clip
- n 2565 1215 m 2925 1215 l gs col-1 s gr gr
- % arrowhead
- n 2778 1185 m 2898 1215 l 2778 1245 l 2778 1215 l 2778 1185 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1035 630 m 1935 630 l 1935 1350 l 1035 1350 l cp gs col-1 s gr
- % Polyline
- n 1035 1080 m 1935 1080 l gs col-1 s gr
- % Polyline
- n 1035 855 m 1935 855 l gs col-1 s gr
- % Polyline
- n 1665 1080 m 1665 1350 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 1395 1035 m
- gs 1 -1 sc (OR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1350 810 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1215 1260 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- gs clippath
- 570 3948 m 540 4068 l 510 3948 l 510 4110 l 570 4110 l cp clip
- n 540 1215 m 540 4095 l gs col-1 s gr gr
- % arrowhead
- n 570 3948 m 540 4068 l 510 3948 l 540 3948 l 570 3948 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 888 915 m 1008 945 l 888 975 l 1050 975 l 1050 915 l cp clip
- n 540 945 m 1035 945 l gs col-1 s gr gr
- % arrowhead
- n 888 915 m 1008 945 l 888 975 l 888 945 l 888 915 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2013 4470 m 2133 4500 l 2013 4530 l 2175 4530 l 2175 4470 l cp clip
- n 1800 4500 m 2160 4500 l gs col-1 s gr gr
- % arrowhead
- n 2013 4470 m 2133 4500 l 2013 4530 l 2013 4500 l 2013 4470 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2325 5703 m 2295 5823 l 2265 5703 l 2265 5865 l 2325 5865 l cp clip
- n 2295 4500 m 2295 5850 l gs col-1 s gr gr
- % arrowhead
- n 2325 5703 m 2295 5823 l 2265 5703 l 2295 5703 l 2325 5703 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1665 6705 m 2925 6705 l gs col-1 s gr
- % Polyline
- n 1665 6435 m 2925 6435 l gs col-1 s gr
- % Polyline
- n 1665 5850 m 2925 5850 l 2925 6975 l 1665 6975 l cp gs col-1 s gr
- % Polyline
- n 2655 6075 m 2655 6975 l gs col-1 s gr
- % Polyline
- n 1665 6075 m 2925 6075 l gs col-1 s gr
- % Polyline
- n 2655 6435 m 2925 6705 l gs col-1 s gr
- % Polyline
- n 2655 6705 m 2925 6435 l gs col-1 s gr
- % Polyline
- n 2655 6705 m 2925 6975 l gs col-1 s gr
- % Polyline
- n 2925 6705 m 2655 6975 l gs col-1 s gr
- % Polyline
- n 3330 6705 m 4590 6705 l gs col-1 s gr
- % Polyline
- n 3330 6435 m 4590 6435 l gs col-1 s gr
- % Polyline
- n 3330 5850 m 4590 5850 l 4590 6975 l 3330 6975 l cp gs col-1 s gr
- % Polyline
- n 4320 6075 m 4320 6975 l gs col-1 s gr
- % Polyline
- n 3330 6075 m 4590 6075 l gs col-1 s gr
- % Polyline
- n 4320 6435 m 4590 6705 l gs col-1 s gr
- % Polyline
- n 4320 6705 m 4590 6435 l gs col-1 s gr
- % Polyline
- n 4320 6705 m 4590 6975 l gs col-1 s gr
- % Polyline
- n 4590 6705 m 4320 6975 l gs col-1 s gr
- % Polyline
- gs clippath
- 2013 1185 m 2133 1215 l 2013 1245 l 2175 1245 l 2175 1185 l cp clip
- n 1800 1215 m 2160 1215 l gs col-1 s gr gr
- % arrowhead
- n 2013 1185 m 2133 1215 l 2013 1245 l 2013 1215 l 2013 1185 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2325 2418 m 2295 2538 l 2265 2418 l 2265 2580 l 2325 2580 l cp clip
- n 2295 1215 m 2295 2565 l gs col-1 s gr gr
- % arrowhead
- n 2325 2418 m 2295 2538 l 2265 2418 l 2295 2418 l 2325 2418 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1665 3420 m 2925 3420 l gs col-1 s gr
- % Polyline
- n 1665 3150 m 2925 3150 l gs col-1 s gr
- % Polyline
- n 1665 2565 m 2925 2565 l 2925 3690 l 1665 3690 l cp gs col-1 s gr
- % Polyline
- n 2655 2790 m 2655 3690 l gs col-1 s gr
- % Polyline
- n 1665 2790 m 2925 2790 l gs col-1 s gr
- % Polyline
- n 2655 3150 m 2925 3420 l gs col-1 s gr
- % Polyline
- n 2655 3420 m 2925 3150 l gs col-1 s gr
- % Polyline
- n 2655 3420 m 2925 3690 l gs col-1 s gr
- % Polyline
- n 2925 3420 m 2655 3690 l gs col-1 s gr
- % Polyline
- n 3330 3420 m 4590 3420 l gs col-1 s gr
- % Polyline
- n 3330 3150 m 4590 3150 l gs col-1 s gr
- % Polyline
- n 3330 2565 m 4590 2565 l 4590 3690 l 3330 3690 l cp gs col-1 s gr
- % Polyline
- n 4320 2790 m 4320 3690 l gs col-1 s gr
- % Polyline
- n 3330 2790 m 4590 2790 l gs col-1 s gr
- % Polyline
- n 4320 3150 m 4590 3420 l gs col-1 s gr
- % Polyline
- n 4320 3420 m 4590 3150 l gs col-1 s gr
- % Polyline
- n 4320 3420 m 4590 3690 l gs col-1 s gr
- % Polyline
- n 4590 3420 m 4320 3690 l gs col-1 s gr
- % Open spline
- gs clippath
- 3269 4798 m 3352 4890 l 3236 4848 l 3371 4938 l 3404 4888 l cp clip
- n 3060.0 4500.0 m 3082.5 4612.5 l
- 3082.5 4612.5 3105.0 4725.0 3240.0 4815.0 DrawSplineSection
- 3375.0 4905.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3269 4798 m 3352 4890 l 3236 4848 l 3253 4823 l 3269 4798 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 4096 5786 m 3981 5833 l 4060 5738 l 3930 5835 l 3966 5883 l cp clip
- n 4185.0 5490.0 m 4162.5 5602.5 l
- 4162.5 5602.5 4140.0 5715.0 4050.0 5782.5 DrawSplineSection
- 3960.0 5850.0 l gs col-1 s gr
- gr
- % arrowhead
- n 4096 5786 m 3981 5833 l 4060 5738 l 4078 5762 l 4096 5786 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3269 1513 m 3352 1605 l 3236 1563 l 3371 1653 l 3404 1603 l cp clip
- n 3060.0 1215.0 m 3082.5 1327.5 l
- 3082.5 1327.5 3105.0 1440.0 3240.0 1530.0 DrawSplineSection
- 3375.0 1620.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3269 1513 m 3352 1605 l 3236 1563 l 3253 1538 l 3269 1513 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 4096 2501 m 3981 2548 l 4060 2453 l 3930 2550 l 3966 2598 l cp clip
- n 4185.0 2205.0 m 4162.5 2317.5 l
- 4162.5 2317.5 4140.0 2430.0 4050.0 2497.5 DrawSplineSection
- 3960.0 2565.0 l gs col-1 s gr
- gr
- % arrowhead
- n 4096 2501 m 3981 2548 l 4060 2453 l 4078 2477 l 4096 2501 l cp gs 0.00 setgray ef gr col-1 s
- /Times-Roman ff 150.00 scf sf
- 2205 6300 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1980 6030 m
- gs 1 -1 sc (Query (B)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3870 6300 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3690 6030 m
- gs 1 -1 sc (Query (C)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 2205 3015 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1980 2745 m
- gs 1 -1 sc (Query (A)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3870 3015 m
- gs 1 -1 sc 90.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3690 2745 m
- gs 1 -1 sc (Query (C)) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1710 3330 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1710 3600 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 3330 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 3600 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 6615 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 6885 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1710 6615 m
- gs 1 -1 sc (unionClause) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1710 6885 m
- gs 1 -1 sc (intersectClause) col-1 sh gr
- showpage
- $F2psEnd
- rs
- %%EndDocument
- @endspecial 391 2309 a(Figure)11 b(3.13:)16 b(Data)c(structure)g(of)g
- Fl(()p Fk(A)g Fo([)f Fk(B)r Fl())p Fo(n)p Fk(C)16 b
- Ft(after)c(transformation)f(to)h(DNF)273 2542 y Fo( 17)25
- b Ft(T)n(ransform)14 b(the)g(ne)o(w)h Fp(oper)o(ator)g(tr)n(ee)g
- Ft(into)f(DNF)h((disjuncti)o(v)o(e)f(normal)f(form).)21
- b(PostgreSQL)323 2602 y(does)f(not)f(pro)o(vide)h(an)o(y)g(function)f
- (for)g(the)h(transformation)e(into)h(DNF)h(b)o(ut)g(it)f(pro)o(vides)h
- (a)323 2662 y(function)14 b Fr(cnfify())g Ft(that)h(performs)f(a)i
- (transformation)e(into)g(CNF)i((conjuncti)o(v)o(e)e(normal)323
- 2721 y(form).)g(So)e(we)g(can)h(easily)g(make)f(use)g(of)g(this)h
- (function)e(when)i(we)f(e)o(xchange)h(e)o(v)o(ery)f Fr(OR)g
- Ft(with)323 2781 y(an)17 b Fr(AND)f Ft(and)h(vice)g(v)o(ersa)h(before)e
- (calling)h Fr(cnfify())f Ft(as)h(we)g(did)g(already)g(in)g(the)f
- Fp(parser)323 2841 y Ft((compare)11 b( 02gure)h(3.11)h(to)f( 02gure)
- g(3.12).)k(When)c Fr(cnfify())g Ft(is)h(called)f(with)g(a)h(special)
- g( 03ag,)323 2901 y(the)f Fr(removeAndFlag)g Ft(set)h(to)f
- Fr(true)h Ft(it)f(returns)g(a)h(list)g(where)g(the)f(entries)h(can)g
- (be)g(thought)323 2961 y(of)e(being)i(connected)f(together)g(by)g
- Fr(ANDs)p Ft(,)g(so)h(the)f(e)o(xplicit)h Fr(AND)f Ft(nodes)g(are)h
- (remo)o(v)o(ed.)323 3062 y(After)d Fr(cnfify())h Ft(has)h(been)f
- (called)h(we)f(normally)g(would)f(ha)o(v)o(e)i(to)g(e)o(xchange)g
- Fr(OR)f Ft(and)g Fr(AND)323 3122 y Ft(nodes)16 b(again.)28
- b(W)l(e)17 b(skip)g(this)g(step)f(by)h(simply)f(treating)g(e)o(v)o(ery)
- g Fr(OR)h Ft(node)f(as)h(an)g Fr(AND)f Ft(node)323 3181
- y(throughout)10 b(the)h(follo)o(wing)f(steps)i((remember)n(,)f(that)g
- (there)h(are)f(no)g Fr(AND)h Ft(nodes)f(left)g(that)h(ha)o(v)o(e)323
- 3241 y(to)g(be)g(treated)g(as)h Fr(OR)f Ft(nodes)h(because)g(of)f(the)g
- Fr(removeAndFlag)p Ft().)323 3342 y(Figure)e(3.13)i(sho)o(ws)h(what)e
- (the)h(data)g(structure)f(looks)h(like)f(after)g(the)h(transformation)e
- (to)h(DNF)323 3402 y(has)h(taken)g(place)h(for)e(the)i(follo)o(wing)e
- (query:)p eop
- %%Page: 108 108
- 108 107 bop 270 60 a Ft(108)57 b Fm(CHAPTER)14 b(3.)28
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 454 234 y Fr((select)29 b(*)h(from)g(A)484 294 y(union)484
- 354 y(select)f(*)h(from)g(B))484 413 y(except)484 473
- y(select)f(*)h(from)g(C;)345 589 y Fo( 17)25 b Ft(F)o(or)10
- b(e)o(v)o(ery)h(entry)g(of)g(the)g(list)g(returned)g(by)g
- Fr(cnfify())f Ft((i.e.)16 b(for)10 b(e)o(v)o(ery)h
- Fp(oper)o(ator)h(tr)n(ee)g Ft(which)395 648 y(may)e(only)g(contain)h
- Fr(OR)f Ft(and)h Fr(NOT)f Ft(operator)g(nodes)h(and)f
- Fr(Query)g Ft(nodes)h(as)g(lea)o(v)o(es))g(contained)395
- 708 y(in)h(the)g Fr(union)p 672 708 15 2 v 17 w(list)g
- Ft(perform)f(the)i(follo)o(wing)e(steps:)454 806 y Fn(226)25
- b Ft(Check)15 b(if)g(the)g Fp(tar)n(getlists)f Ft(of)h(all)g
- Fr(Query)f Ft(nodes)h(appearing)g(are)f(compatible)h((i.e.)23
- b(all)504 866 y Fp(tar)n(getlists)13 b Ft(ha)o(v)o(e)h(the)f(same)h
- (number)e(of)h(attrib)o(utes)g(and)g(the)g(corresponding)g(attrib)o
- (utes)504 926 y(are)f(of)g(the)h(same)f(type))454 1004
- y Fn(226)25 b Ft(There)13 b(must)f(be)h(at)g(least)g(one)f(positi)o(v)
- o(e)h Fr(OR)f Ft(node)h((i.e.)j(at)d(least)g(one)f Fr(OR)h
- Ft(node)f(which)h(is)504 1064 y(not)h(preceded)g(by)f(a)h
- Fr(NOT)g Ft(node).)20 b(Create)14 b(a)g(list)g(of)g(all)f
- Fr(Query)h Ft(nodes)g((or)f(of)h Fr(Query)504 1123 y
- Ft(nodes)f(preceded)f(by)h Fr(NOT)f Ft(nodes)h(if)f Fr(OR)29
- b(NOT)13 b Ft(is)f(found))g(with)g(the)g(non)h(ne)o(gated)f(node)504
- 1183 y( 02rst)g(using)g(the)h(function)e Fr(create)p
- 1149 1183 V 18 w(list())g Ft(described)i(belo)o(w)m(.)454
- 1261 y Fn(226)25 b Ft(The)19 b( 02rst)f((non)f(ne)o(gated))h(node)g
- (of)g(the)g(list)g(will)g(be)g(the)g(topmost)g Fr(Query)f
- Ft(node)i(of)504 1321 y(the)g(current)f Fp(union)h Ft(operand.)36
- b(F)o(or)18 b(all)h(other)g(nodes)g(found)g(in)g(the)g(list)g(add)g(an)
- g Fr(IN)504 1381 y Ft(subselect)14 b(()p Fr(NOT)29 b(IN)14
- b Ft(subselect)g(if)f(the)g Fr(Query)g Ft(node)h(is)g(preceded)f(by)g
- (a)h Fr(NOT)p Ft())f(to)g(the)504 1440 y Fr(where)j
- Ft(quali 02cation)g(of)f(the)i(topmost)f(node.)28 b(Adding)15
- b(a)i(subselect)g(to)f(the)h Fr(where)504 1500 y Ft(quali 02cation)12
- b(is)g(done)h(by)f(logically)g Fr(AND)p Ft(ing)f(it)i(to)f(the)g
- (original)g(quali 02cation.)454 1578 y Fn(226)25 b
- Ft(Append)16 b(the)f Fr(Query)g Ft(node)h(setup)g(in)f(the)h(last)g
- (steps)g(to)f(a)h(list)g(which)f(is)h(hold)g(by)f(the)504
- 1638 y(pointer)d Fr(union)p 811 1638 V 17 w(list)p Ft(.)345
- 1736 y Fo( 17)25 b Ft(T)l(ake)17 b(the)f( 02rst)h(node)g(of)f
- Fr(union)p 1004 1736 V 18 w(list)g Ft(as)i(the)e(ne)o(w)h(topmost)g
- (node)g(of)f(the)h(whole)g(query)395 1796 y(and)11 b(attach)h(the)f
- (rest)h(of)f(the)g(list)h(to)f(the)h( 02eld)f Fr(unionClause)f
- Ft(of)h(this)h(topmost)f(node.)k(Since)395 1856 y(the)f(ne)o(w)g
- (topmost)g(node)h(might)f(dif)o(fer)f(from)g(the)i(original)e(one)i
- ((i.e.)22 b(from)13 b(the)i(node)f(which)395 1915 y(was)h(topmost)g
- (when)g(we)g(entered)g(the)g Fp(r)n(e)o(write)i(stage)p
- Ft())d(we)h(ha)o(v)o(e)h(to)f(attach)g(the)g( 02elds)g(sa)o(v)o(ed)
- 395 1975 y(in)h(the)h( 02rst)g(step)g(to)g(the)g(ne)o(w)g(topmost)f
- (node)h((i.e.)30 b(the)17 b Fr(sortClause)p Ft(,)h Fr(targetList)p
- Ft(,)395 2035 y Fr(unionFlag)p Ft(,)11 b(etc.).)345
- 2133 y Fo( 17)25 b Ft(Hand)16 b(the)h(ne)o(w)g(topmost)g
- Fr(Query)f Ft(node)h(back.)29 b(No)o(w)17 b(the)g(normal)f
- Fp(query)h(r)n(e)o(writing)h Ft(takes)395 2193 y(place)12
- b((in)f(order)g(to)h(handle)g(vie)o(ws)g(if)f(present))h(and)f(then)h
- (the)g Fp(planner/optimizer)g Ft(and)g Fp(e)o(xecu-)395
- 2252 y(tor)g Ft(functions)f(are)g(called)h(to)g(get)g(a)g(result.)j
- (There)d(ha)o(v)o(e)g(no)g(changes)g(been)g(made)g(to)f(the)h(code)395
- 2312 y(of)f(these)i(stages.)270 2408 y(Figure)f(3.14)g(sho)o(ws)h(the)f
- (re)o(written)f(data)i(structure)e(of)h(the)h(query:)360
- 2505 y Fr(select)29 b(C1,)g(C2)h(from)g(A)360 2565 y(intersect)360
- 2624 y(select)f(C1,)g(C3)h(from)g(C;)270 2721 y Ft(against)11
- b(the)g(tables)h(de 02ned)f(in)g(e)o(xample)g(3.4.)16
- b(The)c(re)o(written)d(data)j(structure)e(represents)i(the)f(query:)330
- 2817 y Fr(select)29 b(C1,)h(C2)f(form)h(A)330 2877 y(where)f((C1,)h
- (C2))f(in)509 2936 y((select)g(C1,C3)h(from)f(C);)270
- 3033 y Ft(The)15 b( 02eld)e Fr(lefttree)h Ft(of)g(the)g
- Fr(Sublink)f Ft(node)h(points)g(to)g(a)g(list)h(where)e(e)o(v)o(ery)h
- (entry)g(points)g(to)g(a)270 3093 y Fr(VAR)e Ft(node)g(of)g(the)g
- Fp(tar)n(getlist)g Ft(of)g(the)h(topmost)e(node)i((node)f(A).)g(The)h
- ( 02eld)f Fr(oper)g Ft(of)g(the)g Fr(Sublink)270 3152
- y Ft(node)i(points)h(to)f(a)h(list)f(holding)g(a)h(pointer)e(to)i(an)f
- Fr(Expr)g Ft(node)h(for)e(e)o(v)o(ery)h(attrib)o(ute)g(of)g(the)g
- (topmost)270 3212 y Fp(tar)n(getlist)p Ft(.)k(Ev)o(ery)13
- b Fr(Expr)g Ft(node)g(is)h(used)f(to)g(compare)g(a)g
- Fr(VAR)g Ft(node)g(of)g(the)g(topmost)g Fp(tar)n(getlist)f
- Ft(with)270 3272 y(the)17 b(corresponding)f Fr(VAR)g
- Ft(node)h(of)f(the)h(subselect')m(s)h Fp(tar)n(getlist)p
- Ft(.)28 b(So)17 b(the)g( 02rst)f(ar)o(gument)g(of)g(e)o(v)o(ery)270
- 3332 y Fr(Expr)c Ft(node)h(points)g(to)g(a)g Fr(VAR)f
- Ft(node)h(of)f(the)h(topmost)g Fp(tar)n(getlist)f Ft(and)h(the)g
- (second)g(ar)o(gument)f(points)270 3391 y(to)g(the)h(corresponding)e
- Fr(VAR)h Ft(node)g(of)g(the)h(subselect')m(s)g Fp(tar)n(getlist)p
- Ft(.)p eop
- %%Page: 109 109
- 109 108 bop 198 60 a Fm(3.8.)29 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)324
- b Ft(109)298 3216 y @beginspecial 136 @llx 94 @lly 476
- @urx 697 @ury 3400 @rwi @setspecial
- %%BeginDocument: figures/union_operand.ps
- %Magnification: 1.05
- /$F2psDict 200 dict def
- $F2psDict begin
- $F2psDict /mtrx matrix put
- /col-1 {0 setgray} bind def
- /col0 {0.000 0.000 0.000 srgb} bind def
- /col1 {0.000 0.000 1.000 srgb} bind def
- /col2 {0.000 1.000 0.000 srgb} bind def
- /col3 {0.000 1.000 1.000 srgb} bind def
- /col4 {1.000 0.000 0.000 srgb} bind def
- /col5 {1.000 0.000 1.000 srgb} bind def
- /col6 {1.000 1.000 0.000 srgb} bind def
- /col7 {1.000 1.000 1.000 srgb} bind def
- /col8 {0.000 0.000 0.560 srgb} bind def
- /col9 {0.000 0.000 0.690 srgb} bind def
- /col10 {0.000 0.000 0.820 srgb} bind def
- /col11 {0.530 0.810 1.000 srgb} bind def
- /col12 {0.000 0.560 0.000 srgb} bind def
- /col13 {0.000 0.690 0.000 srgb} bind def
- /col14 {0.000 0.820 0.000 srgb} bind def
- /col15 {0.000 0.560 0.560 srgb} bind def
- /col16 {0.000 0.690 0.690 srgb} bind def
- /col17 {0.000 0.820 0.820 srgb} bind def
- /col18 {0.560 0.000 0.000 srgb} bind def
- /col19 {0.690 0.000 0.000 srgb} bind def
- /col20 {0.820 0.000 0.000 srgb} bind def
- /col21 {0.560 0.000 0.560 srgb} bind def
- /col22 {0.690 0.000 0.690 srgb} bind def
- /col23 {0.820 0.000 0.820 srgb} bind def
- /col24 {0.500 0.190 0.000 srgb} bind def
- /col25 {0.630 0.250 0.000 srgb} bind def
- /col26 {0.750 0.380 0.000 srgb} bind def
- /col27 {1.000 0.500 0.500 srgb} bind def
- /col28 {1.000 0.630 0.630 srgb} bind def
- /col29 {1.000 0.750 0.750 srgb} bind def
- /col30 {1.000 0.880 0.880 srgb} bind def
- /col31 {1.000 0.840 0.000 srgb} bind def
- end
- save
- 126.0 696.5 translate
- 1 -1 scale
- /cp {closepath} bind def
- /ef {eofill} bind def
- /gr {grestore} bind def
- /gs {gsave} bind def
- /sa {save} bind def
- /rs {restore} bind def
- /l {lineto} bind def
- /m {moveto} bind def
- /rm {rmoveto} bind def
- /n {newpath} bind def
- /s {stroke} bind def
- /sh {show} bind def
- /slc {setlinecap} bind def
- /slj {setlinejoin} bind def
- /slw {setlinewidth} bind def
- /srgb {setrgbcolor} bind def
- /rot {rotate} bind def
- /sc {scale} bind def
- /sd {setdash} bind def
- /ff {findfont} bind def
- /sf {setfont} bind def
- /scf {scalefont} bind def
- /sw {stringwidth} bind def
- /tr {translate} bind def
- /tnt {dup dup currentrgbcolor
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add
- 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
- bind def
- /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
- 4 -2 roll mul srgb} bind def
- /DrawSplineSection {
- /y3 exch def
- /x3 exch def
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- /xa x1 x2 x1 sub 0.666667 mul add def
- /ya y1 y2 y1 sub 0.666667 mul add def
- /xb x3 x2 x3 sub 0.666667 mul add def
- /yb y3 y2 y3 sub 0.666667 mul add def
- x1 y1 lineto
- xa ya xb yb x3 y3 curveto
- } def
- /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
- /$F2psEnd {$F2psEnteredState restore end} def
- $F2psBegin
- 10 setmiterlimit
- n 0 792 m 0 0 l 612 0 l 612 792 l cp clip
- 0.06299 0.06299 sc
- 7.500 slw
- % Polyline
- n 180 3780 m 1170 3780 l gs col-1 s gr
- % Polyline
- n 180 4050 m 1170 4050 l gs col-1 s gr
- % Polyline
- n 180 4320 m 1170 4320 l gs col-1 s gr
- % Polyline
- n 180 4590 m 1170 4590 l gs col-1 s gr
- % Polyline
- n 900 3780 m 900 5040 l gs col-1 s gr
- % Polyline
- n 180 3555 m 1170 3555 l 1170 5040 l 180 5040 l cp gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 450 3735 m
- gs 1 -1 sc (Sublink) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 540 4725 m
- gs 1 -1 sc 270.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 4500 m
- gs 1 -1 sc (subselect) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 4230 m
- gs 1 -1 sc (oper) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 3960 m
- gs 1 -1 sc (lefthand) col-1 sh gr
- % Polyline
- n 3195 3780 m 3735 3780 l 3735 4050 l 3195 4050 l cp gs col-1 s gr
- % Polyline
- n 3465 3780 m 3465 4050 l gs col-1 s gr
- % Polyline
- n 3465 3780 m 3735 4050 l gs col-1 s gr
- % Polyline
- n 3735 3780 m 3465 4050 l gs col-1 s gr
- % Polyline
- n 1710 3780 m 2250 3780 l 2250 4050 l 1710 4050 l cp gs col-1 s gr
- % Polyline
- n 1980 3780 m 1980 4050 l gs col-1 s gr
- % Polyline
- gs clippath
- 3048 3885 m 3168 3915 l 3048 3945 l 3210 3945 l 3210 3885 l cp clip
- n 2115 3915 m 3195 3915 l gs col-1 s gr gr
- % arrowhead
- n 3048 3885 m 3168 3915 l 3048 3945 l 3048 3915 l 3048 3885 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 3195 4140 m 3735 4140 l 3735 4410 l 3195 4410 l cp gs col-1 s gr
- % Polyline
- n 3465 4140 m 3465 4410 l gs col-1 s gr
- % Polyline
- n 3465 4140 m 3735 4410 l gs col-1 s gr
- % Polyline
- n 3735 4140 m 3465 4410 l gs col-1 s gr
- % Polyline
- n 1710 4140 m 2250 4140 l 2250 4410 l 1710 4410 l cp gs col-1 s gr
- % Polyline
- n 1980 4140 m 1980 4410 l gs col-1 s gr
- % Polyline
- gs clippath
- 3048 4245 m 3168 4275 l 3048 4305 l 3210 4305 l 3210 4245 l cp clip
- n 2115 4275 m 3195 4275 l gs col-1 s gr gr
- % arrowhead
- n 3048 4245 m 3168 4275 l 3048 4305 l 3048 4275 l 3048 4245 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1395 5265 m 2295 5265 l gs col-1 s gr
- % Polyline
- n 1395 5535 m 2295 5535 l gs col-1 s gr
- % Polyline
- n 1395 5040 m 2295 5040 l 2295 5805 l 1395 5805 l cp gs col-1 s gr
- % Polyline
- n 2025 5535 m 2025 5805 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 1710 5220 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1485 5445 m
- gs 1 -1 sc (opType: '=') col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1485 5715 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 2520 5535 m 3060 5535 l 3060 5805 l 2520 5805 l cp gs col-1 s gr
- % Polyline
- n 2790 5535 m 2790 5805 l gs col-1 s gr
- % Polyline
- n 3285 5535 m 3825 5535 l 3825 5805 l 3285 5805 l cp gs col-1 s gr
- % Polyline
- n 3555 5535 m 3555 5805 l gs col-1 s gr
- % Polyline
- n 3555 5535 m 3825 5805 l gs col-1 s gr
- % Polyline
- n 3825 5535 m 3555 5805 l gs col-1 s gr
- % Polyline
- gs clippath
- 3138 5640 m 3258 5670 l 3138 5700 l 3300 5700 l 3300 5640 l cp clip
- n 2925 5670 m 3285 5670 l gs col-1 s gr gr
- % arrowhead
- n 3138 5640 m 3258 5670 l 3138 5700 l 3138 5670 l 3138 5640 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 2373 5640 m 2493 5670 l 2373 5700 l 2535 5700 l 2535 5640 l cp clip
- n 2160 5670 m 2520 5670 l gs col-1 s gr gr
- % arrowhead
- n 2373 5640 m 2493 5670 l 2373 5700 l 2373 5670 l 2373 5640 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 3105 4815 m 4005 4815 l gs col-1 s gr
- % Polyline
- n 3105 5085 m 4005 5085 l gs col-1 s gr
- % Polyline
- n 3105 4590 m 4005 4590 l 4005 5355 l 3105 5355 l cp gs col-1 s gr
- % Polyline
- n 3735 5085 m 3735 5355 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3420 4770 m
- gs 1 -1 sc (Expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3195 4995 m
- gs 1 -1 sc (opType: '=') col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3195 5265 m
- gs 1 -1 sc (args) col-1 sh gr
- % Polyline
- n 4230 5085 m 4770 5085 l 4770 5355 l 4230 5355 l cp gs col-1 s gr
- % Polyline
- n 4500 5085 m 4500 5355 l gs col-1 s gr
- % Polyline
- n 4995 5085 m 5535 5085 l 5535 5355 l 4995 5355 l cp gs col-1 s gr
- % Polyline
- n 5265 5085 m 5265 5355 l gs col-1 s gr
- % Polyline
- n 5265 5085 m 5535 5355 l gs col-1 s gr
- % Polyline
- n 5535 5085 m 5265 5355 l gs col-1 s gr
- % Polyline
- n 3600 0 m 4140 0 l 4140 270 l 3600 270 l cp gs col-1 s gr
- % Polyline
- n 3870 0 m 3870 270 l gs col-1 s gr
- % Polyline
- n 3870 0 m 4140 270 l gs col-1 s gr
- % Polyline
- n 4140 0 m 3870 270 l gs col-1 s gr
- % Polyline
- n 3285 495 m 4185 495 l 4185 990 l 3285 990 l cp gs col-1 s gr
- % Polyline
- n 3285 720 m 4185 720 l gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3375 900 m
- gs 1 -1 sc (relname: "A") col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3600 675 m
- gs 1 -1 sc (RTE) col-1 sh gr
- % Polyline
- n 1395 315 m 1935 315 l 1935 585 l 1395 585 l cp gs col-1 s gr
- % Polyline
- n 1665 315 m 1665 585 l gs col-1 s gr
- % Polyline
- n 2160 315 m 2700 315 l 2700 585 l 2160 585 l cp gs col-1 s gr
- % Polyline
- n 2430 315 m 2430 585 l gs col-1 s gr
- % Polyline
- n 2430 315 m 2700 585 l gs col-1 s gr
- % Polyline
- n 2700 315 m 2430 585 l gs col-1 s gr
- % Polyline
- gs clippath
- 2013 420 m 2133 450 l 2013 480 l 2175 480 l 2175 420 l cp clip
- n 1800 450 m 2160 450 l gs col-1 s gr gr
- % arrowhead
- n 2013 420 m 2133 450 l 2013 480 l 2013 450 l 2013 420 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1440 2340 m 2340 2340 l gs col-1 s gr
- % Polyline
- n 1440 2115 m 2340 2115 l 2340 2610 l 1440 2610 l cp gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 1665 2295 m
- gs 1 -1 sc (Resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 2520 m
- gs 1 -1 sc (resname: C1) col-1 sh gr
- % Polyline
- n 2925 2340 m 3825 2340 l gs col-1 s gr
- % Polyline
- n 2925 2115 m 3825 2115 l 3825 2610 l 2925 2610 l cp gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 3150 2295 m
- gs 1 -1 sc (Resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 2520 m
- gs 1 -1 sc (resname: C2) col-1 sh gr
- % Polyline
- n 3600 5985 m 4140 5985 l 4140 6255 l 3600 6255 l cp gs col-1 s gr
- % Polyline
- n 3870 5985 m 3870 6255 l gs col-1 s gr
- % Polyline
- n 3870 5985 m 4140 6255 l gs col-1 s gr
- % Polyline
- n 4140 5985 m 3870 6255 l gs col-1 s gr
- % Polyline
- n 1395 6300 m 1935 6300 l 1935 6570 l 1395 6570 l cp gs col-1 s gr
- % Polyline
- n 1665 6300 m 1665 6570 l gs col-1 s gr
- % Polyline
- n 2160 6300 m 2700 6300 l 2700 6570 l 2160 6570 l cp gs col-1 s gr
- % Polyline
- n 2430 6300 m 2430 6570 l gs col-1 s gr
- % Polyline
- n 2430 6300 m 2700 6570 l gs col-1 s gr
- % Polyline
- n 2700 6300 m 2430 6570 l gs col-1 s gr
- % Polyline
- gs clippath
- 2013 6405 m 2133 6435 l 2013 6465 l 2175 6465 l 2175 6405 l cp clip
- n 1800 6435 m 2160 6435 l gs col-1 s gr gr
- % arrowhead
- n 2013 6405 m 2133 6435 l 2013 6465 l 2013 6435 l 2013 6405 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 1440 8325 m 2340 8325 l gs col-1 s gr
- % Polyline
- n 1440 8100 m 2340 8100 l 2340 8595 l 1440 8595 l cp gs col-1 s gr
- /Times-Roman ff 150.00 scf sf
- 1665 8280 m
- gs 1 -1 sc (Resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 8505 m
- gs 1 -1 sc (resname: C1) col-1 sh gr
- % Polyline
- n 180 225 m 1170 225 l gs col-1 s gr
- % Polyline
- n 180 495 m 1170 495 l gs col-1 s gr
- % Polyline
- n 180 765 m 1170 765 l gs col-1 s gr
- % Polyline
- n 180 1035 m 1170 1035 l gs col-1 s gr
- % Polyline
- n 900 225 m 900 1440 l gs col-1 s gr
- % Polyline
- n 180 0 m 1170 0 l 1170 1440 l 180 1440 l cp gs col-1 s gr
- % Polyline
- gs clippath
- 3300 3702 m 3330 3582 l 3360 3702 l 3360 3540 l 3300 3540 l cp clip
- n 3330 3915 m 3330 3555 l gs col-1 s gr gr
- % arrowhead
- n 3300 3702 m 3330 3582 l 3360 3702 l 3330 3702 l 3300 3702 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1815 3702 m 1845 3582 l 1875 3702 l 1875 3540 l 1815 3540 l cp clip
- n 1845 3915 m 1845 3555 l gs col-1 s gr gr
- % arrowhead
- n 1815 3702 m 1845 3582 l 1875 3702 l 1845 3702 l 1815 3702 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1875 4893 m 1845 5013 l 1815 4893 l 1815 5055 l 1875 5055 l cp clip
- n 1845 4275 m 1845 5040 l gs col-1 s gr gr
- % arrowhead
- n 1875 4893 m 1845 5013 l 1815 4893 l 1845 4893 l 1875 4893 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 1563 3885 m 1683 3915 l 1563 3945 l 1725 3945 l 1725 3885 l cp clip
- n 1035 3915 m 1710 3915 l gs col-1 s gr gr
- % arrowhead
- n 1563 3885 m 1683 3915 l 1563 3945 l 1563 3915 l 1563 3885 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 4848 5190 m 4968 5220 l 4848 5250 l 5010 5250 l 5010 5190 l cp clip
- n 4635 5220 m 4995 5220 l gs col-1 s gr gr
- % arrowhead
- n 4848 5190 m 4968 5220 l 4848 5250 l 4848 5220 l 4848 5190 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 4083 5190 m 4203 5220 l 4083 5250 l 4245 5250 l 4245 5190 l cp clip
- n 3870 5220 m 4230 5220 l gs col-1 s gr gr
- % arrowhead
- n 4083 5190 m 4203 5220 l 4083 5250 l 4083 5220 l 4083 5190 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- gs clippath
- 3765 348 m 3735 468 l 3705 348 l 3705 510 l 3765 510 l cp clip
- n 3735 135 m 3735 495 l gs col-1 s gr gr
- % arrowhead
- n 3765 348 m 3735 468 l 3705 348 l 3735 348 l 3765 348 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 3555 1395 m 3555 1935 l gs col-1 s gr
- % Polyline
- n 2925 1395 m 3825 1395 l gs col-1 s gr
- % Polyline
- n 2925 1665 m 3825 1665 l gs col-1 s gr
- % Polyline
- n 2925 1170 m 3825 1170 l 3825 1935 l 2925 1935 l cp gs col-1 s gr
- % Polyline
- n 2070 1395 m 2070 1935 l gs col-1 s gr
- % Polyline
- n 1440 1395 m 2340 1395 l gs col-1 s gr
- % Polyline
- n 1440 1665 m 2340 1665 l gs col-1 s gr
- % Polyline
- n 1440 1170 m 2340 1170 l 2340 1935 l 1440 1935 l cp gs col-1 s gr
- % Polyline
- n 180 6210 m 1170 6210 l gs col-1 s gr
- % Polyline
- n 180 6480 m 1170 6480 l gs col-1 s gr
- % Polyline
- n 180 6750 m 1170 6750 l gs col-1 s gr
- % Polyline
- n 180 7020 m 1170 7020 l gs col-1 s gr
- % Polyline
- n 900 6210 m 900 7425 l gs col-1 s gr
- % Polyline
- n 180 5985 m 1170 5985 l 1170 7425 l 180 7425 l cp gs col-1 s gr
- % Polyline
- gs clippath
- 3765 6333 m 3735 6453 l 3705 6333 l 3705 6495 l 3765 6495 l cp clip
- n 3735 6120 m 3735 6480 l gs col-1 s gr gr
- % arrowhead
- n 3765 6333 m 3735 6453 l 3705 6333 l 3735 6333 l 3765 6333 l cp gs 0.00 setgray ef gr col-1 s
- % Polyline
- n 3555 7380 m 3555 7920 l gs col-1 s gr
- % Polyline
- n 2925 7380 m 3825 7380 l gs col-1 s gr
- % Polyline
- n 2925 7650 m 3825 7650 l gs col-1 s gr
- % Polyline
- n 2925 7155 m 3825 7155 l 3825 7920 l 2925 7920 l cp gs col-1 s gr
- % Polyline
- n 2070 7380 m 2070 7920 l gs col-1 s gr
- % Polyline
- n 1440 7380 m 2340 7380 l gs col-1 s gr
- % Polyline
- n 1440 7650 m 2340 7650 l gs col-1 s gr
- % Polyline
- n 1440 7155 m 2340 7155 l 2340 7920 l 1440 7920 l cp gs col-1 s gr
- % Polyline
- n 2925 8325 m 3825 8325 l gs col-1 s gr
- % Polyline
- n 2925 8100 m 3825 8100 l 3825 8595 l 2925 8595 l cp gs col-1 s gr
- % Polyline
- n 3285 6480 m 4185 6480 l 4185 6975 l 3285 6975 l cp gs col-1 s gr
- % Polyline
- n 3285 6705 m 4185 6705 l gs col-1 s gr
- % Polyline
- n 1485 3015 m 2295 3015 l gs col-1 s gr
- % Polyline
- n 1485 3285 m 2295 3285 l gs col-1 s gr
- % Polyline
- n 1485 2790 m 2295 2790 l 2295 3555 l 1485 3555 l cp gs col-1 s gr
- % Polyline
- n 2970 3015 m 3780 3015 l gs col-1 s gr
- % Polyline
- n 2970 3285 m 3780 3285 l gs col-1 s gr
- % Polyline
- n 2970 2790 m 3780 2790 l 3780 3555 l 2970 3555 l cp gs col-1 s gr
- % Polyline
- n 1485 9000 m 2295 9000 l gs col-1 s gr
- % Polyline
- n 1485 9270 m 2295 9270 l gs col-1 s gr
- % Polyline
- n 1485 8775 m 2295 8775 l 2295 9540 l 1485 9540 l cp gs col-1 s gr
- % Polyline
- n 2970 9000 m 3780 9000 l gs col-1 s gr
- % Polyline
- n 2970 9270 m 3780 9270 l gs col-1 s gr
- % Polyline
- n 2970 8775 m 3780 8775 l 3780 9540 l 2970 9540 l cp gs col-1 s gr
- % Open spline
- gs clippath
- 2363 3284 m 2311 3171 l 2410 3246 l 2309 3120 l 2262 3157 l cp clip
- n 2655.0 5670.0 m 2655.0 4635.0 l
- 2655.0 4635.0 2655.0 3600.0 2475.0 3375.0 DrawSplineSection
- 2295.0 3150.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2363 3284 m 2311 3171 l 2410 3246 l 2387 3265 l 2363 3284 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3878 3263 m 3801 3166 l 3915 3216 l 3786 3117 l 3750 3165 l cp clip
- n 4365.0 5220.0 m 4365.0 4410.0 l
- 4365.0 4410.0 4365.0 3600.0 4072.5 3375.0 DrawSplineSection
- 3780.0 3150.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3878 3263 m 3801 3166 l 3915 3216 l 3897 3240 l 3878 3263 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 1577 4206 m 1684 4267 l 1560 4263 l 1716 4308 l 1733 4250 l cp clip
- n 1035.0 4185.0 m 1215.0 4185.0 l
- 1215.0 4185.0 1395.0 4185.0 1552.5 4230.0 DrawSplineSection
- 1710.0 4275.0 l gs col-1 s gr
- gr
- % arrowhead
- n 1577 4206 m 1684 4267 l 1560 4263 l 1569 4235 l 1577 4206 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3455 4478 m 3533 4573 l 3419 4526 l 3549 4623 l 3585 4575 l cp clip
- n 3330.0 4275.0 m 3352.5 4365.0 l
- 3352.5 4365.0 3375.0 4455.0 3465.0 4522.5 DrawSplineSection
- 3555.0 4590.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3455 4478 m 3533 4573 l 3419 4526 l 3437 4502 l 3455 4478 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 711 3409 m 676 3528 l 651 3407 l 644 3569 l 704 3571 l cp clip
- n 1016.0 890.0 m 1151.0 912.5 l
- 1151.0 912.5 1286.0 935.0 1286.0 1407.5 DrawSplineSection
- 1286.0 1407.5 1286.0 1880.0 993.5 2420.0 DrawSplineSection
- 993.5 2420.0 701.0 2960.0 688.0 3257.5 DrawSplineSection
- 675.0 3555.0 l gs col-1 s gr
- gr
- % arrowhead
- n 711 3409 m 676 3528 l 651 3407 l 681 3408 l 711 3409 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3453 105 m 3573 135 l 3453 165 l 3615 165 l 3615 105 l cp clip
- n 1035.0 360.0 m 1215.0 270.0 l
- 1215.0 270.0 1395.0 180.0 1912.5 157.5 DrawSplineSection
- 1912.5 157.5 2430.0 135.0 3015.0 135.0 DrawSplineSection
- 3600.0 135.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3453 105 m 3573 135 l 3453 165 l 3453 135 l 3453 105 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 1270 533 m 1375 469 l 1312 575 l 1427 461 l 1384 418 l cp clip
- n 1035.0 630.0 m 1147.5 607.5 l
- 1147.5 607.5 1260.0 585.0 1327.5 517.5 DrawSplineSection
- 1395.0 450.0 l gs col-1 s gr
- gr
- % arrowhead
- n 1270 533 m 1375 469 l 1312 575 l 1291 554 l 1270 533 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 1807 1045 m 1870 1150 l 1765 1087 l 1879 1202 l 1922 1159 l cp clip
- n 1530.0 450.0 m 1552.5 652.5 l
- 1552.5 652.5 1575.0 855.0 1732.5 1012.5 DrawSplineSection
- 1890.0 1170.0 l gs col-1 s gr
- gr
- % arrowhead
- n 1807 1045 m 1870 1150 l 1765 1087 l 1786 1066 l 1807 1045 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3262 1071 m 3351 1156 l 3232 1123 l 3373 1203 l 3403 1151 l cp clip
- n 2295.0 450.0 m 2362.5 697.5 l
- 2362.5 697.5 2430.0 945.0 2745.0 967.5 DrawSplineSection
- 2745.0 967.5 3060.0 990.0 3217.5 1080.0 DrawSplineSection
- 3375.0 1170.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3262 1071 m 3351 1156 l 3232 1123 l 3247 1097 l 3262 1071 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2035 2076 m 1914 2102 l 2008 2022 l 1863 2095 l 1890 2149 l cp clip
- n 2205.0 1530.0 m 2362.5 1530.0 l
- 2362.5 1530.0 2520.0 1530.0 2520.0 1777.5 DrawSplineSection
- 2520.0 1777.5 2520.0 2025.0 2295.0 2025.0 DrawSplineSection
- 2295.0 2025.0 2070.0 2025.0 1980.0 2070.0 DrawSplineSection
- 1890.0 2115.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2035 2076 m 1914 2102 l 2008 2022 l 2021 2049 l 2035 2076 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2029 2733 m 1912 2775 l 1996 2683 l 1861 2773 l 1894 2823 l cp clip
- n 2205.0 1800.0 m 2407.5 1800.0 l
- 2407.5 1800.0 2610.0 1800.0 2610.0 2047.5 DrawSplineSection
- 2610.0 2047.5 2610.0 2295.0 2610.0 2497.5 DrawSplineSection
- 2610.0 2497.5 2610.0 2700.0 2317.5 2700.0 DrawSplineSection
- 2317.5 2700.0 2025.0 2700.0 1957.5 2745.0 DrawSplineSection
- 1890.0 2790.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2029 2733 m 1912 2775 l 1996 2683 l 2012 2708 l 2029 2733 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3520 2751 m 3399 2777 l 3493 2697 l 3348 2770 l 3375 2824 l cp clip
- n 3690.0 1800.0 m 3892.5 1800.0 l
- 3892.5 1800.0 4095.0 1800.0 4095.0 2047.5 DrawSplineSection
- 4095.0 2047.5 4095.0 2295.0 4095.0 2497.5 DrawSplineSection
- 4095.0 2497.5 4095.0 2700.0 3825.0 2700.0 DrawSplineSection
- 3825.0 2700.0 3555.0 2700.0 3465.0 2745.0 DrawSplineSection
- 3375.0 2790.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3520 2751 m 3399 2777 l 3493 2697 l 3506 2724 l 3520 2751 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3520 2076 m 3399 2102 l 3493 2022 l 3348 2095 l 3375 2149 l cp clip
- n 3690.0 1530.0 m 3847.5 1530.0 l
- 3847.5 1530.0 4005.0 1530.0 4005.0 1777.5 DrawSplineSection
- 4005.0 1777.5 4005.0 2025.0 3780.0 2025.0 DrawSplineSection
- 3780.0 2025.0 3555.0 2025.0 3465.0 2070.0 DrawSplineSection
- 3375.0 2115.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3520 2076 m 3399 2102 l 3493 2022 l 3506 2049 l 3520 2076 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3453 6090 m 3573 6120 l 3453 6150 l 3615 6150 l 3615 6090 l cp clip
- n 1035.0 6345.0 m 1215.0 6255.0 l
- 1215.0 6255.0 1395.0 6165.0 1912.5 6142.5 DrawSplineSection
- 1912.5 6142.5 2430.0 6120.0 3015.0 6120.0 DrawSplineSection
- 3600.0 6120.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3453 6090 m 3573 6120 l 3453 6150 l 3453 6120 l 3453 6090 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 1270 6518 m 1375 6454 l 1312 6560 l 1427 6446 l 1384 6403 l cp clip
- n 1035.0 6615.0 m 1147.5 6592.5 l
- 1147.5 6592.5 1260.0 6570.0 1327.5 6502.5 DrawSplineSection
- 1395.0 6435.0 l gs col-1 s gr
- gr
- % arrowhead
- n 1270 6518 m 1375 6454 l 1312 6560 l 1291 6539 l 1270 6518 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 1807 7030 m 1870 7135 l 1765 7072 l 1879 7187 l 1922 7144 l cp clip
- n 1530.0 6435.0 m 1552.5 6637.5 l
- 1552.5 6637.5 1575.0 6840.0 1732.5 6997.5 DrawSplineSection
- 1890.0 7155.0 l gs col-1 s gr
- gr
- % arrowhead
- n 1807 7030 m 1870 7135 l 1765 7072 l 1786 7051 l 1807 7030 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3262 7056 m 3351 7141 l 3232 7108 l 3373 7188 l 3403 7136 l cp clip
- n 2295.0 6435.0 m 2362.5 6682.5 l
- 2362.5 6682.5 2430.0 6930.0 2745.0 6952.5 DrawSplineSection
- 2745.0 6952.5 3060.0 6975.0 3217.5 7065.0 DrawSplineSection
- 3375.0 7155.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3262 7056 m 3351 7141 l 3232 7108 l 3247 7082 l 3262 7056 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2035 8061 m 1914 8087 l 2008 8007 l 1863 8080 l 1890 8134 l cp clip
- n 2205.0 7515.0 m 2362.5 7515.0 l
- 2362.5 7515.0 2520.0 7515.0 2520.0 7762.5 DrawSplineSection
- 2520.0 7762.5 2520.0 8010.0 2295.0 8010.0 DrawSplineSection
- 2295.0 8010.0 2070.0 8010.0 1980.0 8055.0 DrawSplineSection
- 1890.0 8100.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2035 8061 m 1914 8087 l 2008 8007 l 2021 8034 l 2035 8061 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2029 8718 m 1912 8760 l 1996 8668 l 1861 8758 l 1894 8808 l cp clip
- n 2205.0 7785.0 m 2407.5 7785.0 l
- 2407.5 7785.0 2610.0 7785.0 2610.0 8032.5 DrawSplineSection
- 2610.0 8032.5 2610.0 8280.0 2610.0 8482.5 DrawSplineSection
- 2610.0 8482.5 2610.0 8685.0 2317.5 8685.0 DrawSplineSection
- 2317.5 8685.0 2025.0 8685.0 1957.5 8730.0 DrawSplineSection
- 1890.0 8775.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2029 8718 m 1912 8760 l 1996 8668 l 2012 8693 l 2029 8718 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3520 8736 m 3399 8762 l 3493 8682 l 3348 8755 l 3375 8809 l cp clip
- n 3690.0 7785.0 m 3892.5 7785.0 l
- 3892.5 7785.0 4095.0 7785.0 4095.0 8032.5 DrawSplineSection
- 4095.0 8032.5 4095.0 8280.0 4095.0 8482.5 DrawSplineSection
- 4095.0 8482.5 4095.0 8685.0 3825.0 8685.0 DrawSplineSection
- 3825.0 8685.0 3555.0 8685.0 3465.0 8730.0 DrawSplineSection
- 3375.0 8775.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3520 8736 m 3399 8762 l 3493 8682 l 3506 8709 l 3520 8736 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3520 8061 m 3399 8087 l 3493 8007 l 3348 8080 l 3375 8134 l cp clip
- n 3690.0 7515.0 m 3847.5 7515.0 l
- 3847.5 7515.0 4005.0 7515.0 4005.0 7762.5 DrawSplineSection
- 4005.0 7762.5 4005.0 8010.0 3780.0 8010.0 DrawSplineSection
- 3780.0 8010.0 3555.0 8010.0 3465.0 8055.0 DrawSplineSection
- 3375.0 8100.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3520 8061 m 3399 8087 l 3493 8007 l 3506 8034 l 3520 8061 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 3930 9145 m 3806 9131 l 3922 9085 l 3761 9107 l 3769 9167 l cp clip
- n 5130.0 5220.0 m 5130.0 6930.0 l
- 5130.0 6930.0 5130.0 8640.0 4950.0 8820.0 DrawSplineSection
- 4950.0 8820.0 4770.0 9000.0 4275.0 9067.5 DrawSplineSection
- 3780.0 9135.0 l gs col-1 s gr
- gr
- % arrowhead
- n 3930 9145 m 3806 9131 l 3922 9085 l 3926 9115 l 3930 9145 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 2444 9150 m 2321 9132 l 2438 9091 l 2277 9107 l 2283 9166 l cp clip
- n 3420.0 5670.0 m 3217.5 6030.0 l
- 3217.5 6030.0 3015.0 6390.0 2880.0 6750.0 DrawSplineSection
- 2880.0 6750.0 2745.0 7110.0 2745.0 8100.0 DrawSplineSection
- 2745.0 8100.0 2745.0 9090.0 2520.0 9112.5 DrawSplineSection
- 2295.0 9135.0 l gs col-1 s gr
- gr
- % arrowhead
- n 2444 9150 m 2321 9132 l 2438 9091 l 2441 9120 l 2444 9150 l cp gs 0.00 setgray ef gr col-1 s
- % Open spline
- gs clippath
- 740 5850 m 681 5958 l 682 5835 l 642 5992 l 700 6007 l cp clip
- n 1035.0 4455.0 m 1170.0 4455.0 l
- 1170.0 4455.0 1305.0 4455.0 1282.5 4972.5 DrawSplineSection
- 1282.5 4972.5 1260.0 5490.0 1012.5 5557.5 DrawSplineSection
- 1012.5 5557.5 765.0 5625.0 720.0 5805.0 DrawSplineSection
- 675.0 5985.0 l gs col-1 s gr
- gr
- % arrowhead
- n 740 5850 m 681 5958 l 682 5835 l 711 5842 l 740 5850 l cp gs 0.00 setgray ef gr col-1 s
- /Times-Roman ff 150.00 scf sf
- 495 180 m
- gs 1 -1 sc (Query) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 540 1170 m
- gs 1 -1 sc 270.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 945 m
- gs 1 -1 sc (qual) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 675 m
- gs 1 -1 sc (targetlist) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 405 m
- gs 1 -1 sc (rtable) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3240 1350 m
- gs 1 -1 sc (TLE) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 1575 m
- gs 1 -1 sc (resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 1845 m
- gs 1 -1 sc (expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1755 1350 m
- gs 1 -1 sc (TLE) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 1575 m
- gs 1 -1 sc (resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 1845 m
- gs 1 -1 sc (expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 495 6165 m
- gs 1 -1 sc (Query) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 540 7155 m
- gs 1 -1 sc 270.0 rot (. . .) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 6390 m
- gs 1 -1 sc (rtable) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 6660 m
- gs 1 -1 sc (targetlist) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 270 6930 m
- gs 1 -1 sc (qual) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3240 7335 m
- gs 1 -1 sc (TLE) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 7560 m
- gs 1 -1 sc (resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 7830 m
- gs 1 -1 sc (expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1755 7335 m
- gs 1 -1 sc (TLE) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 7560 m
- gs 1 -1 sc (resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1530 7830 m
- gs 1 -1 sc (expr) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3150 8280 m
- gs 1 -1 sc (Resdom) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3015 8505 m
- gs 1 -1 sc (resname: C3) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3375 6885 m
- gs 1 -1 sc (relname: "C") col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3600 6660 m
- gs 1 -1 sc (RTE) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1620 2970 m
- gs 1 -1 sc (VAR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1575 3195 m
- gs 1 -1 sc (varno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1575 3480 m
- gs 1 -1 sc (varattno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3105 2970 m
- gs 1 -1 sc (VAR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3060 3195 m
- gs 1 -1 sc (varno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3060 3480 m
- gs 1 -1 sc (varattno: 2) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1620 8955 m
- gs 1 -1 sc (VAR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1575 9180 m
- gs 1 -1 sc (varno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3105 8955 m
- gs 1 -1 sc (VAR) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3060 9180 m
- gs 1 -1 sc (varno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 1575 9465 m
- gs 1 -1 sc (varattno: 1) col-1 sh gr
- /Times-Roman ff 150.00 scf sf
- 3060 9465 m
- gs 1 -1 sc (varattno: 2) col-1 sh gr
- showpage
- $F2psEnd
- rs
- %%EndDocument
- @endspecial 517 3325 a(Figure)12 b(3.14:)j(Data)e(structure)e(of)h
- Fk(A)g Fo(\)f Fk(C)16 b Ft(after)11 b(query)h(re)o(writing)p
- eop
- %%Page: 110 110
- 110 109 bop 270 60 a Ft(110)57 b Fm(CHAPTER)14 b(3.)28
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 270 234 y Ft(If)h(the)g(user')m(s)g(query)g(in)n(v)o(olv)o(es)h
- Fp(union)f Ft(as)g(well)h(as)g Fp(intersect)f Ft(or)g
- Fp(e)o(xcept)h Ft(there)e(will)h(be)h(more)f Fr(Query)270
- 294 y Ft(nodes)f(of)f(the)h(form)f(sho)o(wn)g(in)h( 02gure)f(3.14.)16
- b(One)c(will)f(be)h(the)f(topmost)h(node)f((as)h(described)g(abo)o(v)o
- (e))270 354 y(and)j(the)g(others)g(will)f(be)h(collected)g(in)g(a)g
- (list)g(which)f(is)i(attached)f(to)f(the)h( 02eld)g
- Fr(unionClause)f Ft(of)270 413 y(the)k(topmost)f(node.)32
- b((The)18 b Fp(intersectClause)g Ft( 02elds)g(of)f(all)g
- Fr(Query)h Ft(nodes)g(will)f(be)h(set)g(to)f Fr(NULL)270
- 473 y Ft(because)c(the)o(y)g(are)f(no)g(longer)g(needed.))270
- 593 y(The)28 b(function)f Fr(pg)p 632 593 15 2 v 17 w(parse)p
- 799 593 V 18 w(and)p 907 593 V 17 w(plan())g Ft(is)h(responsible)g
- (for)e(in)n(v)o(oking)h(the)h(re)o(write)e(pro-)270 653
- y(cedure.)16 b(It)c(can)g(be)h(found)e(in)h(the)h( 02le)f
- Fk(:)c(:)g(:)p Fr(/src/backend/tcop/postgres.c)p Ft(.)330
- 845 y Fr(List)29 b(*)330 905 y(pg_parse_and_plan(char)e
- (*query_string,)i(Oid)g(*typev,)868 965 y(int)g(nargs,)868
- 1024 y(QueryTreeList)f(**queryListP,)868 1084 y(CommandDest)g(dest))
- 330 1144 y({)1107 1204 y(.)1107 1264 y(.)1107 1323 y(.)390
- 1383 y(/*)h(Rewrite)g(Union,)h(Intersect)e(and)i(Except)f(Queries)419
- 1443 y(*)h(to)g(normal)f(Union)g(Queries)h(using)f(IN)h(and)f(NOT)419
- 1503 y(*)h(IN)g(subselects)f(*/)390 1562 y
- (if(querytree->intersectClaus)o(e)e(!=)j(NIL))390 1622
- y({)449 1682 y(querytree)f(=)h(Except_Intersect_Rewrite(querytr)o
- (ee);)390 1742 y(})1107 1802 y(.)1107 1861 y(.)1107
- 1921 y(.)330 1981 y(})270 2150 y Ft(Here)14 b(are)f(the)h(functions)f
- (that)h(ha)o(v)o(e)g(been)g(added)g(to)g(perform)e(the)i(functionality)
- e(described)i(abo)o(v)o(e.)270 2210 y(The)o(y)f(can)g(be)f(found)g(in)g
- (the)g( 02le)g Fk(:)c(:)g(:)q Fr(/src/backend/rewrite/rewrite)o
- (Handler.c)o Ft(.)345 2379 y Fo( 17)25 b Fr(Except)p
- 578 2379 V 17 w(Intersect)p 865 2379 V 17 w(Rewrite())395
- 2439 y Ft(Re)o(writes)19 b(queries)g(in)n(v)o(olving)f
- Fp(union)h(clauses)p Ft(,)j Fp(intersect)d(clauses)h
- Ft(and)f Fp(e)o(xcept)g(clauses)h Ft(to)395 2499 y(semantiacally)12
- b(equi)o(v)o(alent)f(queries)i(that)f(use)h Fr(IN)f Ft(and)g
- Fr(NOT)30 b(IN)12 b Ft(subselects)i(instead.)395 2625
- y(The)23 b Fp(oper)o(ator)g(tr)n(ee)h Ft(is)f(attached)g(to)f
- Fr(intersectClause)g Ft((see)h(rule)f Fr(SelectStmt)395
- 2685 y Ft(abo)o(v)o(e))f(of)f(the)h Fp(parsetr)n(ee)h
- Ft(gi)o(v)o(en)f(as)g(an)g(ar)o(gument.)41 b(First)21
- b(we)g(sa)o(v)o(e)g(some)h(clauses)g((the)395 2745 y
- Fr(sortClause)p Ft(,)j(the)e Fr(unique)29 b(flag)23 b
- Ft(etc.).)48 b(Then)23 b(we)h(translate)f(the)g Fp(oper)o(ator)g(tr)n
- (ee)395 2804 y Ft(to)d(DNF)g(()p Fp(Disjunctive)g(Normal)h(F)-5
- b(orm)p Ft())20 b(by)h Fr(cnfify())p Ft(.)39 b(Note)20
- b(that)g Fr(cnfify())g Ft(pro-)395 2864 y(duces)27
- b(CNF)g(b)o(ut)g(as)h(we)f(e)o(xchanged)h Fr(AND)f Ft(nodes)g(with)g
- Fr(OR)g Ft(nodes)g(within)g(function)395 2924 y Fr(A)p
- 428 2924 V 17 w(Expr)p 565 2924 V 18 w(to)p 643 2924
- V 18 w(Expr())17 b Ft(earlier)g(we)h(get)f(DNF)h(when)g(we)g(e)o
- (xchange)g Fr(AND)f Ft(nodes)h(and)g Fr(OR)395 2984 y
- Ft(nodes)c(again)g(in)g(the)g(result.)21 b(No)o(w)14
- b(we)h(create)f(a)g(ne)o(w)g((re)o(written))e(query)i(by)g(e)o
- (xamining)g(the)395 3044 y(ne)o(w)f Fp(oper)o(ator)i(tr)n(ee)f
- Ft(which)g(is)g(in)g(DNF)f(no)o(w)m(.)20 b(F)o(or)13
- b(e)o(v)o(ery)h Fr(AND)f Ft(node)h(we)g(create)g(an)g(entry)f(in)395
- 3103 y(the)e Fp(union)g(list)h Ft(and)g(for)f(e)o(v)o(ery)g
- Fr(OR)h Ft(node)f(we)h(create)g(an)g Fr(IN)f Ft(subselect.)16
- b(()p Fr(NOT)29 b(IN)12 b Ft(subselects)395 3163 y(are)i(created)g
- (for)f Fr(OR)30 b(NOT)14 b Ft(nodes).)21 b(The)14 b( 02rst)g(entry)g
- (of)f(the)i Fp(union)e(list)h Ft(is)h(handed)f(back)g(b)o(ut)395
- 3223 y(before)e(that)h(the)h(sa)o(v)o(ed)g(clauses)g(()p
- Fr(sortClause)e Ft(etc.))18 b(are)13 b(restored)g(to)g(the)h(ne)o(w)f
- (top)g(node.)395 3283 y(Note)d(that)g(the)g(ne)o(w)g(top)h(node)f(can)g
- (dif)o(fer)f(from)h(the)g(one)g(of)g(the)g Fp(parsetr)n(ee)i
- Ft(gi)o(v)o(en)e(as)h(ar)o(gument)395 3342 y(because)k(of)g(the)f
- (translation)h(into)f(DNF)l(.)h(That')m(s)h(why)e(we)h(had)g(to)g(sa)o
- (v)o(e)g(the)g Fr(sortClause)395 3402 y Ft(etc.)p eop
- %%Page: 111 111
- 111 110 bop 198 60 a Fm(3.8.)26 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)327
- b Ft(111)382 234 y Fr(Query)30 b(*)382 294 y(Except_Intersect_Rewrite)e
- ((Query)h(*parsetree))382 354 y({)1219 413 y(.)1219
- 473 y(.)1219 533 y(.)442 593 y(/*)h(Save)f(some)h(fields,)f(to)g(be)h
- (able)f(to)h(restore)f(them)472 653 y(*)h(to)f(the)h(resulting)f(top)g
- (node)h(at)f(the)h(end)g(of)f(the)472 712 y(*)h(function)472
- 772 y(*/)442 832 y(sortClause)f(=)h(parsetree->sortClause;)442
- 892 y(uniqueFlag)f(=)h(parsetree->uniqueFlag;)442 951
- y(into)g(=)f(parsetree->into;)442 1011 y(isBinary)g(=)h
- (parsetree->isBinary;)442 1071 y(isPortal)f(=)h(parsetree->isPortal;)
- 442 1191 y(/*)g(Transform)f(the)g(SelectStmt)g(nodes)g(into)h(Query)f
- (nodes)472 1250 y(*)h(as)f(usually)h(done)f(by)h
- (transformSelectStmt())d(earlier.)472 1310 y(*)j(/)442
- 1370 y(intersectClause)e(=)502 1430 y((List)h
- (*)intersect_tree_analyze()741 1489 y((Node)g
- (*)parsetree->intersectClause,)741 1549 y((Node)g
- (*)lfirst(parsetree->unionClause),)741 1609 y((Node)g
- (*)parsetree);)1219 1669 y(.)1219 1729 y(.)1219 1788
- y(.)442 1848 y(/*)h(Transform)f(the)g(operator)g(tree)h(to)f(DNF)h(*/)
- 442 1908 y(intersectClause)e(=)801 1968 y(cnfify((Expr)g
- (*)intersectClause,)g(true);)442 2027 y(/*)i(For)f(every)h(entry)f
- (of)h(the)f(intersectClause)f(list)i(we)472 2087 y(*)g(generate)f(one)g
- (entry)h(in)f(the)h(union_list)472 2147 y(*/)442 2207
- y(foreach(intersect,)e(intersectClause))442 2267 y({)502
- 2326 y(/*)i(For)f(every)g(OR)h(we)g(create)f(an)h(IN)f(subselect)g(and)
- 532 2386 y(*)h(for)f(every)g(OR)h(NOT)g(we)f(create)g(a)h(NOT)g(IN)f
- (subselect,)532 2446 y(*/)502 2506 y(intersect_list)f(=)i(NIL;)502
- 2565 y(create_list((Node)e(*)lfirst(intersect),)861
- 2625 y(&intersect_list);)502 2685 y(/*)i(The)f(first)g(node)h(will)f
- (become)g(the)h(Select)f(Query)532 2745 y(*)h(node,)f(all)g(other)h
- (nodes)f(are)h(transformed)e(into)532 2804 y(*)i(subselects)e(under)i
- (this)f(node!)532 2864 y(*/)502 2924 y(intersect_node)f(=)i((Query)f
- (*)lfirst(intersect_list);)502 2984 y(intersect_list)f(=)i
- (lnext(intersect_list);)1219 3044 y(.)1219 3103 y(.)1219
- 3163 y(.)502 3223 y(/*)g(Transform)e(all)i(remaining)f(nodes)g(into)h
- (subselects)532 3283 y(*)g(and)f(add)h(them)f(to)h(the)f
- (qualifications)g(of)g(the)532 3342 y(*)h(Select)f(Query)g(node)532
- 3402 y(*/)p eop
- %%Page: 112 112
- 112 111 bop 270 60 a Ft(112)60 b Fm(CHAPTER)14 b(3.)25
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 574 234 y Fr(while(intersect_list)28 b(!=)h(NIL))574
- 294 y({)634 354 y(n)g(=)h(makeNode(SubLink);)634 473
- y(/*)f(Here)h(we)f(got)h(an)g(OR)f(so)h(transform)f(it)g(to)h(an)664
- 533 y(*)f(IN)h(subselect)664 593 y(*/)634 653 y
- (if(IsA(lfirst(intersect_list)o(),)d(Query)))634
- 712 y({)1291 772 y(.)1291 832 y(.)1291 892 y(.)693 951
- y(n->subselect)i(=)h(lfirst(intersect_list);)693 1011
- y(op)g(=)g("=";)693 1071 y(n->subLinkType)f(=)h(ANY_SUBLINK;)693
- 1131 y(n->useor)f(=)h(false;)634 1191 y(})634 1310 y(/*)f(Here)h(we)f
- (got)h(an)g(OR)f(NOT)h(node)f(so)h(transform)664 1370
- y(*)f(it)h(to)g(a)f(NOT)h(IN)60 b(subselect)664 1430
- y(*/)634 1489 y(else)634 1549 y({)1291 1609 y(.)1291
- 1669 y(.)1291 1729 y(.)693 1788 y(n->subselect)29 b(=)783
- 1848 y((Node)g(*)lfirst(((Expr)g(*))962 1908 y
- (lfirst(intersect_list))->args);)693 1968 y(op)h(=)g("<>";)693
- 2027 y(n->subLinkType)f(=)h(ALL_SUBLINK;)693 2087 y(n->useor)f(=)h
- (true;)634 2147 y(})634 2267 y(/*)f(Prepare)g(the)h(lefthand)f(side)g
- (of)h(the)g(Sublinks:)664 2326 y(*)f(All)h(the)f(entries)h(of)f(the)h
- (targetlist)e(must)i(be)664 2386 y(*)f((IN))h(or)f(must)h(not)f(be)h
- ((NOT)f(IN))h(the)g(subselect)664 2446 y(*/)634 2506
- y(foreach(elist,)e(intersect_node->targetList))634
- 2565 y({)693 2625 y(Node)239 b(*expr)29 b(=)h(lfirst(elist);)693
- 2685 y(TargetEntry)f(*tent)g(=)h((TargetEntry)f(*)expr;)693
- 2804 y(n->lefthand)g(=)903 2864 y(lappend(n->lefthand,)e
- (tent->expr);)634 2924 y(})634 3044 y(/*)i(The)h(first)f(arguments)g
- (of)h(oper)f(also)h(have)f(to)h(be)664 3103 y(*)f(created)g(for)h(the)g
- (sublink)f((they)g(are)g(the)h(same)664 3163 y(*)f(as)h(the)g
- (lefthand)f(side!))664 3223 y(*/)634 3283 y(left_expr)g(=)g
- (n->lefthand;)634 3342 y(right_expr)f(=)783 3402 y(((Query)h
- (*)(n->subselect))->targetList;)p eop
- %%Page: 113 113
- 113 112 bop 198 60 a Fm(3.8.)29 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)324
- b Ft(113)562 234 y Fr(foreach(elist,)28 b(left_expr))562
- 294 y({)621 354 y(Node)269 b(*lexpr)29 b(=)h(lfirst(elist);)621
- 413 y(Node)269 b(*rexpr)29 b(=)h(lfirst(right_expr);)621
- 473 y(TargetEntry)f(*tent)g(=)h((TargetEntry)f(*))g(rexpr;)621
- 533 y(Expr)269 b(*op_expr;)621 653 y(op_expr)30 b(=)f(make_op(op,)g
- (lexpr,)g(tent->expr);)621 712 y(n->oper)h(=)f(lappend(n->oper,)f
- (op_expr);)621 772 y(right_expr)h(=)h(lnext(right_expr);)562
- 832 y(})562 951 y(/*)f(If)h(the)g(Select)f(Query)g(node)g(has)h
- (aggregates)592 1011 y(*)f(in)h(use)g(add)f(all)h(the)f(subselects)g
- (to)h(the)592 1071 y(*)f(HAVING)h(qual)f(else)g(to)h(the)g(WHERE)f
- (qual)592 1131 y(*/)562 1191 y(if(intersect_node->hasAggs)e(==)i
- (false))562 1250 y({)621 1310 y(AddQual(intersect_node,)f((Node)h
- (*)n);)562 1370 y(})562 1430 y(else)562 1489 y({)621
- 1549 y(AddHavingQual(intersect_node,)e((Node)i(*)n);)562
- 1609 y(})562 1729 y(/*)g(Now)h(we)g(got)f(sublinks)g(*/)562
- 1788 y(intersect_node->hasSubLinks)d(=)k(true;)562 1848
- y(intersect_list)e(=)i(lnext(intersect_list);)502 1908
- y(})502 1968 y(intersect_node->intersectClaus)o(e)d(=)j(NIL;)502
- 2027 y(union_list)f(=)g(lappend(union_list,)f(intersect_node);)442
- 2087 y(})442 2207 y(/*)i(The)f(first)h(entry)f(to)h(union_list)e(is)i
- (our)472 2267 y(*)g(new)f(top)h(node)472 2326 y(*/)442
- 2386 y(result)f(=)h((Query)f(*)lfirst(union_list);)442
- 2506 y(/*)h(attach)f(the)h(rest)f(to)h(unionClause)e(*/)442
- 2565 y(result->unionClause)g(=)i(lnext(union_list);)442
- 2685 y(/*)g(Attach)f(all)h(the)f(items)g(saved)h(in)f(the)472
- 2745 y(*)h(beginning)f(of)g(the)h(function)f(*/)442 2804
- y(result->sortClause)f(=)i(sortClause;)442 2864 y(result->uniqueFlag)e
- (=)i(uniqueFlag;)442 2924 y(result->into)f(=)g(into;)442
- 2984 y(result->isPortal)f(=)i(isPortal;)442 3044 y(result->isBinary)e
- (=)i(isBinary;)1219 3103 y(.)1219 3163 y(.)1219 3223
- y(.)442 3283 y(return)59 b(result;)382 3342 y(})p eop
- %%Page: 114 114
- 114 113 bop 270 60 a Ft(114)60 b Fm(CHAPTER)14 b(3.)25
- b(POSTGRESQL)13 b(FR)n(OM)f(THE)i(PR)n(OGRAMMER'S)f(POINT)f(OF)g(VIEW)
- 345 234 y Fo( 17)25 b Fr(create)p 578 234 15 2 v 17
- w(list())395 294 y Ft(Create)19 b(a)h(list)g(of)f(nodes)h(that)f(are)
- g(either)h Fr(Query)f Ft(nodes)h(or)f Fr(NOT)g Ft(nodes)h(follo)o(wed)e
- (by)i(a)395 354 y Fr(Query)11 b Ft(node.)16 b(The)c Fp(tr)n(ee)h
- Ft(gi)o(v)o(en)f(in)f Fr(ptr)h Ft(contains)g(at)g(least)h(one)f
- Fp(non)f(ne)n(gated)h Fr(Query)g Ft(node.)395 413 y(This)h(node)f(is)h
- (put)f(to)g(the)g(be)o(ginning)g(of)g(the)g(list.)454
- 533 y Fr(void)30 b(create_list(Node)e(*ptr,)962 593
- y(List)i(**intersect_list))454 653 y({)514 712 y(List)g(*arg;)514
- 832 y(if(IsA(ptr,Query)))514 892 y({)574 951 y(/*)g(The)f(non)h
- (negated)f(node)g(is)h(attached)f(at)g(the)604 1011 y(*)h(beginning)e
- ((lcons))i(*/)574 1071 y(*intersect_list)e(=)i(lcons(ptr,)f
- (*intersect_list);)574 1131 y(return;)514 1191 y(})514
- 1250 y(if(IsA(ptr,Expr)))514 1310 y({)574 1370 y(if(((Expr)g
- (*)ptr)->opType)f(==)i(NOT_EXPR))574 1430 y({)634
- 1489 y(/*)f(negated)g(nodes)h(are)f(appended)g(to)h(the)664
- 1549 y(*)f(end)h((lappend))664 1609 y(*/)634 1669 y(*intersect_list)e
- (=)843 1729 y(lappend(*intersect_list,)f(ptr);)634
- 1788 y(return;)574 1848 y(})574 1908 y(else)574 1968
- y({)634 2027 y(foreach(arg,)h(((Expr)h(*)ptr)->args))634
- 2087 y({)693 2147 y(create_list(lfirst(arg),)f(intersect_list);)634
- 2207 y(})634 2267 y(return;)574 2326 y(})574 2386 y(return;)514
- 2446 y(})454 2506 y(})345 2625 y Fo( 17)d Fr(intersect)p
- 668 2625 V 16 w(tree)p 804 2625 V 18 w(analyze())395
- 2685 y Ft(The)32 b(nodes)h(gi)o(v)o(en)f(in)g Fr(tree)g
- Ft(are)g(not)g(transformed)f(yet)h(so)g(process)h(them)f(using)395
- 2745 y Fr(parse)p 548 2745 V 17 w(analyze())p Ft(.)d(The)18
- b(node)f(gi)o(v)o(en)g(in)g Fr(first)p 1417 2745 V 18
- w(select)f Ft(has)i(already)f(been)g(pro-)395 2804 y(cessed,)e(so)f
- (don')o(t)e(transform)h(it)g(again)g(b)o(ut)g(return)g(a)g(pointer)g
- (to)g(the)h(already)f(processed)h(v)o(er)o(-)395 2864
- y(sion)e(gi)o(v)o(en)g(in)g Fr(parsetree)g Ft(instead.)454
- 2984 y Fr(Node)30 b(*intersect_tree_analyze(Node)c(*tree,)873
- 3044 y(Node)j(*first_select,)f(Node)i(*parsetree))454
- 3103 y({)514 3163 y(Node)g(*result;)514 3223 y(List)g(*arg;)514
- 3342 y(if(IsA(tree,)f(SelectStmt)))514 3402 y({)p
- eop
- %%Page: 115 115
- 115 114 bop 198 60 a Fm(3.8.)29 b(THE)13 b(REALIZA)-6
- b(TION)14 b(OF)e(UNION,)g(INTERSECT)i(AND)f(EXCEPT)324
- b Ft(115)502 234 y Fr(QueryTreeList)28 b(*qtree;)502
- 354 y(/*)i(If)f(we)h(get)f(to)h(the)g(tree)f(given)g(in)h(first_select)
- 532 413 y(*)g(return)f(parsetree)g(instead)g(of)g(performing)532
- 473 y(*)h(parse_analyze())e(*/)502 533 y(if(tree)h(==)h
- (first_select))502 593 y({)562 653 y(result)f(=)h(parsetree;)502
- 712 y(})502 772 y(else)502 832 y({)562 892 y(/*)f(transform)g(the)h
- (unprocessed)e(Query)i(nodes)f(*/)562 951 y(qtree)g(=)711
- 1011 y(parse_analyze(lcons(tree,)e(NIL),)i(NULL);)562
- 1071 y(result)g(=)h((Node)f(*)qtree->qtrees[0];)502
- 1131 y(})442 1191 y(})442 1250 y(if(IsA(tree,Expr)))442
- 1310 y({)502 1370 y(/*)h(Call)f(recursively)g(for)g(every)g(argument)g
- (*/)532 1430 y(foreach(arg,)f(((Expr)i(*)tree)->args))532
- 1489 y({)592 1549 y(lfirst(arg))e(=)711 1609 y
- (intersect_tree_analyze(lfirst(ar)o(g),)1100 1669
- y(first_select,)g(parsetree);)532 1729 y(})532 1788
- y(result)h(=)h(tree;)442 1848 y(})442 1908 y(return)f(result;)382
- 1968 y(})p eop
- %%Page: 116 116
- 116 115 bop 270 633 a Fq(Summary)270 892 y Ft(PostgreSQL)14
- b(has)g(become)g(one)g(of)g(the)g(most)g(popular)f(non)h(commercial)g
- (RDBMSs)h(in)e(the)i(UNIX)270 951 y(world.)27 b(It)16
- b(pro)o(vides)h(an)f(e)o(xtended)h(subset)g(of)f(the)h(SQL92)g
- (standard)f(as)h(query)f(language,)i(allo)o(ws)270 1011
- y(concurrent)c(database)i(access,)h(pro)o(vides)e(a)h(huge)f(amount)f
- (of)h(datatypes,)h(etc.)25 b(At)15 b(the)g(the)g(time)g(of)270
- 1071 y(writing)9 b(this)i(document)e(the)i(implemented)e(part)h(of)g
- (SQL92)g(in)g(PostgreSQL)g(lacked)g(two)f(important)270
- 1131 y(features:)345 1230 y Fo( 17)25 b Ft(The)12 b
- Fp(having)g(clause)h Ft(was)g(not)f(implemented.)345
- 1330 y Fo( 17)25 b Ft(The)12 b(use)h(of)f Fp(e)o(xcept)h
- Ft(and)f Fp(intersect)h Ft(statements)g(was)f(not)g(possible.)270
- 1430 y(The)19 b(implementation)f(of)g(these)h(two)f(items)g(was)h(the)g
- (moti)o(v)o(ation)e(for)h(the)g(whole)h(work.)33 b(When)270
- 1489 y(I)22 b(started)g(to)g(implement)g(the)g(abo)o(v)o(e)h(mentioned)
- e(features,)k(I)d(noticed)g(that)g(there)g(was)g(almost)270
- 1549 y(no)g(documentation)e(on)i(the)g(internal)f(structure)g(of)g
- (PostgreSQL)g(a)o(v)o(ailable)g(that)h(could)f(help)h(a)270
- 1609 y(programmer)c(to)h( 02nd)g(his)h(way)f(in.)37
- b(So)20 b(I)f(decided)g(to)h(include)f(all)h(the)f(kno)o(wledge)g(I)g
- (collected)270 1669 y(while)14 b(working)e(with)i(the)g(source)g(code)g
- (into)f(this)h(document,)h(hoping)e(that)h(it)f(will)h(be)g(a)g(useful)
- g(for)270 1729 y(an)o(y)19 b(ne)o(wcomer)f(who)h(wants)g(to)f(enhance)i
- (PostgreSQL)e(etc.)35 b(Additionally)18 b(I)h(included)f(a)h(short)270
- 1788 y(discussion)13 b(on)g(SQL)g(and)g(a)g(description)f(of)g
- (PostgreSQL)-5 b(')m(s)14 b(features)e((like)g Fp(triggers)g
- Ft(etc.))17 b(and)12 b(ho)o(w)270 1848 y(the)o(y)g(can)h(be)g(used.)
- 270 1968 y(Chapter)24 b(1)h(discusses)h(the)f(theoretical)f
- ((mathematical))f(background)h(of)h(relational)e(database)270
- 2027 y(management)12 b(systems)h((RDBMSs))g(ending)f(in)g(a)g(short)h
- (description)e(of)h(SQL.)270 2147 y(Chapter)30 b(2)g( 02rst)g(gi)o(v)o
- (es)g(an)h(o)o(v)o(ervie)o(w)e(of)h(ho)o(w)g(to)g(setup)g(and)g
- (administrate)g(PostgreSQL.)270 2207 y(Ne)o(xt)15 b(some)g(of)f
- (PostgreSQL)-5 b(')m(s)15 b(special)g(features)g(are)g(presented)f
- ((i.e.)23 b Fp(multiple)14 b(inheritance)p Ft(,)i Fp(user)270
- 2267 y(de 02ned)c(data)g(types)p Ft(,)i Fp(rules)p Ft(,)f
- Fp(triggers)p Ft(,)f(etc.))k(using)c(a)h(lot)f(of)g(e)o(xamples.)270
- 2386 y(Chapter)19 b(3)g( 02rst)g(gi)o(v)o(es)g(an)g(o)o(v)o(ervie)o(w)
- g(on)g(the)g(internal)g(structure)f(of)h(PostgreSQL)g(and)g(presents)
- 270 2446 y(the)k(stages)g(and)g(data)f(structures)g(that)h(are)f(in)n
- (v)o(olv)o(ed)h(whene)o(v)o(er)f(a)h(SQL)f(query)g(arri)o(v)o(es.)47
- b(The)270 2506 y Fp(parser)15 b(stage)p Ft(,)g(the)f
- Fp(rule)h(system)h Ft((which)e(is)g(mainly)g(used)h(for)f(the)h
- (implementation)e(of)h Fp(vie)o(ws)p Ft(),)i(the)270
- 2565 y Fp(planner/optimizer)f Ft(and)f(the)h Fp(e)o(xecutor)g
- Ft(are)f(described)h(and)f(illustrated)g(by)h(a)f(lot)h(of)f
- ( 02gures.)22 b(After)270 2625 y(that)15 b(the)g(changes)h(necessary)g
- (for)e(the)i(implementation)e(of)h(the)g(missing)g(features)g(()p
- Fp(having)g(clause)270 2685 y Ft(and)d Fp(e)o(xcept/intersect)p
- Ft())h(are)f(presented)g(including)g(parts)g(of)g(the)g(added)h
- (source)f(code.)1133 3552 y(116)p eop
- %%Page: 117 117
- 117 116 bop 198 633 a Fq(Bibliograph)n(y)198 892 y Ft([D)n(A)-6
- b(TE96])99 b(C.)15 b(J.)g(Date)f(with)g(H.)g(Darwen:)k
- Fp(A)d(Guide)f(to)f(the)h(SQL)g(Standar)n(d)p Ft(,)h(F)o(ourth)e
- (Edition,)505 951 y(Addison-W)l(esle)o(y)g(1996)198 1051
- y([ULL88])127 b(Jef)o(fre)o(y)12 b(D.)h(Ullman:)i Fp(Principles)e(of)f
- (Database)h(and)f(Knowledge)g(-)g(Base)i(Systems)p Ft(,)505
- 1111 y(V)-6 b(olume)12 b(1,)g(Computer)g(Science)h(Press)f(1988)198
- 1210 y([D)n(A)-6 b(TE94])99 b(C.)23 b(J.)g(Date:)36 b
- Fp(An)23 b(Intr)n(oduction)e(to)h(Database)g(Systems)p
- Ft(,)k(V)-6 b(ol.)23 b(1,)i(6th)d(Edition,)505 1270 y(Addison-W)l(esle)
- o(y)13 b(1994)198 1370 y([LOCK98])88 b(Thomas)23 b(Lockhart:)36
- b Fp(P)l(ostgr)n(eSQL)23 b(Pr)n(ogr)o(ammer')n(s)h(Guide)p
- Ft(,)h(part)d(of)g(the)h(Post-)505 1430 y(greSQL)12 b(documentation.)
- 198 1529 y([ST)o(ON89])94 b(Michael)16 b(Stonebraker)d(et.)j(al.:)21
- b Fp(On)16 b(Rules,)h(Pr)n(ocedur)n(es,)h(Cac)o(hing)d(and)g(V)l(ie)o
- (ws)i(in)505 1589 y(Data)12 b(Base)i(Systems)p Ft(.)1061
- 3552 y(117)p eop
- %%Trailer
- end
- userdict /end-hook known{end-hook}if
- %%EOF