Commit cbe25dc
committed
Disallow making an empty lexeme via array_to_tsvector().
The tsvector data type has always forbidden lexemes to be empty.
However, array_to_tsvector() didn't get that memo, and would
allow an empty-string array element to become an empty lexeme.
This could result in dump/restore failures later, not to mention
whatever semantic issues might be behind the original prohibition.
However, other functions that take a plain text input directly as
a lexeme value do not need a similar restriction, because they only
match the string against existing tsvector entries. In particular
it'd be a bad idea to make ts_delete() reject empty strings, since
that is the most convenient way to clean up any bad data that might
have gotten into a tsvector column via this bug.
Reflecting on that, let's also remove the prohibition against NULL
array elements in tsvector_delete_arr and tsvector_setweight_by_filter.
It seems more consistent to ignore them, as an empty-string element
would be ignored.
There's a case for back-patching this, since it's clearly a bug fix.
On balance though, it doesn't seem like something to change in a
minor release.
Jean-Christophe Arnu
Discussion: https://postgr.es/m/CAHZmTm1YVndPgUVRoag2WL0w900XcoiivDDj-gTTYBsG25c65A@mail.gmail.com1 parent 1241fcb commit cbe25dc
File tree
4 files changed
+44
-17
lines changed- doc/src/sgml
- src
- backend/utils/adt
- test/regress
- expected
- sql
4 files changed
+44
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12920 | 12920 | | |
12921 | 12921 | | |
12922 | 12922 | | |
12923 | | - | |
12924 | | - | |
| 12923 | + | |
| 12924 | + | |
| 12925 | + | |
| 12926 | + | |
12925 | 12927 | | |
12926 | 12928 | | |
12927 | 12929 | | |
| |||
13104 | 13106 | | |
13105 | 13107 | | |
13106 | 13108 | | |
| 13109 | + | |
| 13110 | + | |
| 13111 | + | |
13107 | 13112 | | |
13108 | 13113 | | |
13109 | 13114 | | |
| |||
13265 | 13270 | | |
13266 | 13271 | | |
13267 | 13272 | | |
| 13273 | + | |
| 13274 | + | |
13268 | 13275 | | |
13269 | 13276 | | |
13270 | 13277 | | |
| |||
13281 | 13288 | | |
13282 | 13289 | | |
13283 | 13290 | | |
| 13291 | + | |
| 13292 | + | |
| 13293 | + | |
13284 | 13294 | | |
13285 | 13295 | | |
13286 | 13296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
325 | 326 | | |
326 | | - | |
327 | | - | |
328 | | - | |
| 327 | + | |
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
| |||
602 | 601 | | |
603 | 602 | | |
604 | 603 | | |
| 604 | + | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
| 606 | + | |
609 | 607 | | |
610 | 608 | | |
611 | 609 | | |
| |||
761 | 759 | | |
762 | 760 | | |
763 | 761 | | |
764 | | - | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
765 | 766 | | |
766 | 767 | | |
767 | 768 | | |
768 | 769 | | |
769 | 770 | | |
770 | 771 | | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
771 | 777 | | |
772 | 778 | | |
773 | 779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
1258 | 1262 | | |
1259 | 1263 | | |
1260 | 1264 | | |
1261 | | - | |
1262 | | - | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
1263 | 1271 | | |
1264 | 1272 | | |
1265 | 1273 | | |
| |||
1328 | 1336 | | |
1329 | 1337 | | |
1330 | 1338 | | |
| 1339 | + | |
1331 | 1340 | | |
1332 | 1341 | | |
| 1342 | + | |
| 1343 | + | |
1333 | 1344 | | |
1334 | 1345 | | |
1335 | 1346 | | |
| |||
1367 | 1378 | | |
1368 | 1379 | | |
1369 | 1380 | | |
1370 | | - | |
| 1381 | + | |
1371 | 1382 | | |
1372 | 1383 | | |
1373 | 1384 | | |
1374 | 1385 | | |
1375 | 1386 | | |
1376 | | - | |
1377 | | - | |
1378 | 1387 | | |
1379 | 1388 | | |
1380 | 1389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
242 | | - | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
254 | 256 | | |
| 257 | + | |
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
| |||
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
263 | | - | |
264 | | - | |
| 266 | + | |
265 | 267 | | |
266 | 268 | | |
267 | 269 | | |
| |||
0 commit comments