|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| Makefile | H A D | 08-Nov-2021 | 600 | 33 | 20 |
| README | H A D | 08-Nov-2021 | 2.9 KiB | 81 | 62 |
| bitmapset.c | H A D | 08-Nov-2021 | 25.5 KiB | 1,193 | 758 |
| copyfuncs.c | H A D | 08-Nov-2021 | 121.8 KiB | 5,884 | 4,231 |
| equalfuncs.c | H A D | 08-Nov-2021 | 86.7 KiB | 3,869 | 3,188 |
| extensible.c | H A D | 08-Nov-2021 | 3.6 KiB | 144 | 88 |
| list.c | H A D | 08-Nov-2021 | 37 KiB | 1,606 | 920 |
| makefuncs.c | H A D | 08-Nov-2021 | 18 KiB | 818 | 483 |
| nodeFuncs.c | H A D | 08-Nov-2021 | 111.8 KiB | 4,109 | 3,065 |
| nodes.c | H A D | 08-Nov-2021 | 900 | 32 | 3 |
| outfuncs.c | H A D | 08-Nov-2021 | 106.2 KiB | 4,565 | 3,739 |
| params.c | H A D | 08-Nov-2021 | 11.2 KiB | 423 | 235 |
| print.c | H A D | 08-Nov-2021 | 9.7 KiB | 507 | 393 |
| read.c | H A D | 08-Nov-2021 | 12.1 KiB | 463 | 257 |
| readfuncs.c | H A D | 08-Nov-2021 | 62.7 KiB | 3,141 | 2,138 |
| tidbitmap.c | H A D | 08-Nov-2021 | 43.3 KiB | 1,562 | 925 |
| value.c | H A D | 08-Nov-2021 | 1.1 KiB | 76 | 34 |
README
1src/backend/nodes/README
2
3Node Structures
4===============
5
6Andrew Yu (11/94)
7
8Introduction
9------------
10
11The current node structures are plain old C structures. "Inheritance" is
12achieved by convention. No additional functions will be generated. Functions
13that manipulate node structures reside in this directory.
14
15
16FILES IN THIS DIRECTORY (src/backend/nodes/)
17
18 General-purpose node manipulation functions:
19 copyfuncs.c - copy a node tree
20 equalfuncs.c - compare two node trees
21 outfuncs.c - convert a node tree to text representation
22 readfuncs.c - convert text representation back to a node tree
23 makefuncs.c - creator functions for some common node types
24 nodeFuncs.c - some other general-purpose manipulation functions
25
26 Specialized manipulation functions:
27 bitmapset.c - Bitmapset support
28 list.c - generic list support
29 params.c - Param support
30 tidbitmap.c - TIDBitmap support
31 value.c - support for Value nodes
32
33FILES IN src/include/nodes/
34
35 Node definitions:
36 nodes.h - define node tags (NodeTag)
37 primnodes.h - primitive nodes
38 parsenodes.h - parse tree nodes
39 pathnodes.h - path tree nodes and planner internal structures
40 plannodes.h - plan tree nodes
41 execnodes.h - executor nodes
42 memnodes.h - memory nodes
43 pg_list.h - generic list
44
45
46Steps to Add a Node
47-------------------
48
49Suppose you want to define a node Foo:
50
511. Add a tag (T_Foo) to the enum NodeTag in nodes.h. (If you insert the
52 tag in a way that moves the numbers associated with existing tags,
53 you'll need to recompile the whole tree after doing this. It doesn't
54 force initdb though, because the numbers never go to disk.)
552. Add the structure definition to the appropriate include/nodes/???.h file.
56 If you intend to inherit from, say a Plan node, put Plan as the first field
57 of your struct definition.
583. If you intend to use copyObject, equal, nodeToString or stringToNode,
59 add an appropriate function to copyfuncs.c, equalfuncs.c, outfuncs.c
60 and readfuncs.c accordingly. (Except for frequently used nodes, don't
61 bother writing a creator function in makefuncs.c) The header comments
62 in those files give general rules for whether you need to add support.
634. Add cases to the functions in nodeFuncs.c as needed. There are many
64 other places you'll probably also need to teach about your new node
65 type. Best bet is to grep for references to one or two similar existing
66 node types to find all the places to touch.
67
68
69Historical Note
70---------------
71
72Prior to the current simple C structure definitions, the Node structures
73used a pseudo-inheritance system which automatically generated creator and
74accessor functions. Since every node inherited from LispValue, the whole thing
75was a mess. Here's a little anecdote:
76
77 LispValue definition -- class used to support lisp structures
78 in C. This is here because we did not want to totally rewrite
79 planner and executor code which depended on lisp structures when
80 we ported postgres V1 from lisp to C. -cim 4/23/90
81