• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

MakefileH A D08-Nov-2021600 3320

READMEH A D08-Nov-20212.9 KiB8162

bitmapset.cH A D08-Nov-202125.5 KiB1,193758

copyfuncs.cH A D08-Nov-2021121.8 KiB5,8844,231

equalfuncs.cH A D08-Nov-202186.7 KiB3,8693,188

extensible.cH A D08-Nov-20213.6 KiB14488

list.cH A D08-Nov-202137 KiB1,606920

makefuncs.cH A D08-Nov-202118 KiB818483

nodeFuncs.cH A D08-Nov-2021111.8 KiB4,1093,065

nodes.cH A D08-Nov-2021900 323

outfuncs.cH A D08-Nov-2021106.2 KiB4,5653,739

params.cH A D08-Nov-202111.2 KiB423235

print.cH A D08-Nov-20219.7 KiB507393

read.cH A D08-Nov-202112.1 KiB463257

readfuncs.cH A D08-Nov-202162.7 KiB3,1412,138

tidbitmap.cH A D08-Nov-202143.3 KiB1,562925

value.cH A D08-Nov-20211.1 KiB7634

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