Commit 769065c
committed
Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion.
A large majority of the callers of pg_do_encoding_conversion were
specifying the database encoding as either source or target of the
conversion, meaning that we can use the less general functions
pg_any_to_server/pg_server_to_any instead.
The main advantage of using the latter functions is that they can make use
of a cached conversion-function lookup in the common case that the other
encoding is the current client_encoding. It's notationally cleaner too in
most cases, not least because of the historical artifact that the latter
functions use "char *" rather than "unsigned char *" in their APIs.
Note that pg_any_to_server will apply an encoding verification step in
some cases where pg_do_encoding_conversion would have just done nothing.
This seems to me to be a good idea at most of these call sites, though
it partially negates the performance benefit.
Per discussion of bug #9210.1 parent 49c817e commit 769065c
File tree
12 files changed
+51
-100
lines changed- contrib
- pg_stat_statements
- sslinfo
- src
- backend
- commands
- snowball
- tsearch
- utils
- adt
- mb
- pl
- plperl
- plpython
- tcl
12 files changed
+51
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1466 | 1464 | | |
1467 | 1465 | | |
1468 | 1466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 161 | + | |
165 | 162 | | |
166 | 163 | | |
167 | 164 | | |
| |||
323 | 320 | | |
324 | 321 | | |
325 | 322 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 323 | + | |
330 | 324 | | |
331 | 325 | | |
332 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | 638 | | |
640 | 639 | | |
641 | 640 | | |
| |||
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
648 | | - | |
| 647 | + | |
649 | 648 | | |
650 | 649 | | |
651 | 650 | | |
| |||
655 | 654 | | |
656 | 655 | | |
657 | 656 | | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
| 657 | + | |
662 | 658 | | |
663 | 659 | | |
664 | 660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 258 | + | |
262 | 259 | | |
263 | 260 | | |
264 | 261 | | |
| |||
284 | 281 | | |
285 | 282 | | |
286 | 283 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 284 | + | |
291 | 285 | | |
292 | 286 | | |
293 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 212 | + | |
216 | 213 | | |
217 | 214 | | |
218 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
422 | | - | |
423 | | - | |
| 421 | + | |
424 | 422 | | |
425 | 423 | | |
426 | 424 | | |
| |||
581 | 579 | | |
582 | 580 | | |
583 | 581 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | 582 | | |
588 | 583 | | |
589 | 584 | | |
590 | | - | |
| 585 | + | |
591 | 586 | | |
592 | 587 | | |
593 | 588 | | |
594 | 589 | | |
595 | 590 | | |
| 591 | + | |
596 | 592 | | |
597 | 593 | | |
598 | 594 | | |
599 | | - | |
600 | | - | |
| 595 | + | |
| 596 | + | |
601 | 597 | | |
602 | 598 | | |
603 | | - | |
| 599 | + | |
604 | 600 | | |
605 | | - | |
606 | | - | |
607 | | - | |
| 601 | + | |
608 | 602 | | |
609 | | - | |
| 603 | + | |
610 | 604 | | |
611 | 605 | | |
612 | 606 | | |
| 607 | + | |
613 | 608 | | |
614 | 609 | | |
615 | 610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 348 | + | |
352 | 349 | | |
353 | 350 | | |
354 | 351 | | |
| |||
1793 | 1790 | | |
1794 | 1791 | | |
1795 | 1792 | | |
1796 | | - | |
1797 | | - | |
1798 | | - | |
1799 | | - | |
| 1793 | + | |
| 1794 | + | |
1800 | 1795 | | |
1801 | 1796 | | |
1802 | 1797 | | |
| |||
1892 | 1887 | | |
1893 | 1888 | | |
1894 | 1889 | | |
1895 | | - | |
| 1890 | + | |
1896 | 1891 | | |
1897 | 1892 | | |
1898 | 1893 | | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
1903 | | - | |
1904 | | - | |
1905 | | - | |
1906 | | - | |
1907 | | - | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1908 | 1899 | | |
1909 | 1900 | | |
1910 | 1901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1077 | 1077 | | |
1078 | 1078 | | |
1079 | 1079 | | |
1080 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1081 | 1083 | | |
1082 | 1084 | | |
1083 | 1085 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3811 | 3811 | | |
3812 | 3812 | | |
3813 | 3813 | | |
3814 | | - | |
3815 | | - | |
3816 | | - | |
| 3814 | + | |
3817 | 3815 | | |
3818 | 3816 | | |
3819 | 3817 | | |
| |||
3841 | 3839 | | |
3842 | 3840 | | |
3843 | 3841 | | |
3844 | | - | |
3845 | | - | |
3846 | | - | |
| 3842 | + | |
3847 | 3843 | | |
3848 | 3844 | | |
3849 | 3845 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 14 | + | |
29 | 15 | | |
| 16 | + | |
30 | 17 | | |
31 | 18 | | |
32 | 19 | | |
| |||
41 | 28 | | |
42 | 29 | | |
43 | 30 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 31 | + | |
47 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
48 | 36 | | |
49 | 37 | | |
| 38 | + | |
50 | 39 | | |
51 | 40 | | |
52 | 41 | | |
| |||
0 commit comments