- Notifications
You must be signed in to change notification settings - Fork5
Commitd21de3b
committed
> =================================================================
> User interface proposal for multi-row function targetlist entries> =================================================================> 1. Only one targetlist entry may return a set.> 2. Each targetlist item (other than the set returning one) is> repeated for each item in the returned set.>Having gotten no objections (actually, no response at all), I can only assumeno one had heartburn with this change. The attached patch covers the first ofthe two proposals, i.e. restricting the target list to only one set returningfunction.It compiles cleanly, and passes all regression tests. If there are noobjections, please apply.Any suggestions on where this should be documented (other than maybe sql-select)?Thanks,Joep.s. Here's what the previous example now looks like:CREATE TABLE bar(f1 int, f2 text, f3 int);INSERT INTO bar VALUES(1, 'Hello', 42);INSERT INTO bar VALUES(2, 'Happy', 45);CREATE TABLE foo(a int, b text);INSERT INTO foo VALUES(42, 'World');INSERT INTO foo VALUES(42, 'Everyone');INSERT INTO foo VALUES(45, 'Birthday');INSERT INTO foo VALUES(45, 'New Year');CREATE TABLE foo2(a int, b text);INSERT INTO foo2 VALUES(42, '!!!!');INSERT INTO foo2 VALUES(42, '????');INSERT INTO foo2 VALUES(42, '####');INSERT INTO foo2 VALUES(45, '$$$$');CREATE OR REPLACE FUNCTION getfoo(int) RETURNS SETOF text AS ' SELECT b FROM foo WHERE a = $1' language 'sql';CREATE OR REPLACE FUNCTION getfoo2(int) RETURNS SETOF text AS ' SELECT b FROM foo2 WHERE a = $1' language 'sql';regression=# SELECT f1, f2, getfoo(f3) AS f4 FROM bar; f1 | f2 | f4----+-------+---------- 1 | Hello | World 1 | Hello | Everyone 2 | Happy | Birthday 2 | Happy | New Year(4 rows)regression=# SELECT f1, f2, getfoo(f3) AS f4, getfoo2(f3) AS f5 FROM bar;ERROR: Only one target list entry may return a set resultJoe Conway1 parent2bd6311 commitd21de3b
File tree
3 files changed
+24
-8
lines changed- src
- backend/parser
- include/parser
3 files changed
+24
-8
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1118 | 1118 |
| |
1119 | 1119 |
| |
1120 | 1120 |
| |
1121 |
| - | |
| 1121 | + | |
1122 | 1122 |
| |
1123 | 1123 |
| |
1124 | 1124 |
| |
|
Lines changed: 20 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
45 | 47 |
| |
46 | 48 |
| |
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
50 | 52 |
| |
51 |
| - | |
| 53 | + | |
| 54 | + | |
52 | 55 |
| |
53 | 56 |
| |
54 | 57 |
| |
| |||
61 | 64 |
| |
62 | 65 |
| |
63 | 66 |
| |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 |
| |
65 | 71 |
| |
66 | 72 |
| |
| |||
93 | 99 |
| |
94 | 100 |
| |
95 | 101 |
| |
| 102 | + | |
96 | 103 |
| |
97 | 104 |
| |
98 | 105 |
| |
99 | 106 |
| |
| 107 | + | |
100 | 108 |
| |
101 | 109 |
| |
102 | 110 |
| |
| |||
173 | 181 |
| |
174 | 182 |
| |
175 | 183 |
| |
176 |
| - | |
| 184 | + | |
| 185 | + | |
177 | 186 |
| |
178 | 187 |
| |
179 | 188 |
| |
| |||
194 | 203 |
| |
195 | 204 |
| |
196 | 205 |
| |
197 |
| - | |
| 206 | + | |
| 207 | + | |
198 | 208 |
| |
199 | 209 |
| |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
200 | 216 |
| |
201 | 217 |
| |
202 | 218 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
|
0 commit comments
Comments
(0)