Revision 2603
Added by Aaron Marcuse-Kubitza almost 13 years ago
schemas/functions.sql | ||
---|---|---|
42 | 42 |
AS $$ |
43 | 43 |
BEGIN |
44 | 44 |
new.result := ( |
45 |
SELECT DISTINCT functions.join_strs('; ', value)
|
|
45 |
SELECT functions.join_strs('; ', value) |
|
46 | 46 |
FROM |
47 |
(VALUES (new."0"), (new."1"), (new."2"), (new."3"), (new."4"), |
|
48 |
(new."5"), (new."6"), (new."7"), (new."8"), (new."9")) |
|
49 |
AS v (value) |
|
47 |
( |
|
48 |
SELECT * |
|
49 |
FROM |
|
50 |
( |
|
51 |
SELECT |
|
52 |
DISTINCT ON (value) |
|
53 |
* |
|
54 |
FROM |
|
55 |
(VALUES |
|
56 |
(0, new."0") |
|
57 |
, (1, new."1") |
|
58 |
, (2, new."2") |
|
59 |
, (3, new."3") |
|
60 |
, (4, new."4") |
|
61 |
, (5, new."5") |
|
62 |
, (6, new."6") |
|
63 |
, (7, new."7") |
|
64 |
, (8, new."8") |
|
65 |
, (9, new."9") |
|
66 |
) |
|
67 |
AS v (sort_order, value) |
|
68 |
) |
|
69 |
AS v |
|
70 |
ORDER BY sort_order |
|
71 |
) |
|
72 |
AS v |
|
50 | 73 |
); |
51 | 74 |
RETURN new; |
52 | 75 |
END; |
Also available in: Unified diff
schemas/functions.sql: _merge(): Fixed bug where values were ordered by value instead of by sort order (column name)