forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit372728b
committed
Replace our traditional initial-catalog-data format with a better design.
Historically, the initial catalog data to be installed during bootstraphas been written in DATA() lines in the catalog header files. This hadlots of disadvantages: the format was badly underdocumented, it wasvery difficult to edit the data in any mechanized way, and due to thelack of any abstraction the data was verbose, hard to read/understand,and easy to get wrong.Hence, move this data into separate ".dat" files and represent it in a waythat can easily be read and rewritten by Perl scripts. The new format isessentially "key => value" for each column; while it's a bit repetitive,explicit labeling of each value makes the data far more readable and lesserror-prone. Provide a way to abbreviate entries by omitting field valuesthat match a specified default value for their column. This allows removalof a large amount of repetitive boilerplate and also lowers the barrier toadding new columns.Also teach genbki.pl how to translate symbolic OID references intonumeric OIDs for more cases than just "regproc"-like pg_proc references.It can now do that for regprocedure-like references (thus solving theproblem that regproc is ambiguous for overloaded functions), operators,types, opfamilies, opclasses, and access methods. Use this to turnnearly all OID cross-references in the initial data into symbolic form.This represents a very large step forward in readability and errorresistance of the initial catalog data. It should also reduce thedifficulty of renumbering OID assignments in uncommitted patches.Also, solve the longstanding problem that frontend code that would like touse OID macros and other information from the catalog headers often haddifficulty with backend-only code in the headers. To do this, arrange forall generated macros, plus such other declarations as we deem fit, to beplaced in "derived" header files that are safe for frontend inclusion.(Once clients migrate to using these pg_*_d.h headers, it will be possibleto get rid of the pg_*_fn.h headers, which only exist to quarantine codeaway from clients. That is left for follow-on patches, however.)The now-automatically-generated macros include the Anum_xxx and Natts_xxxconstants that we used to have to update by hand when adding or removingcatalog columns.Replace the former manual method of generating OID macros for pg_typeentries with an automatic method, ensuring that all built-in types haveOID macros. (But note that this patch does not change the way thatOID macros for pg_proc entries are built and used. It's not clear thatmaking that match the other catalogs would be worth extra code churn.)Add SGML documentation explaining what the new data format is and how towork with it.Despite being a very large change in the catalog headers, there is nocatversion bump here, because postgres.bki and related output fileshaven't changed at all.John Naylor, based on ideas from various people; review and minoradditional coding by me; previous review by Alvaro HerreraDiscussion:https://postgr.es/m/CAJVSVGWO48JbbwXkJz_yBFyGYW-M9YWxnPdxJBUosDC9ou_F0Q@mail.gmail.com1 parent02f3e55 commit372728b
File tree
110 files changed
+22928
-12480
lines changed- doc/src/sgml
- src
- backend
- catalog
- utils
- include
- catalog
- interfaces/ecpg/ecpglib
- tools
- msvc
- pgindent
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
110 files changed
+22928
-12480
lines changedLines changed: 635 additions & 26 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3566 | 3566 |
| |
3567 | 3567 |
| |
3568 | 3568 |
| |
3569 |
| - | |
| 3569 | + | |
3570 | 3570 |
| |
3571 | 3571 |
| |
3572 | 3572 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 |
| |
45 | 50 |
| |
46 | 51 |
| |
|
Lines changed: 9 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
154 |
| - | |
| 154 | + | |
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 | 160 |
| |
161 |
| - | |
| 161 | + | |
| 162 | + | |
162 | 163 |
| |
163 |
| - | |
164 |
| - | |
165 |
| - | |
166 |
| - | |
| 164 | + | |
167 | 165 |
| |
168 | 166 |
| |
169 | 167 |
| |
| |||
178 | 176 |
| |
179 | 177 |
| |
180 | 178 |
| |
181 |
| - | |
| 179 | + | |
182 | 180 |
| |
183 | 181 |
| |
184 | 182 |
| |
185 | 183 |
| |
186 | 184 |
| |
187 | 185 |
| |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 | 186 |
| |
194 | 187 |
| |
195 | 188 |
| |
| |||
225 | 218 |
| |
226 | 219 |
| |
227 | 220 |
| |
228 |
| - | |
| 221 | + | |
229 | 222 |
| |
230 | 223 |
| |
231 | 224 |
| |
| |||
327 | 320 |
| |
328 | 321 |
| |
329 | 322 |
| |
330 |
| - | |
331 |
| - | |
332 |
| - | |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 |
| - | |
| 323 | + | |
337 | 324 |
| |
338 | 325 |
| |
339 | 326 |
| |
| |||
345 | 332 |
| |
346 | 333 |
| |
347 | 334 |
| |
| 335 | + | |
348 | 336 |
| |
349 | 337 |
| |
350 | 338 |
| |
351 | 339 |
| |
352 | 340 |
| |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 | 341 |
| |
358 | 342 |
| |
359 | 343 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
| 6 | + |
0 commit comments
Comments
(0)