Commit 95fb5b4
committed
Refactor CopyReadAttributes{CSV,Text}() to use a callback in COPY FROM
CopyReadAttributes{CSV,Text}() are used to parse lines for text and CSV
format. This reduces the number of "if" branches that need to be
checked when parsing fields in CSV and text mode when dealing with a
COPY FROM, something that can become more noticeable with more
attributes and more lines to process.
Extracted from a larger patch by the same author.
Author: Sutou Kouhei
Discussion: https://postgr.es/m/20231204.153548.2126325458835528809.kou@clear-code.com1 parent 774bcff commit 95fb5b4
File tree
3 files changed
+30
-16
lines changed- src
- backend/commands
- include/commands
3 files changed
+30
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1776 | 1776 | | |
1777 | 1777 | | |
1778 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
1779 | 1784 | | |
1780 | 1785 | | |
1781 | 1786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
| |||
775 | 773 | | |
776 | 774 | | |
777 | 775 | | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
| 776 | + | |
782 | 777 | | |
783 | 778 | | |
784 | 779 | | |
| |||
830 | 825 | | |
831 | 826 | | |
832 | 827 | | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
| 828 | + | |
837 | 829 | | |
838 | 830 | | |
839 | 831 | | |
| |||
1502 | 1494 | | |
1503 | 1495 | | |
1504 | 1496 | | |
1505 | | - | |
| 1497 | + | |
1506 | 1498 | | |
1507 | 1499 | | |
1508 | 1500 | | |
| |||
1756 | 1748 | | |
1757 | 1749 | | |
1758 | 1750 | | |
1759 | | - | |
| 1751 | + | |
1760 | 1752 | | |
1761 | 1753 | | |
1762 | 1754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
| |||
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
| |||
183 | 196 | | |
184 | 197 | | |
185 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
186 | 203 | | |
0 commit comments