|
| 1 | +/* |
| 2 | + * Copyright (C) 2024 PostGraphDB |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Affero General Public License as |
| 6 | + * published by the Free Software Foundation, either version 3 of the |
| 7 | + * License, or (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Affero General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU Affero General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | +LOAD 'postgraph'; |
| 18 | +SET search_path TO postgraph; |
| 19 | +CREATE GRAPH set_op; |
| 20 | +NOTICE: graph "set_op" has been created |
| 21 | + create_graph |
| 22 | +-------------- |
| 23 | + |
| 24 | +(1 row) |
| 25 | + |
| 26 | +USE GRAPH set_op; |
| 27 | + use_graph |
| 28 | +----------- |
| 29 | + |
| 30 | +(1 row) |
| 31 | + |
| 32 | +CREATE (); |
| 33 | +-- |
| 34 | +(0 rows) |
| 35 | + |
| 36 | +MATCH (n) RETURN n UNION MATCH (n) RETURN n; |
| 37 | + n |
| 38 | +-------------------------------------------------------- |
| 39 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 40 | +(1 row) |
| 41 | + |
| 42 | +MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n; |
| 43 | + n |
| 44 | +-------------------------------------------------------- |
| 45 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 46 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 47 | +(2 rows) |
| 48 | + |
| 49 | +MATCH (n) RETURN n UNION RETURN 1; |
| 50 | +ERROR: UNION could not convert type gtype to vertex |
| 51 | +LINE 1: MATCH (n) RETURN n UNION RETURN 1; |
| 52 | + ^ |
| 53 | +MATCH (n) RETURN n UNION RETURN NULL; |
| 54 | +ERROR: UNION could not convert type gtype to vertex |
| 55 | +LINE 1: MATCH (n) RETURN n UNION RETURN NULL; |
| 56 | + ^ |
| 57 | +RETURN [1,2,3] UNION RETURN 1; |
| 58 | + ?column? |
| 59 | +----------- |
| 60 | + [1, 2, 3] |
| 61 | + 1 |
| 62 | +(2 rows) |
| 63 | + |
| 64 | +RETURN NULL UNION RETURN NULL; |
| 65 | + ?column? |
| 66 | +---------- |
| 67 | + |
| 68 | +(1 row) |
| 69 | + |
| 70 | +RETURN NULL UNION ALL RETURN NULL; |
| 71 | + ?column? |
| 72 | +---------- |
| 73 | + |
| 74 | + |
| 75 | +(2 rows) |
| 76 | + |
| 77 | +MATCH (n) RETURN n UNION MATCH (n) RETURN n UNION MATCH (n) RETURN n; |
| 78 | + n |
| 79 | +-------------------------------------------------------- |
| 80 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 81 | +(1 row) |
| 82 | + |
| 83 | +MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n UNION ALL MATCH(n) RETURN n; |
| 84 | + n |
| 85 | +-------------------------------------------------------- |
| 86 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 87 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 88 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 89 | +(3 rows) |
| 90 | + |
| 91 | +MATCH (n) RETURN n UNION ALL MATCH (n) RETURN n UNION MATCH(n) RETURN n; |
| 92 | + n |
| 93 | +-------------------------------------------------------- |
| 94 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 95 | +(1 row) |
| 96 | + |
| 97 | +MATCH (n) RETURN n UNION MATCH (n) RETURN n UNION ALL MATCH(n) RETURN n; |
| 98 | + n |
| 99 | +-------------------------------------------------------- |
| 100 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 101 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 102 | +(2 rows) |
| 103 | + |
| 104 | +RETURN NULL UNION ALL RETURN NULL UNION ALL RETURN NULL; |
| 105 | + ?column? |
| 106 | +---------- |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +(3 rows) |
| 111 | + |
| 112 | +RETURN NULL UNION ALL RETURN NULL UNION RETURN NULL; |
| 113 | + ?column? |
| 114 | +---------- |
| 115 | + |
| 116 | +(1 row) |
| 117 | + |
| 118 | +RETURN NULL UNION RETURN NULL UNION ALL RETURN NULL; |
| 119 | + ?column? |
| 120 | +---------- |
| 121 | + |
| 122 | + |
| 123 | +(2 rows) |
| 124 | + |
| 125 | +RETURN 1.0::int UNION RETURN 1::float UNION ALL RETURN 2.0::float; |
| 126 | +ERROR: syntax error at or near "int" |
| 127 | +LINE 1: RETURN 1.0::int UNION RETURN 1::float UNION ALL RETURN 2.0::... |
| 128 | + ^ |
| 129 | +RETURN 1.0::int UNION RETURN 1.0::float UNION ALL RETURN 1::int; |
| 130 | +ERROR: syntax error at or near "int" |
| 131 | +LINE 1: RETURN 1.0::int UNION RETURN 1.0::float UNION ALL RETURN 1::... |
| 132 | + ^ |
| 133 | +RETURN 1.0::float UNION RETURN 1::int UNION RETURN 1::float; |
| 134 | +ERROR: syntax error at or near "float" |
| 135 | +LINE 1: RETURN 1.0::float UNION RETURN 1::int UNION RETURN 1::float; |
| 136 | + ^ |
| 137 | +-- Intersect |
| 138 | +MATCH (n) RETURN n INTERSECT MATCH (m) RETURN m; |
| 139 | + n |
| 140 | +-------------------------------------------------------- |
| 141 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 142 | +(1 row) |
| 143 | + |
| 144 | +MATCH (n) RETURN n INTERSECT ALL MATCH (m) RETURN m; |
| 145 | + n |
| 146 | +-------------------------------------------------------- |
| 147 | + {"id": 281474976710657, "label": "", "properties": {}} |
| 148 | +(1 row) |
| 149 | + |
| 150 | +-- Except |
| 151 | +MATCH (n) RETURN n EXCEPT MATCH (m) RETURN m; |
| 152 | + n |
| 153 | +--- |
| 154 | +(0 rows) |
| 155 | + |
| 156 | +MATCH (n) RETURN n EXCEPT ALL MATCH (m) RETURN m; |
| 157 | + n |
| 158 | +--- |
| 159 | +(0 rows) |
| 160 | + |
| 161 | +-- Operator Precedence |
| 162 | +RETURN 2.0::int UNION (RETURN 1::float UNION ALL RETURN 1.0::float); |
| 163 | +ERROR: syntax error at or near "int" |
| 164 | +LINE 1: RETURN 2.0::int UNION (RETURN 1::float UNION ALL RETURN 1.0:... |
| 165 | + ^ |
| 166 | +(RETURN 2.0::int UNION RETURN 1::float ) UNION ALL RETURN 1.0::float; |
| 167 | +ERROR: syntax error at or near "int" |
| 168 | +LINE 1: (RETURN 2.0::int UNION RETURN 1::float ) UNION ALL RETURN 1.... |
| 169 | + ^ |
| 170 | +-- Errors |
| 171 | +MATCH (n) RETURN n UNION ALL MATCH (m) RETURN n; |
| 172 | +ERROR: could not find rte for n |
| 173 | +LINE 1: MATCH (n) RETURN n UNION ALL MATCH (m) RETURN n; |
| 174 | + ^ |
| 175 | +DROP GRAPH set_op; |
| 176 | +ERROR: syntax error at or near ";" |
| 177 | +LINE 1: DROP GRAPH set_op; |
| 178 | + ^ |
0 commit comments