Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6488275b
Commit
6488275b
authored
May 05, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In developer's FAQ, update list API, from Tom Lane.
parent
1b57f0e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
39 deletions
+41
-39
doc/FAQ_DEV
doc/FAQ_DEV
+21
-20
doc/src/FAQ/FAQ_DEV.html
doc/src/FAQ/FAQ_DEV.html
+20
-19
No files found.
doc/FAQ_DEV
View file @
6488275b
Developer's Frequently Asked Questions (FAQ) for PostgreSQL
Last updated: Sat May 5 0
0:09:15
EDT 2007
Last updated: Sat May 5 0
6:20:41
EDT 2007
Current maintainer: Bruce Momjian (bruce@momjian.us)
...
...
@@ -698,18 +698,19 @@ typedef struct nameData
Here are some of the List manipulation commands:
lfirst(i), lfirst_int(i), lfirst_oid(i)
return the data (a point
, integer and OID respectively) at list
element
i.
return the data (a point
er, integer or OID respectively) of
list cell
i.
lnext(i)
return the next list
element
after i.
return the next list
cell
after i.
foreach(i, list)
loop through list, assigning each list element to i. It is
important to note that i is a List *, not the data in the List
element. You need to use lfirst(i) to get at the data. Here is
a typical code snippet that loops through a List containing Var
*'s and processes each one:
loop through list, assigning each list cell to i. It is
important to note that i is a ListCell *, not the data in the
List element. You need to use lfirst(i) to get at the data.
Here is a typical code snippet that loops through a List
containing Var *'s and processes each one:
List *list;
ListCell *i;
...
...
@@ -726,20 +727,20 @@ typedef struct nameData
if list is NIL.
lappend(list, node)
add node to the end of list.
This is more expensive that lcons.
add node to the end of list.
nconc
(list1, list2)
Concat list2 on to the end of list1.
list_concat
(list1, list2)
Concat
enate
list2 on to the end of list1.
length(list)
l
ist_l
ength(list)
return the length of the list.
nth(i, list
)
return the i'th element in list.
list_nth(list, i
)
return the i'th element in list
, counting from zero
.
lcons
i
, ...
There are integer versions of these: lcons
i, lappendi, etc.
Also versions for OID lists: lconso, lappendo
, etc.
lcons
_int
, ...
There are integer versions of these: lcons
_int, lappend_int,
etc. Also versions for OID lists: lcons_oid, lappend_oid
, etc.
You can print nodes easily inside gdb. First, to disable output
truncation when you use the gdb print command:
...
...
@@ -758,7 +759,7 @@ typedef struct nameData
2.4) I just added a field to a structure. What else should I do?
The structures pass
ing around from the parser, rewrite
, optimizer, and
The structures pass
ed around in the parser, rewriter
, optimizer, and
executor require quite a bit of support. Most structures have support
routines in src/backend/nodes used to create, copy, read, and output
those structures (in particular, the files copyfuncs.c and
...
...
doc/src/FAQ/FAQ_DEV.html
View file @
6488275b
...
...
@@ -13,7 +13,7 @@
<H1>
Developer's Frequently Asked Questions (FAQ) for
PostgreSQL
</H1>
<P>
Last updated: Sat May 5 0
0:09:15
EDT 2007
</P>
<P>
Last updated: Sat May 5 0
6:20:41
EDT 2007
</P>
<P>
Current maintainer: Bruce Momjian (
<A
href=
"mailto:bruce@momjian.us"
>
bruce@momjian.us
</A>
)
<BR>
...
...
@@ -863,24 +863,25 @@
<DL>
<DT>
lfirst(i), lfirst_int(i), lfirst_oid(i)
</DT>
<DD>
return the data (a point
, integer and OID respectively) at
list
element
<I>
i.
</I></DD>
<DD>
return the data (a point
er, integer or OID respectively) of
list
cell
<I>
i.
</I></DD>
<DT>
lnext(i)
</DT>
<DD>
return the next list
element
after
<I>
i.
</I></DD>
<DD>
return the next list
cell
after
<I>
i.
</I></DD>
<DT>
foreach(i, list)
</DT>
<DD>
loop through
<I>
list,
</I>
assigning each list
element
to
<I>
i.
</I>
It is important to note that
<I>
i
</I>
is a List *,
loop through
<I>
list,
</I>
assigning each list
cell
to
<I>
i.
</I>
It is important to note that
<I>
i
</I>
is a List
Cell
*,
not the data in the
<I>
List
</I>
element. You need to use
<I>
lfirst(i)
</I>
to get at the data. Here is a typical code
snippet that loops through a List containing
<I>
Var *'s
</I>
and processes each one:
<PRE>
<CODE>
List *list;
<CODE>
List *list;
ListCell *i;
foreach(i, list)
...
...
@@ -900,26 +901,26 @@
<DT>
lappend(list, node)
</DT>
<DD>
add
<I>
node
</I>
to the end of
<I>
list.
</I>
This is more
expensive that lcons.
</DD>
<DD>
add
<I>
node
</I>
to the end of
<I>
list.
</I></DD>
<DT>
nconc
(list1, list2)
</DT>
<DT>
list_concat
(list1, list2)
</DT>
<DD>
Concat
<I>
list2
</I>
on to the end of
<I>
list1.
</I></DD>
<DD>
Concat
enate
<I>
list2
</I>
on to the end of
<I>
list1.
</I></DD>
<DT>
length(list)
</DT>
<DT>
l
ist_l
ength(list)
</DT>
<DD>
return the length of the
<I>
list.
</I></DD>
<DT>
nth(i, list
)
</DT>
<DT>
list_nth(list, i
)
</DT>
<DD>
return the
<I>
i
</I>
'th element in
<I>
list.
</I></DD>
<DD>
return the
<I>
i
</I>
'th element in
<I>
list,
</I>
counting from zero.
</DD>
<DT>
lcons
i
, ...
</DT>
<DT>
lcons
_int
, ...
</DT>
<DD>
There are integer versions of these:
<I>
lcons
i
,
lappend
i
</I>
, etc. Also versions for OID lists:
<I>
lconso
,
lappend
o
</I>
, etc.
</DD>
<DD>
There are integer versions of these:
<I>
lcons
_int
,
lappend
_int
</I>
, etc. Also versions for OID lists:
<I>
lcons_oid
,
lappend
_oid
</I>
, etc.
</DD>
</DL>
</BLOCKQUOTE>
You can print nodes easily inside
<I>
gdb.
</I>
First, to disable
...
...
@@ -944,7 +945,7 @@
<H3
id=
"item2.4"
>
2.4) I just added a field to a structure.
What else should I do?
</H3>
<P>
The structures pass
ing around from the parser, rewrite
,
<P>
The structures pass
ed around in the parser, rewriter
,
optimizer, and executor require quite a bit of support. Most
structures have support routines in
<I>
src/backend/nodes
</I>
used
to create, copy, read, and output those structures (in particular,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment