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
8a093d0a
Commit
8a093d0a
authored
Jan 10, 2000
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make number of args to a function configurable.
parent
6456b17b
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
374 additions
and
305 deletions
+374
-305
src/backend/access/hash/hashfunc.c
src/backend/access/hash/hashfunc.c
+2
-2
src/backend/access/nbtree/nbtcompare.c
src/backend/access/nbtree/nbtcompare.c
+2
-2
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_aggregate.c
+3
-3
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_operator.c
+9
-9
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_proc.c
+5
-5
src/backend/catalog/pg_type.c
src/backend/catalog/pg_type.c
+3
-3
src/backend/commands/_deadcode/recipe.c
src/backend/commands/_deadcode/recipe.c
+5
-5
src/backend/commands/comment.c
src/backend/commands/comment.c
+99
-99
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+2
-2
src/backend/commands/proclang.c
src/backend/commands/proclang.c
+2
-2
src/backend/commands/remove.c
src/backend/commands/remove.c
+5
-5
src/backend/commands/trigger.c
src/backend/commands/trigger.c
+35
-35
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+3
-3
src/backend/libpq/be-pqexec.c
src/backend/libpq/be-pqexec.c
+6
-6
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+3
-3
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+15
-15
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+3
-3
src/backend/tcop/fastpath.c
src/backend/tcop/fastpath.c
+6
-6
src/backend/utils/adt/regproc.c
src/backend/utils/adt/regproc.c
+6
-7
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/selfuncs.c
+5
-5
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/fmgr.c
+82
-11
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+54
-54
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dump.h
+2
-2
src/include/access/funcindex.h
src/include/access/funcindex.h
+2
-2
src/include/config.h.in
src/include/config.h.in
+3
-1
src/include/parser/parse_func.h
src/include/parser/parse_func.h
+1
-4
src/include/utils/rel.h
src/include/utils/rel.h
+2
-2
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_comp.c
+2
-2
src/pl/plpgsql/src/plpgsql.h
src/pl/plpgsql/src/plpgsql.h
+2
-2
src/pl/tcl/pltcl.c
src/pl/tcl/pltcl.c
+5
-5
No files found.
src/backend/access/hash/hashfunc.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.2
1 2000/01/10 16:13:10
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.2
2 2000/01/10 17:14:28
momjian Exp $
*
*
* NOTES
* NOTES
* These functions are stored in pg_amproc. For each operator class
* These functions are stored in pg_amproc. For each operator class
...
@@ -145,7 +145,7 @@ hashoidvector(Oid *key)
...
@@ -145,7 +145,7 @@ hashoidvector(Oid *key)
int
i
;
int
i
;
uint32
result
=
0
;
uint32
result
=
0
;
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
INDEX_MAX_KEYS
;
i
++
)
result
=
result
^
(
~
(
uint32
)
key
[
i
]);
result
=
result
^
(
~
(
uint32
)
key
[
i
]);
return
result
;
return
result
;
}
}
...
...
src/backend/access/nbtree/nbtcompare.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.
29 2000/01/10 16:13:10
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.
30 2000/01/10 17:14:29
momjian Exp $
*
*
* NOTES
* NOTES
* These functions are stored in pg_amproc. For each operator class
* These functions are stored in pg_amproc. For each operator class
...
@@ -98,7 +98,7 @@ btoidvectorcmp(Oid *a, Oid *b)
...
@@ -98,7 +98,7 @@ btoidvectorcmp(Oid *a, Oid *b)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
INDEX_MAX_KEYS
;
i
++
)
/* we use this because we need the int4gt, etc */
/* we use this because we need the int4gt, etc */
if
(
!
int4eq
(
a
[
i
],
b
[
i
]))
if
(
!
int4eq
(
a
[
i
],
b
[
i
]))
{
{
...
...
src/backend/catalog/pg_aggregate.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.2
6 1999/11/22 17:55:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.2
7 2000/01/10 17:14:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -71,11 +71,11 @@ AggregateCreate(char *aggName,
...
@@ -71,11 +71,11 @@ AggregateCreate(char *aggName,
Oid
xret1
=
InvalidOid
;
Oid
xret1
=
InvalidOid
;
Oid
xret2
=
InvalidOid
;
Oid
xret2
=
InvalidOid
;
Oid
fret
=
InvalidOid
;
Oid
fret
=
InvalidOid
;
Oid
fnArgs
[
8
];
Oid
fnArgs
[
FUNC_MAX_ARGS
];
NameData
aname
;
NameData
aname
;
TupleDesc
tupDesc
;
TupleDesc
tupDesc
;
MemSet
(
fnArgs
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
fnArgs
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
/* sanity checks */
/* sanity checks */
if
(
!
aggName
)
if
(
!
aggName
)
...
...
src/backend/catalog/pg_operator.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.4
6 2000/01/05 18:23:45
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.4
7 2000/01/10 17:14:31
momjian Exp $
*
*
* NOTES
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
* these routines moved here from commands/define.c and somewhat cleaned up.
...
@@ -482,7 +482,7 @@ OperatorDef(char *operatorName,
...
@@ -482,7 +482,7 @@ OperatorDef(char *operatorName,
bool
rightDefined
=
false
;
bool
rightDefined
=
false
;
bool
selfCommutator
=
false
;
bool
selfCommutator
=
false
;
char
*
name
[
4
];
char
*
name
[
4
];
Oid
typeId
[
8
];
Oid
typeId
[
FUNC_MAX_ARGS
];
int
nargs
;
int
nargs
;
NameData
oname
;
NameData
oname
;
TupleDesc
tupDesc
;
TupleDesc
tupDesc
;
...
@@ -556,7 +556,7 @@ OperatorDef(char *operatorName,
...
@@ -556,7 +556,7 @@ OperatorDef(char *operatorName,
* have to worry about deleting them later.
* have to worry about deleting them later.
* ----------------
* ----------------
*/
*/
MemSet
(
typeId
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
typeId
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
if
(
!
leftTypeName
)
if
(
!
leftTypeName
)
{
{
typeId
[
0
]
=
rightTypeId
;
typeId
[
0
]
=
rightTypeId
;
...
@@ -592,7 +592,7 @@ OperatorDef(char *operatorName,
...
@@ -592,7 +592,7 @@ OperatorDef(char *operatorName,
*/
*/
if
(
restrictionName
)
if
(
restrictionName
)
{
/* optional */
{
/* optional */
MemSet
(
typeId
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
typeId
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
typeId
[
0
]
=
OIDOID
;
/* operator OID */
typeId
[
0
]
=
OIDOID
;
/* operator OID */
typeId
[
1
]
=
OIDOID
;
/* relation OID */
typeId
[
1
]
=
OIDOID
;
/* relation OID */
typeId
[
2
]
=
INT2OID
;
/* attribute number */
typeId
[
2
]
=
INT2OID
;
/* attribute number */
...
@@ -617,7 +617,7 @@ OperatorDef(char *operatorName,
...
@@ -617,7 +617,7 @@ OperatorDef(char *operatorName,
*/
*/
if
(
joinName
)
if
(
joinName
)
{
/* optional */
{
/* optional */
MemSet
(
typeId
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
typeId
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
typeId
[
0
]
=
OIDOID
;
/* operator OID */
typeId
[
0
]
=
OIDOID
;
/* operator OID */
typeId
[
1
]
=
OIDOID
;
/* relation OID 1 */
typeId
[
1
]
=
OIDOID
;
/* relation OID 1 */
typeId
[
2
]
=
INT2OID
;
/* attribute number 1 */
typeId
[
2
]
=
INT2OID
;
/* attribute number 1 */
...
@@ -923,11 +923,11 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -923,11 +923,11 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_update
(
pg_operator_desc
,
&
tup
->
t_self
,
tup
,
NULL
);
heap_update
(
pg_operator_desc
,
&
tup
->
t_self
,
tup
,
NULL
);
setheapoverride
(
false
);
setheapoverride
(
false
);
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
{
{
Relation
idescs
[
Num_pg_operator_indices
];
Relation
idescs
[
Num_pg_operator_indices
];
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
...
@@ -961,7 +961,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -961,7 +961,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
{
{
Relation
idescs
[
Num_pg_operator_indices
];
Relation
idescs
[
Num_pg_operator_indices
];
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
...
@@ -1001,7 +1001,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -1001,7 +1001,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
if
(
RelationGetForm
(
pg_operator_desc
)
->
relhasindex
)
{
{
Relation
idescs
[
Num_pg_operator_indices
];
Relation
idescs
[
Num_pg_operator_indices
];
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_operator_indices
,
Name_pg_operator_indices
,
idescs
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogIndexInsert
(
idescs
,
Num_pg_operator_indices
,
pg_operator_desc
,
tup
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_operator_indices
,
idescs
);
...
...
src/backend/catalog/pg_proc.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.3
6 1999/11/22 17:55:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.3
7 2000/01/10 17:14:31
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -61,7 +61,7 @@ ProcedureCreate(char *procedureName,
...
@@ -61,7 +61,7 @@ ProcedureCreate(char *procedureName,
List
*
x
;
List
*
x
;
List
*
querytree_list
;
List
*
querytree_list
;
List
*
plan_list
;
List
*
plan_list
;
Oid
typev
[
8
];
Oid
typev
[
FUNC_MAX_ARGS
];
Oid
relid
;
Oid
relid
;
Oid
toid
;
Oid
toid
;
NameData
procname
;
NameData
procname
;
...
@@ -75,13 +75,13 @@ ProcedureCreate(char *procedureName,
...
@@ -75,13 +75,13 @@ ProcedureCreate(char *procedureName,
Assert
(
PointerIsValid
(
probin
));
Assert
(
PointerIsValid
(
probin
));
parameterCount
=
0
;
parameterCount
=
0
;
MemSet
(
typev
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
typev
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
foreach
(
x
,
argList
)
foreach
(
x
,
argList
)
{
{
Value
*
t
=
lfirst
(
x
);
Value
*
t
=
lfirst
(
x
);
if
(
parameterCount
==
8
)
if
(
parameterCount
==
FUNC_MAX_ARGS
)
elog
(
ERROR
,
"Procedures cannot take more than
8 arguments"
);
elog
(
ERROR
,
"Procedures cannot take more than
%d arguments"
,
FUNC_MAX_ARGS
);
if
(
strcmp
(
strVal
(
t
),
"opaque"
)
==
0
)
if
(
strcmp
(
strVal
(
t
),
"opaque"
)
==
0
)
{
{
...
...
src/backend/catalog/pg_type.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.4
4 1999/12/16 22:19:39 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.4
5 2000/01/10 17:14:31 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -305,7 +305,7 @@ TypeCreate(char *typeName,
...
@@ -305,7 +305,7 @@ TypeCreate(char *typeName,
bool
defined
;
bool
defined
;
NameData
name
;
NameData
name
;
TupleDesc
tupDesc
;
TupleDesc
tupDesc
;
Oid
argList
[
8
];
Oid
argList
[
FUNC_MAX_ARGS
];
static
ScanKeyData
typeKey
[
1
]
=
{
static
ScanKeyData
typeKey
[
1
]
=
{
{
0
,
Anum_pg_type_typname
,
F_NAMEEQ
}
{
0
,
Anum_pg_type_typname
,
F_NAMEEQ
}
...
@@ -393,7 +393,7 @@ TypeCreate(char *typeName,
...
@@ -393,7 +393,7 @@ TypeCreate(char *typeName,
* First look for a 1-argument func with all argtypes 0. This is
* First look for a 1-argument func with all argtypes 0. This is
* valid for all four kinds of procedure.
* valid for all four kinds of procedure.
*/
*/
MemSet
(
argList
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
argList
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
tup
=
SearchSysCacheTuple
(
PROCNAME
,
tup
=
SearchSysCacheTuple
(
PROCNAME
,
PointerGetDatum
(
procname
),
PointerGetDatum
(
procname
),
...
...
src/backend/commands/_deadcode/recipe.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.
7 1999/07/16 04:58:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.
8 2000/01/10 17:14:33
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -695,14 +695,14 @@ getParamTypes(TgElement * elem, Oid *typev)
...
@@ -695,14 +695,14 @@ getParamTypes(TgElement * elem, Oid *typev)
j
;
j
;
parameterCount
=
0
;
parameterCount
=
0
;
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
FUNC_MAX_ARGS
;
i
++
)
typev
[
i
]
=
0
;
typev
[
i
]
=
0
;
for
(
j
=
0
;
j
<
elem
->
inTypes
->
num
;
j
++
)
for
(
j
=
0
;
j
<
elem
->
inTypes
->
num
;
j
++
)
{
{
if
(
parameterCount
==
8
)
if
(
parameterCount
==
FUNC_MAX_ARGS
)
{
{
elog
(
ERROR
,
elog
(
ERROR
,
"getParamTypes: Ingredients cannot take >
8 arguments"
);
"getParamTypes: Ingredients cannot take >
%d arguments"
,
FUNC_MAX_ARGS
);
}
}
t
=
elem
->
inTypes
->
val
[
j
];
t
=
elem
->
inTypes
->
val
[
j
];
if
(
strcmp
(
t
,
"opaque"
)
==
0
)
if
(
strcmp
(
t
,
"opaque"
)
==
0
)
...
@@ -810,7 +810,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
...
@@ -810,7 +810,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
{
{
TgElement
*
elem
;
TgElement
*
elem
;
char
*
funcName
;
char
*
funcName
;
Oid
typev
[
8
],
/* eight arguments maximum */
Oid
typev
[
FUNC_MAX_ARGS
],
/* eight arguments maximum */
relid
;
relid
;
int
i
,
int
i
,
parameterCount
;
parameterCount
;
...
...
src/backend/commands/comment.c
View file @
8a093d0a
/*-------------------------------------------------------------------------
/*-------------------------------------------------------------------------
*
*
* comment.c
* comment.c
*
*
* PostgreSQL object comments utility code.
* PostgreSQL object comments utility code.
*
*
* Copyright (c) 1999, PostgreSQL Global Development Group
* Copyright (c) 1999, PostgreSQL Global Development Group
...
@@ -34,10 +34,10 @@
...
@@ -34,10 +34,10 @@
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* Static Function Prototypes --
* Static Function Prototypes --
*
*
* The following protoypes are declared static so as not to conflict
* The following protoypes are declared static so as not to conflict
* with any other routines outside this module. These routines are
* with any other routines outside this module. These routines are
* called by the public function CommentObject() routine to create
* called by the public function CommentObject() routine to create
* the appropriate comment for the specific object type.
* the appropriate comment for the specific object type.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -55,10 +55,10 @@ static void CommentTrigger(char *trigger, char *relation, char *comments);
...
@@ -55,10 +55,10 @@ static void CommentTrigger(char *trigger, char *relation, char *comments);
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CommentObject --
* CommentObject --
*
*
* This routine is used to add the associated comment into
* This routine is used to add the associated comment into
* pg_description for the object specified by the paramters handed
* pg_description for the object specified by the paramters handed
* to this routine. If the routine cannot determine an Oid to
* to this routine. If the routine cannot determine an Oid to
* associated with the parameters handed to this routine, an
* associated with the parameters handed to this routine, an
* error is thrown. Otherwise the comment is added to pg_description
* error is thrown. Otherwise the comment is added to pg_description
* by calling the CreateComments() routine. If the comments were
* by calling the CreateComments() routine. If the comments were
* empty, CreateComments() will drop any comments associated with
* empty, CreateComments() will drop any comments associated with
...
@@ -66,9 +66,9 @@ static void CommentTrigger(char *trigger, char *relation, char *comments);
...
@@ -66,9 +66,9 @@ static void CommentTrigger(char *trigger, char *relation, char *comments);
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
void
CommentObject
(
int
objtype
,
char
*
objname
,
char
*
objproperty
,
void
CommentObject
(
int
objtype
,
char
*
objname
,
char
*
objproperty
,
List
*
objlist
,
char
*
comment
)
{
List
*
objlist
,
char
*
comment
)
{
switch
(
objtype
)
{
switch
(
objtype
)
{
case
(
INDEX
):
case
(
INDEX
):
case
(
SEQUENCE
):
case
(
SEQUENCE
):
...
@@ -102,18 +102,18 @@ void CommentObject(int objtype, char *objname, char *objproperty,
...
@@ -102,18 +102,18 @@ void CommentObject(int objtype, char *objname, char *objproperty,
break
;
break
;
default:
default:
elog
(
ERROR
,
"An attempt was made to comment on a unkown type: %i"
,
elog
(
ERROR
,
"An attempt was made to comment on a unkown type: %i"
,
objtype
);
objtype
);
}
}
}
}
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CreateComments --
* CreateComments --
*
*
* This routine is handed the oid and the command associated
* This routine is handed the oid and the command associated
* with that id and will insert, update, or delete (if the
* with that id and will insert, update, or delete (if the
* comment is an empty string or a NULL pointer) the associated
* comment is an empty string or a NULL pointer) the associated
* comment from the system cataloge, pg_description.
* comment from the system cataloge, pg_description.
*
*
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -147,7 +147,7 @@ void CreateComments(Oid oid, char *comment) {
...
@@ -147,7 +147,7 @@ void CreateComments(Oid oid, char *comment) {
}
}
/*** Now, open pg_description and attempt to find the old tuple ***/
/*** Now, open pg_description and attempt to find the old tuple ***/
ScanKeyEntryInitialize
(
&
entry
,
0x0
,
Anum_pg_description_objoid
,
F_OIDEQ
,
ScanKeyEntryInitialize
(
&
entry
,
0x0
,
Anum_pg_description_objoid
,
F_OIDEQ
,
ObjectIdGetDatum
(
oid
));
ObjectIdGetDatum
(
oid
));
scan
=
heap_beginscan
(
description
,
false
,
SnapshotNow
,
1
,
&
entry
);
scan
=
heap_beginscan
(
description
,
false
,
SnapshotNow
,
1
,
&
entry
);
...
@@ -156,21 +156,21 @@ void CreateComments(Oid oid, char *comment) {
...
@@ -156,21 +156,21 @@ void CreateComments(Oid oid, char *comment) {
/*** If a previous tuple exists, either delete or prep replacement ***/
/*** If a previous tuple exists, either delete or prep replacement ***/
if
(
HeapTupleIsValid
(
searchtuple
))
{
if
(
HeapTupleIsValid
(
searchtuple
))
{
/*** If the comment is blank, call heap_delete, else heap_update ***/
/*** If the comment is blank, call heap_delete, else heap_update ***/
if
((
comment
==
NULL
)
||
(
strlen
(
comment
)
==
0
))
{
if
((
comment
==
NULL
)
||
(
strlen
(
comment
)
==
0
))
{
heap_delete
(
description
,
&
searchtuple
->
t_self
,
NULL
);
heap_delete
(
description
,
&
searchtuple
->
t_self
,
NULL
);
}
else
{
}
else
{
desctuple
=
heap_modifytuple
(
searchtuple
,
description
,
values
,
desctuple
=
heap_modifytuple
(
searchtuple
,
description
,
values
,
nulls
,
replaces
);
nulls
,
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_update
(
description
,
&
searchtuple
->
t_self
,
desctuple
,
NULL
);
heap_update
(
description
,
&
searchtuple
->
t_self
,
desctuple
,
NULL
);
setheapoverride
(
false
);
setheapoverride
(
false
);
modified
=
TRUE
;
modified
=
TRUE
;
}
}
}
else
{
}
else
{
desctuple
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
desctuple
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
heap_insert
(
description
,
desctuple
);
heap_insert
(
description
,
desctuple
);
modified
=
TRUE
;
modified
=
TRUE
;
...
@@ -179,14 +179,14 @@ void CreateComments(Oid oid, char *comment) {
...
@@ -179,14 +179,14 @@ void CreateComments(Oid oid, char *comment) {
/*** Complete the scan, update indices, if necessary ***/
/*** Complete the scan, update indices, if necessary ***/
heap_endscan
(
scan
);
heap_endscan
(
scan
);
if
(
modified
)
{
if
(
modified
)
{
if
(
RelationGetForm
(
description
)
->
relhasindex
)
{
if
(
RelationGetForm
(
description
)
->
relhasindex
)
{
Relation
idescs
[
Num_pg_description_indices
];
Relation
idescs
[
Num_pg_description_indices
];
CatalogOpenIndices
(
Num_pg_description_indices
,
CatalogOpenIndices
(
Num_pg_description_indices
,
Name_pg_description_indices
,
idescs
);
Name_pg_description_indices
,
idescs
);
CatalogIndexInsert
(
idescs
,
Num_pg_description_indices
,
description
,
CatalogIndexInsert
(
idescs
,
Num_pg_description_indices
,
description
,
desctuple
);
desctuple
);
CatalogCloseIndices
(
Num_pg_description_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_description_indices
,
idescs
);
}
}
...
@@ -198,10 +198,10 @@ void CreateComments(Oid oid, char *comment) {
...
@@ -198,10 +198,10 @@ void CreateComments(Oid oid, char *comment) {
}
}
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* DeleteComments --
* DeleteComments --
*
*
* This routine is used to purge any comments
* This routine is used to purge any comments
* associated with the Oid handed to this routine,
* associated with the Oid handed to this routine,
* regardless of the actual object type. It is
* regardless of the actual object type. It is
* called, for example, when a relation is destroyed.
* called, for example, when a relation is destroyed.
...
@@ -220,7 +220,7 @@ void DeleteComments(Oid oid) {
...
@@ -220,7 +220,7 @@ void DeleteComments(Oid oid) {
tupDesc
=
description
->
rd_att
;
tupDesc
=
description
->
rd_att
;
/*** Now, open pg_description and attempt to find the old tuple ***/
/*** Now, open pg_description and attempt to find the old tuple ***/
ScanKeyEntryInitialize
(
&
entry
,
0x0
,
Anum_pg_description_objoid
,
F_OIDEQ
,
ScanKeyEntryInitialize
(
&
entry
,
0x0
,
Anum_pg_description_objoid
,
F_OIDEQ
,
ObjectIdGetDatum
(
oid
));
ObjectIdGetDatum
(
oid
));
scan
=
heap_beginscan
(
description
,
false
,
SnapshotNow
,
1
,
&
entry
);
scan
=
heap_beginscan
(
description
,
false
,
SnapshotNow
,
1
,
&
entry
);
...
@@ -228,24 +228,24 @@ void DeleteComments(Oid oid) {
...
@@ -228,24 +228,24 @@ void DeleteComments(Oid oid) {
/*** If a previous tuple exists, delete it ***/
/*** If a previous tuple exists, delete it ***/
if
(
HeapTupleIsValid
(
searchtuple
))
{
if
(
HeapTupleIsValid
(
searchtuple
))
{
heap_delete
(
description
,
&
searchtuple
->
t_self
,
NULL
);
heap_delete
(
description
,
&
searchtuple
->
t_self
,
NULL
);
}
}
/*** Complete the scan, update indices, if necessary ***/
/*** Complete the scan, update indices, if necessary ***/
heap_endscan
(
scan
);
heap_endscan
(
scan
);
heap_close
(
description
,
RowExclusiveLock
);
heap_close
(
description
,
RowExclusiveLock
);
}
}
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CommentRelation --
* CommentRelation --
*
*
* This routine is used to add/drop a comment from a relation, where
* This routine is used to add/drop a comment from a relation, where
* a relation is a TABLE, SEQUENCE, VIEW or INDEX. The routine simply
* a relation is a TABLE, SEQUENCE, VIEW or INDEX. The routine simply
* finds the relation name by searching the system cache, locating
* finds the relation name by searching the system cache, locating
* the appropriate tuple, and inserting a comment using that
* the appropriate tuple, and inserting a comment using that
* tuple's oid. Its parameters are the relation name and comments.
* tuple's oid. Its parameters are the relation name and comments.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -300,10 +300,10 @@ void CommentRelation(int reltype, char *relname, char *comment) {
...
@@ -300,10 +300,10 @@ void CommentRelation(int reltype, char *relname, char *comment) {
}
}
break
;
break
;
}
}
/*** Create the comments using the tuple's oid ***/
/*** Create the comments using the tuple's oid ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
}
}
...
@@ -311,11 +311,11 @@ void CommentRelation(int reltype, char *relname, char *comment) {
...
@@ -311,11 +311,11 @@ void CommentRelation(int reltype, char *relname, char *comment) {
* CommentAttribute --
* CommentAttribute --
*
*
* This routine is used to add/drop a comment from an attribute
* This routine is used to add/drop a comment from an attribute
* such as a table's column. The routine will check security
* such as a table's column. The routine will check security
* restrictions and then attempt to fetch the oid of the associated
* restrictions and then attempt to fetch the oid of the associated
* attribute. If successful, a comment is added/dropped, else an
* attribute. If successful, a comment is added/dropped, else an
* elog() exception is thrown. The parameters are the relation
* elog() exception is thrown. The parameters are the relation
* and attribute names, and the comments
* and attribute names, and the comments
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -332,10 +332,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
...
@@ -332,10 +332,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
elog
(
ERROR
,
"you are not permitted to comment on class '%s
\'
"
,
relname
);
elog
(
ERROR
,
"you are not permitted to comment on class '%s
\'
"
,
relname
);
}
}
#endif
#endif
/*** Now, fetch the attribute oid from the system cache ***/
/*** Now, fetch the attribute oid from the system cache ***/
relation
=
heap_openr
(
relname
,
AccessShareLock
);
relation
=
heap_openr
(
relname
,
AccessShareLock
);
attrtuple
=
SearchSysCacheTuple
(
ATTNAME
,
ObjectIdGetDatum
(
relation
->
rd_id
),
attrtuple
=
SearchSysCacheTuple
(
ATTNAME
,
ObjectIdGetDatum
(
relation
->
rd_id
),
PointerGetDatum
(
attrname
),
0
,
0
);
PointerGetDatum
(
attrname
),
0
,
0
);
if
(
!
HeapTupleIsValid
(
attrtuple
))
{
if
(
!
HeapTupleIsValid
(
attrtuple
))
{
...
@@ -343,14 +343,14 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
...
@@ -343,14 +343,14 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
attrname
,
relname
);
attrname
,
relname
);
}
}
oid
=
attrtuple
->
t_data
->
t_oid
;
oid
=
attrtuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
/*** Now, close the heap relation and return ***/
/*** Now, close the heap relation and return ***/
heap_close
(
relation
,
AccessShareLock
);
heap_close
(
relation
,
AccessShareLock
);
}
}
...
@@ -358,10 +358,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
...
@@ -358,10 +358,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) {
* CommentDatabase --
* CommentDatabase --
*
*
* This routine is used to add/drop any user-comments a user might
* This routine is used to add/drop any user-comments a user might
* have regarding the specified database. The routine will check
* have regarding the specified database. The routine will check
* security for owner permissions, and, if succesful, will then
* security for owner permissions, and, if succesful, will then
* attempt to find the oid of the database specified. Once found,
* attempt to find the oid of the database specified. Once found,
* a comment is added/dropped using the CreateComments() routine.
* a comment is added/dropped using the CreateComments() routine.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -374,7 +374,7 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -374,7 +374,7 @@ void CommentDatabase(char *database, char *comment) {
Oid
oid
;
Oid
oid
;
bool
superuser
;
bool
superuser
;
int4
dba
,
userid
;
int4
dba
,
userid
;
char
*
username
;
char
*
username
;
/*** First find the tuple in pg_database for the database ***/
/*** First find the tuple in pg_database for the database ***/
...
@@ -383,7 +383,7 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -383,7 +383,7 @@ void CommentDatabase(char *database, char *comment) {
F_NAMEEQ
,
NameGetDatum
(
database
));
F_NAMEEQ
,
NameGetDatum
(
database
));
scan
=
heap_beginscan
(
pg_database
,
0
,
SnapshotNow
,
1
,
&
entry
);
scan
=
heap_beginscan
(
pg_database
,
0
,
SnapshotNow
,
1
,
&
entry
);
dbtuple
=
heap_getnext
(
scan
,
0
);
dbtuple
=
heap_getnext
(
scan
,
0
);
/*** Validate database exists, and fetch the dba id and oid ***/
/*** Validate database exists, and fetch the dba id and oid ***/
if
(
!
HeapTupleIsValid
(
dbtuple
))
{
if
(
!
HeapTupleIsValid
(
dbtuple
))
{
...
@@ -391,9 +391,9 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -391,9 +391,9 @@ void CommentDatabase(char *database, char *comment) {
}
}
dba
=
((
Form_pg_database
)
GETSTRUCT
(
dbtuple
))
->
datdba
;
dba
=
((
Form_pg_database
)
GETSTRUCT
(
dbtuple
))
->
datdba
;
oid
=
dbtuple
->
t_data
->
t_oid
;
oid
=
dbtuple
->
t_data
->
t_oid
;
/*** Now, fetch user information ***/
/*** Now, fetch user information ***/
username
=
GetPgUserName
();
username
=
GetPgUserName
();
usertuple
=
SearchSysCacheTuple
(
SHADOWNAME
,
PointerGetDatum
(
username
),
usertuple
=
SearchSysCacheTuple
(
SHADOWNAME
,
PointerGetDatum
(
username
),
0
,
0
,
0
);
0
,
0
,
0
);
...
@@ -402,9 +402,9 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -402,9 +402,9 @@ void CommentDatabase(char *database, char *comment) {
}
}
userid
=
((
Form_pg_shadow
)
GETSTRUCT
(
usertuple
))
->
usesysid
;
userid
=
((
Form_pg_shadow
)
GETSTRUCT
(
usertuple
))
->
usesysid
;
superuser
=
((
Form_pg_shadow
)
GETSTRUCT
(
usertuple
))
->
usesuper
;
superuser
=
((
Form_pg_shadow
)
GETSTRUCT
(
usertuple
))
->
usesuper
;
/*** Allow if the userid matches the database dba or is a superuser ***/
/*** Allow if the userid matches the database dba or is a superuser ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
if
(
!
(
superuser
||
(
userid
==
dba
)))
{
if
(
!
(
superuser
||
(
userid
==
dba
)))
{
elog
(
ERROR
,
"you are not permitted to comment on database '%s'"
,
elog
(
ERROR
,
"you are not permitted to comment on database '%s'"
,
...
@@ -413,11 +413,11 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -413,11 +413,11 @@ void CommentDatabase(char *database, char *comment) {
#endif
#endif
/*** Create the comments with the pg_database oid ***/
/*** Create the comments with the pg_database oid ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
/*** Complete the scan and close any opened relations ***/
/*** Complete the scan and close any opened relations ***/
heap_endscan
(
scan
);
heap_endscan
(
scan
);
heap_close
(
pg_database
,
AccessShareLock
);
heap_close
(
pg_database
,
AccessShareLock
);
...
@@ -428,7 +428,7 @@ void CommentDatabase(char *database, char *comment) {
...
@@ -428,7 +428,7 @@ void CommentDatabase(char *database, char *comment) {
*
*
* This routine is used to add/drop any user-comments a user might
* This routine is used to add/drop any user-comments a user might
* have regarding a specified RULE. The rule is specified by name
* have regarding a specified RULE. The rule is specified by name
* and, if found, and the user has appropriate permissions, a
* and, if found, and the user has appropriate permissions, a
* comment will be added/dropped using the CreateComments() routine.
* comment will be added/dropped using the CreateComments() routine.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -441,8 +441,8 @@ void CommentRewrite(char *rule, char *comment) {
...
@@ -441,8 +441,8 @@ void CommentRewrite(char *rule, char *comment) {
int
aclcheck
;
int
aclcheck
;
/*** First, validate user ***/
/*** First, validate user ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
user
=
GetPgUserName
();
user
=
GetPgUserName
();
relation
=
RewriteGetRuleEventRel
(
rule
);
relation
=
RewriteGetRuleEventRel
(
rule
);
aclcheck
=
pg_aclcheck
(
relation
,
user
,
ACL_RU
);
aclcheck
=
pg_aclcheck
(
relation
,
user
,
ACL_RU
);
...
@@ -453,7 +453,7 @@ void CommentRewrite(char *rule, char *comment) {
...
@@ -453,7 +453,7 @@ void CommentRewrite(char *rule, char *comment) {
#endif
#endif
/*** Next, find the rule's oid ***/
/*** Next, find the rule's oid ***/
rewritetuple
=
SearchSysCacheTuple
(
RULENAME
,
PointerGetDatum
(
rule
),
rewritetuple
=
SearchSysCacheTuple
(
RULENAME
,
PointerGetDatum
(
rule
),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
rewritetuple
))
{
if
(
!
HeapTupleIsValid
(
rewritetuple
))
{
...
@@ -461,7 +461,7 @@ void CommentRewrite(char *rule, char *comment) {
...
@@ -461,7 +461,7 @@ void CommentRewrite(char *rule, char *comment) {
}
}
oid
=
rewritetuple
->
t_data
->
t_oid
;
oid
=
rewritetuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
...
@@ -473,7 +473,7 @@ void CommentRewrite(char *rule, char *comment) {
...
@@ -473,7 +473,7 @@ void CommentRewrite(char *rule, char *comment) {
*
*
* This routine is used to add/drop any user-comments a user might
* This routine is used to add/drop any user-comments a user might
* have regarding a TYPE. The type is specified by name
* have regarding a TYPE. The type is specified by name
* and, if found, and the user has appropriate permissions, a
* and, if found, and the user has appropriate permissions, a
* comment will be added/dropped using the CreateComments() routine.
* comment will be added/dropped using the CreateComments() routine.
* The type's name and the comments are the paramters to this routine.
* The type's name and the comments are the paramters to this routine.
*------------------------------------------------------------------
*------------------------------------------------------------------
...
@@ -486,17 +486,17 @@ void CommentType(char *type, char *comment) {
...
@@ -486,17 +486,17 @@ void CommentType(char *type, char *comment) {
char
*
user
;
char
*
user
;
/*** First, validate user ***/
/*** First, validate user ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
user
=
GetPgUserName
();
user
=
GetPgUserName
();
if
(
!
pg_ownercheck
(
user
,
type
,
TYPENAME
))
{
if
(
!
pg_ownercheck
(
user
,
type
,
TYPENAME
))
{
elog
(
ERROR
,
"you are not permitted to comment on type '%s'"
,
elog
(
ERROR
,
"you are not permitted to comment on type '%s'"
,
type
);
type
);
}
}
#endif
#endif
/*** Next, find the type's oid ***/
/*** Next, find the type's oid ***/
typetuple
=
SearchSysCacheTuple
(
TYPENAME
,
PointerGetDatum
(
type
),
typetuple
=
SearchSysCacheTuple
(
TYPENAME
,
PointerGetDatum
(
type
),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
typetuple
))
{
if
(
!
HeapTupleIsValid
(
typetuple
))
{
...
@@ -504,7 +504,7 @@ void CommentType(char *type, char *comment) {
...
@@ -504,7 +504,7 @@ void CommentType(char *type, char *comment) {
}
}
oid
=
typetuple
->
t_data
->
t_oid
;
oid
=
typetuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
...
@@ -514,20 +514,20 @@ void CommentType(char *type, char *comment) {
...
@@ -514,20 +514,20 @@ void CommentType(char *type, char *comment) {
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CommentAggregate --
* CommentAggregate --
*
*
* This routine is used to allow a user to provide comments on an
* This routine is used to allow a user to provide comments on an
* aggregate function. The aggregate function is determined by both
* aggregate function. The aggregate function is determined by both
* its name and its argument type, which, with the comments are
* its name and its argument type, which, with the comments are
* the three parameters handed to this routine.
* the three parameters handed to this routine.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
void
CommentAggregate
(
char
*
aggregate
,
char
*
argument
,
char
*
comment
)
{
void
CommentAggregate
(
char
*
aggregate
,
char
*
argument
,
char
*
comment
)
{
HeapTuple
aggtuple
;
HeapTuple
aggtuple
;
Oid
baseoid
,
oid
;
Oid
baseoid
,
oid
;
bool
defined
;
bool
defined
;
char
*
user
;
char
*
user
;
/*** First, attempt to determine the base aggregate oid ***/
/*** First, attempt to determine the base aggregate oid ***/
if
(
argument
)
{
if
(
argument
)
{
...
@@ -538,7 +538,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
...
@@ -538,7 +538,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
}
else
{
}
else
{
baseoid
=
0
;
baseoid
=
0
;
}
}
/*** Next, validate the user's attempt to comment ***/
/*** Next, validate the user's attempt to comment ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
...
@@ -566,9 +566,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
...
@@ -566,9 +566,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
elog
(
ERROR
,
"aggregate '%s' does not exist"
,
aggregate
);
elog
(
ERROR
,
"aggregate '%s' does not exist"
,
aggregate
);
}
}
}
}
oid
=
aggtuple
->
t_data
->
t_oid
;
oid
=
aggtuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
...
@@ -578,9 +578,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
...
@@ -578,9 +578,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CommentProc --
* CommentProc --
*
*
* This routine is used to allow a user to provide comments on an
* This routine is used to allow a user to provide comments on an
* procedure (function). The procedure is determined by both
* procedure (function). The procedure is determined by both
* its name and its argument list. The argument list is expected to
* its name and its argument list. The argument list is expected to
* be a series of parsed nodes pointed to by a List object. If the
* be a series of parsed nodes pointed to by a List object. If the
* comments string is empty, the associated comment is dropped.
* comments string is empty, the associated comment is dropped.
*------------------------------------------------------------------
*------------------------------------------------------------------
...
@@ -589,7 +589,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
...
@@ -589,7 +589,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) {
void
CommentProc
(
char
*
function
,
List
*
arguments
,
char
*
comment
)
{
void
CommentProc
(
char
*
function
,
List
*
arguments
,
char
*
comment
)
{
HeapTuple
argtuple
,
functuple
;
HeapTuple
argtuple
,
functuple
;
Oid
oid
,
argoids
[
8
];
Oid
oid
,
argoids
[
FUNC_MAX_ARGS
];
char
*
user
,
*
argument
;
char
*
user
,
*
argument
;
int
i
,
argcount
;
int
i
,
argcount
;
...
@@ -597,7 +597,7 @@ void CommentProc(char *function, List *arguments, char *comment) {
...
@@ -597,7 +597,7 @@ void CommentProc(char *function, List *arguments, char *comment) {
argcount
=
length
(
arguments
);
argcount
=
length
(
arguments
);
if
(
argcount
>
0
)
{
if
(
argcount
>
0
)
{
MemSet
(
argoids
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
argoids
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
for
(
i
=
0
;
i
<
argcount
;
i
++
)
{
for
(
i
=
0
;
i
<
argcount
;
i
++
)
{
argument
=
strVal
(
lfirst
(
arguments
));
argument
=
strVal
(
lfirst
(
arguments
));
arguments
=
lnext
(
arguments
);
arguments
=
lnext
(
arguments
);
...
@@ -632,29 +632,29 @@ void CommentProc(char *function, List *arguments, char *comment) {
...
@@ -632,29 +632,29 @@ void CommentProc(char *function, List *arguments, char *comment) {
PointerGetDatum
(
argoids
),
0
);
PointerGetDatum
(
argoids
),
0
);
/*** Deallocate our argument oids and check the function tuple ***/
/*** Deallocate our argument oids and check the function tuple ***/
if
(
!
HeapTupleIsValid
(
functuple
))
{
if
(
!
HeapTupleIsValid
(
functuple
))
{
elog
(
ERROR
,
"function '%s' with the supplied %s does not exist"
,
elog
(
ERROR
,
"function '%s' with the supplied %s does not exist"
,
function
,
"argument list"
);
function
,
"argument list"
);
}
}
oid
=
functuple
->
t_data
->
t_oid
;
oid
=
functuple
->
t_data
->
t_oid
;
/*** Call CreateComments() to create/drop the comments ***/
/*** Call CreateComments() to create/drop the comments ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
}
}
/*------------------------------------------------------------------
/*------------------------------------------------------------------
* CommentOperator --
* CommentOperator --
*
*
* This routine is used to allow a user to provide comments on an
* This routine is used to allow a user to provide comments on an
* operator. The operator for commenting is determined by both
* operator. The operator for commenting is determined by both
* its name and its argument list which defines the left and right
* its name and its argument list which defines the left and right
* hand types the operator will operate on. The argument list is
* hand types the operator will operate on. The argument list is
* expected to be a couple of parse nodes pointed to be a List
* expected to be a couple of parse nodes pointed to be a List
* object. If the comments string is empty, the associated comment
* object. If the comments string is empty, the associated comment
* is dropped.
* is dropped.
*------------------------------------------------------------------
*------------------------------------------------------------------
*/
*/
...
@@ -670,7 +670,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
...
@@ -670,7 +670,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
if
(
lfirst
(
arguments
)
!=
NULL
)
{
if
(
lfirst
(
arguments
)
!=
NULL
)
{
lefttype
=
strVal
(
lfirst
(
arguments
));
lefttype
=
strVal
(
lfirst
(
arguments
));
}
}
if
(
lsecond
(
arguments
)
!=
NULL
)
{
if
(
lsecond
(
arguments
)
!=
NULL
)
{
righttype
=
strVal
(
lsecond
(
arguments
));
righttype
=
strVal
(
lsecond
(
arguments
));
}
}
...
@@ -683,9 +683,9 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
...
@@ -683,9 +683,9 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
elog
(
ERROR
,
"left type '%s' does not exist"
,
lefttype
);
elog
(
ERROR
,
"left type '%s' does not exist"
,
lefttype
);
}
}
}
}
/*** Attempt to fetch the right oid, if specified ***/
/*** Attempt to fetch the right oid, if specified ***/
if
(
righttype
!=
NULL
)
{
if
(
righttype
!=
NULL
)
{
rightoid
=
TypeGet
(
righttype
,
&
defined
);
rightoid
=
TypeGet
(
righttype
,
&
defined
);
if
(
!
OidIsValid
(
rightoid
))
{
if
(
!
OidIsValid
(
rightoid
))
{
...
@@ -699,7 +699,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
...
@@ -699,7 +699,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
else
if
(
OidIsValid
(
leftoid
))
oprtype
=
'l'
;
else
if
(
OidIsValid
(
leftoid
))
oprtype
=
'l'
;
else
if
(
OidIsValid
(
rightoid
))
oprtype
=
'r'
;
else
if
(
OidIsValid
(
rightoid
))
oprtype
=
'r'
;
else
elog
(
ERROR
,
"operator '%s' is of an illegal type'"
,
opername
);
else
elog
(
ERROR
,
"operator '%s' is of an illegal type'"
,
opername
);
/*** Attempt to fetch the operator oid ***/
/*** Attempt to fetch the operator oid ***/
optuple
=
SearchSysCacheTupleCopy
(
OPERNAME
,
PointerGetDatum
(
opername
),
optuple
=
SearchSysCacheTupleCopy
(
OPERNAME
,
PointerGetDatum
(
opername
),
...
@@ -710,8 +710,8 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
...
@@ -710,8 +710,8 @@ void CommentOperator(char *opername, List *arguments, char *comment) {
elog
(
ERROR
,
"operator '%s' does not exist"
,
opername
);
elog
(
ERROR
,
"operator '%s' does not exist"
,
opername
);
}
}
oid
=
optuple
->
t_data
->
t_oid
;
oid
=
optuple
->
t_data
->
t_oid
;
/*** Valid user's ability to comment on this operator ***/
/*** Valid user's ability to comment on this operator ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
...
@@ -748,8 +748,8 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
...
@@ -748,8 +748,8 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
ScanKeyData
entry
;
ScanKeyData
entry
;
Oid
oid
=
InvalidOid
;
Oid
oid
=
InvalidOid
;
char
*
user
;
char
*
user
;
/*** First, validate the user's action ***/
/*** First, validate the user's action ***/
#ifndef NO_SECURITY
#ifndef NO_SECURITY
user
=
GetPgUserName
();
user
=
GetPgUserName
();
...
@@ -761,10 +761,10 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
...
@@ -761,10 +761,10 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
/*** Now, fetch the trigger oid from pg_trigger ***/
/*** Now, fetch the trigger oid from pg_trigger ***/
relation
=
heap_openr
(
relname
,
AccessShareLock
);
relation
=
heap_openr
(
relname
,
AccessShareLock
);
pg_trigger
=
heap_openr
(
TriggerRelationName
,
AccessShareLock
);
pg_trigger
=
heap_openr
(
TriggerRelationName
,
AccessShareLock
);
ScanKeyEntryInitialize
(
&
entry
,
0
,
Anum_pg_trigger_tgrelid
,
ScanKeyEntryInitialize
(
&
entry
,
0
,
Anum_pg_trigger_tgrelid
,
F_OIDEQ
,
RelationGetRelid
(
relation
));
F_OIDEQ
,
RelationGetRelid
(
relation
));
scan
=
heap_beginscan
(
pg_trigger
,
0
,
SnapshotNow
,
1
,
&
entry
);
scan
=
heap_beginscan
(
pg_trigger
,
0
,
SnapshotNow
,
1
,
&
entry
);
triggertuple
=
heap_getnext
(
scan
,
0
);
triggertuple
=
heap_getnext
(
scan
,
0
);
while
(
HeapTupleIsValid
(
triggertuple
))
{
while
(
HeapTupleIsValid
(
triggertuple
))
{
...
@@ -784,11 +784,11 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
...
@@ -784,11 +784,11 @@ void CommentTrigger(char *trigger, char *relname, char *comment) {
}
}
/*** Create the comments with the pg_trigger oid ***/
/*** Create the comments with the pg_trigger oid ***/
CreateComments
(
oid
,
comment
);
CreateComments
(
oid
,
comment
);
/*** Complete the scan and close any opened relations ***/
/*** Complete the scan and close any opened relations ***/
heap_endscan
(
scan
);
heap_endscan
(
scan
);
heap_close
(
pg_trigger
,
AccessShareLock
);
heap_close
(
pg_trigger
,
AccessShareLock
);
heap_close
(
relation
,
AccessShareLock
);
heap_close
(
relation
,
AccessShareLock
);
...
...
src/backend/commands/indexcmds.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.1
6 1999/12/16 22:19:41 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.1
7 2000/01/10 17:14:32 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -414,7 +414,7 @@ FuncIndexArgs(IndexElem *funcIndex,
...
@@ -414,7 +414,7 @@ FuncIndexArgs(IndexElem *funcIndex,
}
}
*
opOidP
=
tuple
->
t_data
->
t_oid
;
*
opOidP
=
tuple
->
t_data
->
t_oid
;
MemSet
(
argTypes
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
argTypes
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
/*
/*
* process the function arguments
* process the function arguments
...
...
src/backend/commands/proclang.c
View file @
8a093d0a
...
@@ -50,7 +50,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
...
@@ -50,7 +50,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
HeapTuple
langTup
;
HeapTuple
langTup
;
HeapTuple
procTup
;
HeapTuple
procTup
;
Oid
typev
[
8
];
Oid
typev
[
FUNC_MAX_ARGS
];
char
nulls
[
Natts_pg_language
];
char
nulls
[
Natts_pg_language
];
Datum
values
[
Natts_pg_language
];
Datum
values
[
Natts_pg_language
];
Relation
rel
;
Relation
rel
;
...
@@ -136,7 +136,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
...
@@ -136,7 +136,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
CatalogIndexInsert
(
idescs
,
Num_pg_language_indices
,
rel
,
tup
);
CatalogIndexInsert
(
idescs
,
Num_pg_language_indices
,
rel
,
tup
);
CatalogCloseIndices
(
Num_pg_language_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_language_indices
,
idescs
);
}
}
heap_close
(
rel
,
RowExclusiveLock
);
heap_close
(
rel
,
RowExclusiveLock
);
}
}
...
...
src/backend/commands/remove.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.4
2 1999/12/16 22:19:41 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.4
3 2000/01/10 17:14:32 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -163,7 +163,7 @@ SingleOpOperatorRemove(Oid typeOid)
...
@@ -163,7 +163,7 @@ SingleOpOperatorRemove(Oid typeOid)
DeleteComments
(
tup
->
t_data
->
t_oid
);
DeleteComments
(
tup
->
t_data
->
t_oid
);
heap_delete
(
rel
,
&
tup
->
t_self
,
NULL
);
heap_delete
(
rel
,
&
tup
->
t_self
,
NULL
);
}
}
heap_endscan
(
scan
);
heap_endscan
(
scan
);
...
@@ -315,13 +315,13 @@ RemoveFunction(char *functionName, /* function name to be removed */
...
@@ -315,13 +315,13 @@ RemoveFunction(char *functionName, /* function name to be removed */
{
{
Relation
relation
;
Relation
relation
;
HeapTuple
tup
;
HeapTuple
tup
;
Oid
argList
[
8
];
Oid
argList
[
FUNC_MAX_ARGS
];
char
*
userName
;
char
*
userName
;
char
*
typename
;
char
*
typename
;
int
i
;
int
i
;
MemSet
(
argList
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
argList
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
for
(
i
=
0
;
i
<
nargs
;
i
++
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
{
{
typename
=
strVal
(
lfirst
(
argNameList
));
typename
=
strVal
(
lfirst
(
argNameList
));
...
@@ -444,7 +444,7 @@ RemoveAggregate(char *aggName, char *aggType)
...
@@ -444,7 +444,7 @@ RemoveAggregate(char *aggName, char *aggType)
aggName
);
aggName
);
}
}
}
}
/*** Remove any comments related to this aggregate ***/
/*** Remove any comments related to this aggregate ***/
DeleteComments
(
tup
->
t_data
->
t_oid
);
DeleteComments
(
tup
->
t_data
->
t_oid
);
...
...
src/backend/commands/trigger.c
View file @
8a093d0a
...
@@ -41,7 +41,7 @@ void
...
@@ -41,7 +41,7 @@ void
CreateTrigger
(
CreateTrigStmt
*
stmt
)
CreateTrigger
(
CreateTrigStmt
*
stmt
)
{
{
int16
tgtype
;
int16
tgtype
;
int16
tgattr
[
8
]
=
{
0
};
int16
tgattr
[
FUNC_MAX_ARGS
]
=
{
0
};
Datum
values
[
Natts_pg_trigger
];
Datum
values
[
Natts_pg_trigger
];
char
nulls
[
Natts_pg_trigger
];
char
nulls
[
Natts_pg_trigger
];
Relation
rel
;
Relation
rel
;
...
@@ -53,7 +53,7 @@ CreateTrigger(CreateTrigStmt *stmt)
...
@@ -53,7 +53,7 @@ CreateTrigger(CreateTrigStmt *stmt)
Relation
idescs
[
Num_pg_trigger_indices
];
Relation
idescs
[
Num_pg_trigger_indices
];
Relation
ridescs
[
Num_pg_class_indices
];
Relation
ridescs
[
Num_pg_class_indices
];
MemoryContext
oldcxt
;
MemoryContext
oldcxt
;
Oid
fargtypes
[
8
];
Oid
fargtypes
[
FUNC_MAX_ARGS
];
int
found
=
0
;
int
found
=
0
;
int
i
;
int
i
;
char
constrtrigname
[
NAMEDATALEN
];
char
constrtrigname
[
NAMEDATALEN
];
...
@@ -144,7 +144,7 @@ CreateTrigger(CreateTrigStmt *stmt)
...
@@ -144,7 +144,7 @@ CreateTrigger(CreateTrigStmt *stmt)
}
}
heap_endscan
(
tgscan
);
heap_endscan
(
tgscan
);
MemSet
(
fargtypes
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
fargtypes
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
tuple
=
SearchSysCacheTuple
(
PROCNAME
,
tuple
=
SearchSysCacheTuple
(
PROCNAME
,
PointerGetDatum
(
stmt
->
funcname
),
PointerGetDatum
(
stmt
->
funcname
),
Int32GetDatum
(
0
),
Int32GetDatum
(
0
),
...
@@ -306,7 +306,7 @@ DropTrigger(DropTrigStmt *stmt)
...
@@ -306,7 +306,7 @@ DropTrigger(DropTrigStmt *stmt)
heap_delete
(
tgrel
,
&
tuple
->
t_self
,
NULL
);
heap_delete
(
tgrel
,
&
tuple
->
t_self
,
NULL
);
tgfound
++
;
tgfound
++
;
}
}
else
else
found
++
;
found
++
;
...
@@ -368,7 +368,7 @@ RelationRemoveTriggers(Relation rel)
...
@@ -368,7 +368,7 @@ RelationRemoveTriggers(Relation rel)
/*** Delete any comments associated with this trigger ***/
/*** Delete any comments associated with this trigger ***/
DeleteComments
(
tup
->
t_data
->
t_oid
);
DeleteComments
(
tup
->
t_data
->
t_oid
);
heap_delete
(
tgrel
,
&
tup
->
t_self
,
NULL
);
heap_delete
(
tgrel
,
&
tup
->
t_self
,
NULL
);
}
}
...
@@ -473,7 +473,7 @@ RelationBuildTriggers(Relation relation)
...
@@ -473,7 +473,7 @@ RelationBuildTriggers(Relation relation)
build
->
tgdeferrable
=
pg_trigger
->
tgdeferrable
;
build
->
tgdeferrable
=
pg_trigger
->
tgdeferrable
;
build
->
tginitdeferred
=
pg_trigger
->
tginitdeferred
;
build
->
tginitdeferred
=
pg_trigger
->
tginitdeferred
;
build
->
tgnargs
=
pg_trigger
->
tgnargs
;
build
->
tgnargs
=
pg_trigger
->
tgnargs
;
memcpy
(
build
->
tgattr
,
&
(
pg_trigger
->
tgattr
),
8
*
sizeof
(
int16
));
memcpy
(
build
->
tgattr
,
&
(
pg_trigger
->
tgattr
),
FUNC_MAX_ARGS
*
sizeof
(
int16
));
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_trigger_tgargs
,
Anum_pg_trigger_tgargs
,
tgrel
->
rd_att
,
&
isnull
);
tgrel
->
rd_att
,
&
isnull
);
...
@@ -992,7 +992,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate)
...
@@ -992,7 +992,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate)
trigstate
=
(
DeferredTriggerStatus
)
trigstate
=
(
DeferredTriggerStatus
)
palloc
(
sizeof
(
DeferredTriggerStatusData
));
palloc
(
sizeof
(
DeferredTriggerStatusData
));
trigstate
->
dts_tgoid
=
tgoid
;
trigstate
->
dts_tgoid
=
tgoid
;
trigstate
->
dts_tgisdeferred
=
trigstate
->
dts_tgisdeferred
=
((
itemstate
&
TRIGGER_DEFERRED_INITDEFERRED
)
!=
0
);
((
itemstate
&
TRIGGER_DEFERRED_INITDEFERRED
)
!=
0
);
deftrig_trigstates
=
lappend
(
deftrig_trigstates
,
trigstate
);
deftrig_trigstates
=
lappend
(
deftrig_trigstates
,
trigstate
);
...
@@ -1008,7 +1008,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate)
...
@@ -1008,7 +1008,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate)
* Add a new trigger event to the queue.
* Add a new trigger event to the queue.
* ----------
* ----------
*/
*/
static
void
static
void
deferredTriggerAddEvent
(
DeferredTriggerEvent
event
)
deferredTriggerAddEvent
(
DeferredTriggerEvent
event
)
{
{
deftrig_events
=
lappend
(
deftrig_events
,
event
);
deftrig_events
=
lappend
(
deftrig_events
,
event
);
...
@@ -1040,14 +1040,14 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid)
...
@@ -1040,14 +1040,14 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid)
if
(
previous
->
dte_event
&
TRIGGER_DEFERRED_CANCELED
)
if
(
previous
->
dte_event
&
TRIGGER_DEFERRED_CANCELED
)
continue
;
continue
;
if
(
ItemPointerGetBlockNumber
(
ctid
)
==
if
(
ItemPointerGetBlockNumber
(
ctid
)
==
ItemPointerGetBlockNumber
(
&
(
previous
->
dte_newctid
))
&&
ItemPointerGetBlockNumber
(
&
(
previous
->
dte_newctid
))
&&
ItemPointerGetOffsetNumber
(
ctid
)
==
ItemPointerGetOffsetNumber
(
ctid
)
==
ItemPointerGetOffsetNumber
(
&
(
previous
->
dte_newctid
)))
ItemPointerGetOffsetNumber
(
&
(
previous
->
dte_newctid
)))
return
previous
;
return
previous
;
}
}
elog
(
ERROR
,
elog
(
ERROR
,
"deferredTriggerGetPreviousEvent(): event for tuple %s not found"
,
"deferredTriggerGetPreviousEvent(): event for tuple %s not found"
,
tidout
(
ctid
));
tidout
(
ctid
));
return
NULL
;
return
NULL
;
...
@@ -1107,26 +1107,26 @@ deferredTriggerExecute(DeferredTriggerEvent event, int itemno)
...
@@ -1107,26 +1107,26 @@ deferredTriggerExecute(DeferredTriggerEvent event, int itemno)
case
TRIGGER_EVENT_INSERT
:
case
TRIGGER_EVENT_INSERT
:
SaveTriggerData
.
tg_trigtuple
=
&
newtuple
;
SaveTriggerData
.
tg_trigtuple
=
&
newtuple
;
SaveTriggerData
.
tg_newtuple
=
NULL
;
SaveTriggerData
.
tg_newtuple
=
NULL
;
SaveTriggerData
.
tg_trigger
=
SaveTriggerData
.
tg_trigger
=
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_INSERT
][
itemno
];
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_INSERT
][
itemno
];
break
;
break
;
case
TRIGGER_EVENT_UPDATE
:
case
TRIGGER_EVENT_UPDATE
:
SaveTriggerData
.
tg_trigtuple
=
&
oldtuple
;
SaveTriggerData
.
tg_trigtuple
=
&
oldtuple
;
SaveTriggerData
.
tg_newtuple
=
&
newtuple
;
SaveTriggerData
.
tg_newtuple
=
&
newtuple
;
SaveTriggerData
.
tg_trigger
=
SaveTriggerData
.
tg_trigger
=
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_UPDATE
][
itemno
];
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_UPDATE
][
itemno
];
break
;
break
;
case
TRIGGER_EVENT_DELETE
:
case
TRIGGER_EVENT_DELETE
:
SaveTriggerData
.
tg_trigtuple
=
&
oldtuple
;
SaveTriggerData
.
tg_trigtuple
=
&
oldtuple
;
SaveTriggerData
.
tg_newtuple
=
NULL
;
SaveTriggerData
.
tg_newtuple
=
NULL
;
SaveTriggerData
.
tg_trigger
=
SaveTriggerData
.
tg_trigger
=
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_DELETE
][
itemno
];
rel
->
trigdesc
->
tg_after_row
[
TRIGGER_EVENT_DELETE
][
itemno
];
break
;
break
;
default:
default:
}
}
/* ----------
/* ----------
* Call the trigger and throw away an eventually returned
* Call the trigger and throw away an eventually returned
...
@@ -1195,10 +1195,10 @@ deferredTriggerInvokeEvents(bool immediate_only)
...
@@ -1195,10 +1195,10 @@ deferredTriggerInvokeEvents(bool immediate_only)
* ----------
* ----------
*/
*/
event
=
(
DeferredTriggerEvent
)
lfirst
(
el
);
event
=
(
DeferredTriggerEvent
)
lfirst
(
el
);
if
(
event
->
dte_event
&
(
TRIGGER_DEFERRED_DONE
|
if
(
event
->
dte_event
&
(
TRIGGER_DEFERRED_DONE
|
TRIGGER_DEFERRED_CANCELED
))
TRIGGER_DEFERRED_CANCELED
))
continue
;
continue
;
/* ----------
/* ----------
* Check each trigger item in the event.
* Check each trigger item in the event.
* ----------
* ----------
...
@@ -1215,7 +1215,7 @@ deferredTriggerInvokeEvents(bool immediate_only)
...
@@ -1215,7 +1215,7 @@ deferredTriggerInvokeEvents(bool immediate_only)
* ----------
* ----------
*/
*/
if
(
immediate_only
&&
deferredTriggerCheckState
(
if
(
immediate_only
&&
deferredTriggerCheckState
(
event
->
dte_item
[
i
].
dti_tgoid
,
event
->
dte_item
[
i
].
dti_tgoid
,
event
->
dte_item
[
i
].
dti_state
))
event
->
dte_item
[
i
].
dti_state
))
{
{
still_deferred_ones
=
true
;
still_deferred_ones
=
true
;
...
@@ -1273,7 +1273,7 @@ DeferredTriggerBeginXact(void)
...
@@ -1273,7 +1273,7 @@ DeferredTriggerBeginXact(void)
DeferredTriggerStatus
stat
;
DeferredTriggerStatus
stat
;
if
(
deftrig_cxt
!=
NULL
)
if
(
deftrig_cxt
!=
NULL
)
elog
(
FATAL
,
elog
(
FATAL
,
"DeferredTriggerBeginXact() called while inside transaction"
);
"DeferredTriggerBeginXact() called while inside transaction"
);
/* ----------
/* ----------
...
@@ -1286,12 +1286,12 @@ DeferredTriggerBeginXact(void)
...
@@ -1286,12 +1286,12 @@ DeferredTriggerBeginXact(void)
deftrig_all_isset
=
deftrig_dfl_all_isset
;
deftrig_all_isset
=
deftrig_dfl_all_isset
;
deftrig_all_isdeferred
=
deftrig_dfl_all_isdeferred
;
deftrig_all_isdeferred
=
deftrig_dfl_all_isdeferred
;
deftrig_trigstates
=
NIL
;
deftrig_trigstates
=
NIL
;
foreach
(
l
,
deftrig_dfl_trigstates
)
foreach
(
l
,
deftrig_dfl_trigstates
)
{
{
dflstat
=
(
DeferredTriggerStatus
)
lfirst
(
l
);
dflstat
=
(
DeferredTriggerStatus
)
lfirst
(
l
);
stat
=
(
DeferredTriggerStatus
)
stat
=
(
DeferredTriggerStatus
)
palloc
(
sizeof
(
DeferredTriggerStatusData
));
palloc
(
sizeof
(
DeferredTriggerStatusData
));
stat
->
dts_tgoid
=
dflstat
->
dts_tgoid
;
stat
->
dts_tgoid
=
dflstat
->
dts_tgoid
;
...
@@ -1530,7 +1530,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
...
@@ -1530,7 +1530,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
*/
*/
pg_trigger
=
(
Form_pg_trigger
)
GETSTRUCT
(
&
tuple
);
pg_trigger
=
(
Form_pg_trigger
)
GETSTRUCT
(
&
tuple
);
if
(
stmt
->
deferred
&
!
pg_trigger
->
tgdeferrable
)
if
(
stmt
->
deferred
&
!
pg_trigger
->
tgdeferrable
)
elog
(
ERROR
,
"Constraint '%s' is not deferrable"
,
elog
(
ERROR
,
"Constraint '%s' is not deferrable"
,
(
char
*
)
lfirst
(
l
));
(
char
*
)
lfirst
(
l
));
constr_oid
=
tuple
.
t_data
->
t_oid
;
constr_oid
=
tuple
.
t_data
->
t_oid
;
...
@@ -1582,7 +1582,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
...
@@ -1582,7 +1582,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
state
->
dts_tgoid
=
(
Oid
)
lfirst
(
l
);
state
->
dts_tgoid
=
(
Oid
)
lfirst
(
l
);
state
->
dts_tgisdeferred
=
stmt
->
deferred
;
state
->
dts_tgisdeferred
=
stmt
->
deferred
;
deftrig_dfl_trigstates
=
deftrig_dfl_trigstates
=
lappend
(
deftrig_dfl_trigstates
,
state
);
lappend
(
deftrig_dfl_trigstates
,
state
);
}
}
}
}
...
@@ -1618,7 +1618,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
...
@@ -1618,7 +1618,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
state
->
dts_tgoid
=
(
Oid
)
lfirst
(
l
);
state
->
dts_tgoid
=
(
Oid
)
lfirst
(
l
);
state
->
dts_tgisdeferred
=
stmt
->
deferred
;
state
->
dts_tgisdeferred
=
stmt
->
deferred
;
deftrig_trigstates
=
deftrig_trigstates
=
lappend
(
deftrig_trigstates
,
state
);
lappend
(
deftrig_trigstates
,
state
);
}
}
}
}
...
@@ -1652,7 +1652,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1652,7 +1652,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
TriggerData
SaveTriggerData
;
TriggerData
SaveTriggerData
;
if
(
deftrig_cxt
==
NULL
)
if
(
deftrig_cxt
==
NULL
)
elog
(
ERROR
,
elog
(
ERROR
,
"DeferredTriggerSaveEvent() called outside of transaction"
);
"DeferredTriggerSaveEvent() called outside of transaction"
);
/* ----------
/* ----------
...
@@ -1681,7 +1681,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1681,7 +1681,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
ItemPointerSetInvalid
(
&
(
newctid
));
ItemPointerSetInvalid
(
&
(
newctid
));
/* ----------
/* ----------
* Create a new event
* Create a new event
* ----------
* ----------
*/
*/
oldcxt
=
MemoryContextSwitchTo
((
MemoryContext
)
deftrig_cxt
);
oldcxt
=
MemoryContextSwitchTo
((
MemoryContext
)
deftrig_cxt
);
...
@@ -1691,7 +1691,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1691,7 +1691,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
new_size
=
sizeof
(
DeferredTriggerEventData
)
+
new_size
=
sizeof
(
DeferredTriggerEventData
)
+
ntriggers
*
sizeof
(
DeferredTriggerEventItem
);
ntriggers
*
sizeof
(
DeferredTriggerEventItem
);
new_event
=
(
DeferredTriggerEvent
)
palloc
(
new_size
);
new_event
=
(
DeferredTriggerEvent
)
palloc
(
new_size
);
new_event
->
dte_event
=
event
&
TRIGGER_EVENT_OPMASK
;
new_event
->
dte_event
=
event
&
TRIGGER_EVENT_OPMASK
;
new_event
->
dte_relid
=
rel
->
rd_id
;
new_event
->
dte_relid
=
rel
->
rd_id
;
...
@@ -1702,10 +1702,10 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1702,10 +1702,10 @@ DeferredTriggerSaveEvent(Relation rel, int event,
for
(
i
=
0
;
i
<
ntriggers
;
i
++
)
for
(
i
=
0
;
i
<
ntriggers
;
i
++
)
{
{
new_event
->
dte_item
[
i
].
dti_tgoid
=
triggers
[
i
]
->
tgoid
;
new_event
->
dte_item
[
i
].
dti_tgoid
=
triggers
[
i
]
->
tgoid
;
new_event
->
dte_item
[
i
].
dti_state
=
new_event
->
dte_item
[
i
].
dti_state
=
((
triggers
[
i
]
->
tgdeferrable
)
?
((
triggers
[
i
]
->
tgdeferrable
)
?
TRIGGER_DEFERRED_DEFERRABLE
:
0
)
|
TRIGGER_DEFERRED_DEFERRABLE
:
0
)
|
((
triggers
[
i
]
->
tginitdeferred
)
?
((
triggers
[
i
]
->
tginitdeferred
)
?
TRIGGER_DEFERRED_INITDEFERRED
:
0
)
|
TRIGGER_DEFERRED_INITDEFERRED
:
0
)
|
((
rel
->
trigdesc
->
n_before_row
[
event
]
>
0
)
?
((
rel
->
trigdesc
->
n_before_row
[
event
]
>
0
)
?
TRIGGER_DEFERRED_HAS_BEFORE
:
0
);
TRIGGER_DEFERRED_HAS_BEFORE
:
0
);
...
@@ -1729,7 +1729,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1729,7 +1729,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
if
(
oldtup
->
t_data
->
t_xmin
!=
GetCurrentTransactionId
())
if
(
oldtup
->
t_data
->
t_xmin
!=
GetCurrentTransactionId
())
prev_event
=
NULL
;
prev_event
=
NULL
;
else
else
prev_event
=
prev_event
=
deferredTriggerGetPreviousEvent
(
rel
->
rd_id
,
&
oldctid
);
deferredTriggerGetPreviousEvent
(
rel
->
rd_id
,
&
oldctid
);
/* ----------
/* ----------
...
@@ -1759,7 +1759,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1759,7 +1759,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
case
F_RI_FKEY_SETDEFAULT_UPD
:
case
F_RI_FKEY_SETDEFAULT_UPD
:
is_ri_trigger
=
true
;
is_ri_trigger
=
true
;
break
;
break
;
default:
default:
is_ri_trigger
=
false
;
is_ri_trigger
=
false
;
break
;
break
;
...
@@ -1776,7 +1776,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1776,7 +1776,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
CurrentTriggerData
=
&
SaveTriggerData
;
CurrentTriggerData
=
&
SaveTriggerData
;
key_unchanged
=
RI_FKey_keyequal_upd
();
key_unchanged
=
RI_FKey_keyequal_upd
();
CurrentTriggerData
=
NULL
;
CurrentTriggerData
=
NULL
;
if
(
key_unchanged
)
if
(
key_unchanged
)
{
{
/* ----------
/* ----------
...
@@ -1789,7 +1789,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1789,7 +1789,7 @@ DeferredTriggerSaveEvent(Relation rel, int event,
if
(
prev_event
)
if
(
prev_event
)
{
{
if
(
prev_event
->
dte_event
&
if
(
prev_event
->
dte_event
&
TRIGGER_DEFERRED_ROW_INSERTED
)
TRIGGER_DEFERRED_ROW_INSERTED
)
{
{
/* ----------
/* ----------
...
@@ -1797,9 +1797,9 @@ DeferredTriggerSaveEvent(Relation rel, int event,
...
@@ -1797,9 +1797,9 @@ DeferredTriggerSaveEvent(Relation rel, int event,
* So any key value is considered changed.
* So any key value is considered changed.
* ----------
* ----------
*/
*/
new_event
->
dte_event
|=
new_event
->
dte_event
|=
TRIGGER_DEFERRED_ROW_INSERTED
;
TRIGGER_DEFERRED_ROW_INSERTED
;
new_event
->
dte_event
|=
new_event
->
dte_event
|=
TRIGGER_DEFERRED_KEY_CHANGED
;
TRIGGER_DEFERRED_KEY_CHANGED
;
new_event
->
dte_item
[
i
].
dti_state
|=
new_event
->
dte_item
[
i
].
dti_state
|=
TRIGGER_DEFERRED_KEY_CHANGED
;
TRIGGER_DEFERRED_KEY_CHANGED
;
...
...
src/backend/executor/execQual.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.6
4 1999/11/12 06:39:34 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.6
5 2000/01/10 17:14:34 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -656,7 +656,7 @@ ExecMakeFunctionResult(Node *node,
...
@@ -656,7 +656,7 @@ ExecMakeFunctionResult(Node *node,
bool
*
isNull
,
bool
*
isNull
,
bool
*
isDone
)
bool
*
isDone
)
{
{
Datum
argV
[
MAXFMGR
ARGS
];
Datum
argV
[
FUNC_MAX_
ARGS
];
FunctionCachePtr
fcache
;
FunctionCachePtr
fcache
;
Func
*
funcNode
=
NULL
;
Func
*
funcNode
=
NULL
;
Oper
*
operNode
=
NULL
;
Oper
*
operNode
=
NULL
;
...
@@ -690,7 +690,7 @@ ExecMakeFunctionResult(Node *node,
...
@@ -690,7 +690,7 @@ ExecMakeFunctionResult(Node *node,
{
{
bool
argDone
;
bool
argDone
;
if
(
fcache
->
nargs
>
MAXFMGR
ARGS
)
if
(
fcache
->
nargs
>
FUNC_MAX_
ARGS
)
elog
(
ERROR
,
"ExecMakeFunctionResult: too many arguments"
);
elog
(
ERROR
,
"ExecMakeFunctionResult: too many arguments"
);
/*
/*
...
...
src/backend/libpq/be-pqexec.c
View file @
8a093d0a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.2
5 2000/01/05 18:23:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.2
6 2000/01/10 17:14:35
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -57,7 +57,7 @@ PQfn(int fnid,
...
@@ -57,7 +57,7 @@ PQfn(int fnid,
int
nargs
)
int
nargs
)
{
{
char
*
retval
;
/* XXX - should be datum, maybe ? */
char
*
retval
;
/* XXX - should be datum, maybe ? */
char
*
arg
[
8
];
char
*
arg
[
FUNC_MAX_ARGS
];
int
i
;
int
i
;
/* ----------------
/* ----------------
...
@@ -304,8 +304,8 @@ pqtest_PQfn(char *q)
...
@@ -304,8 +304,8 @@ pqtest_PQfn(char *q)
v
,
v
,
f
,
f
,
offsets
;
offsets
;
char
*
fields
[
8
];
char
*
fields
[
FUNC_MAX_ARGS
];
PQArgBlock
pqargs
[
7
];
PQArgBlock
pqargs
[
FUNC_MAX_ARGS
];
int
res
;
int
res
;
char
*
pqres
;
char
*
pqres
;
...
@@ -313,7 +313,7 @@ pqtest_PQfn(char *q)
...
@@ -313,7 +313,7 @@ pqtest_PQfn(char *q)
* parse q into fields
* parse q into fields
* ----------------
* ----------------
*/
*/
i
=
strparse
(
q
,
fields
,
&
offsets
,
8
);
i
=
strparse
(
q
,
fields
,
&
offsets
,
FUNC_MAX_ARGS
);
printf
(
"pqtest_PQfn: strparse returns %d fields
\n
"
,
i
);
/* debug */
printf
(
"pqtest_PQfn: strparse returns %d fields
\n
"
,
i
);
/* debug */
if
(
i
==
0
)
if
(
i
==
0
)
return
-
1
;
return
-
1
;
...
@@ -331,7 +331,7 @@ pqtest_PQfn(char *q)
...
@@ -331,7 +331,7 @@ pqtest_PQfn(char *q)
* build a PQArgBlock
* build a PQArgBlock
* ----------------
* ----------------
*/
*/
for
(
j
=
1
;
j
<
i
&&
j
<
8
;
j
++
)
for
(
j
=
1
;
j
<
i
&&
j
<
FUNC_MAX_ARGS
;
j
++
)
{
{
k
=
j
-
1
;
k
=
j
-
1
;
v
=
atoi
(
fields
[
j
]);
v
=
atoi
(
fields
[
j
]);
...
...
src/backend/parser/parse_coerce.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.2
6 1999/12/10 07:37:35 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.2
7 2000/01/10 17:14:36 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -142,7 +142,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
...
@@ -142,7 +142,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
HeapTuple
ftup
;
HeapTuple
ftup
;
int
i
;
int
i
;
Type
tp
;
Type
tp
;
Oid
oid_array
[
MAXF
ARGS
];
Oid
oid_array
[
FUNC_MAX_
ARGS
];
/* run through argument list... */
/* run through argument list... */
for
(
i
=
0
;
i
<
nargs
;
i
++
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
...
@@ -170,7 +170,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
...
@@ -170,7 +170,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
*/
*/
else
if
(
input_typeids
[
i
]
!=
UNKNOWNOID
)
else
if
(
input_typeids
[
i
]
!=
UNKNOWNOID
)
{
{
MemSet
(
oid_array
,
0
,
MAXF
ARGS
*
sizeof
(
Oid
));
MemSet
(
oid_array
,
0
,
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
oid_array
[
0
]
=
input_typeids
[
i
];
oid_array
[
0
]
=
input_typeids
[
i
];
/*
/*
...
...
src/backend/parser/parse_func.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.6
5 1999/12/16 22:19:48 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.6
6 2000/01/10 17:14:36 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -236,7 +236,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -236,7 +236,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
Oid
relid
;
Oid
relid
;
int
nargs
=
length
(
fargs
);
int
nargs
=
length
(
fargs
);
Func
*
funcnode
;
Func
*
funcnode
;
Oid
oid_array
[
MAXF
ARGS
];
Oid
oid_array
[
FUNC_MAX_
ARGS
];
Oid
*
true_oid_array
;
Oid
*
true_oid_array
;
Node
*
retval
;
Node
*
retval
;
bool
retset
;
bool
retset
;
...
@@ -435,7 +435,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -435,7 +435,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
* transform relation name arguments into varnodes of the appropriate
* transform relation name arguments into varnodes of the appropriate
* form.
* form.
*/
*/
MemSet
(
oid_array
,
0
,
MAXF
ARGS
*
sizeof
(
Oid
));
MemSet
(
oid_array
,
0
,
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
nargs
=
0
;
nargs
=
0
;
foreach
(
i
,
fargs
)
foreach
(
i
,
fargs
)
...
@@ -463,7 +463,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -463,7 +463,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
refname
);
refname
);
#endif
#endif
}
}
relname
=
rte
->
relname
;
relname
=
rte
->
relname
;
vnum
=
refnameRangeTablePosn
(
pstate
,
rte
->
refname
,
NULL
);
vnum
=
refnameRangeTablePosn
(
pstate
,
rte
->
refname
,
NULL
);
...
@@ -496,12 +496,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -496,12 +496,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
}
}
/* Most of the rest of the parser just assumes that functions do not
/* Most of the rest of the parser just assumes that functions do not
* have more than
MAXF
ARGS parameters. We have to test here to protect
* have more than
FUNC_MAX_
ARGS parameters. We have to test here to protect
* against array overruns, etc.
* against array overruns, etc.
*/
*/
if
(
nargs
>=
MAXF
ARGS
)
if
(
nargs
>=
FUNC_MAX_
ARGS
)
elog
(
ERROR
,
"Cannot pass more than %d arguments to a function"
,
elog
(
ERROR
,
"Cannot pass more than %d arguments to a function"
,
MAXF
ARGS
);
FUNC_MAX_
ARGS
);
oid_array
[
nargs
++
]
=
toid
;
oid_array
[
nargs
++
]
=
toid
;
}
}
...
@@ -710,8 +710,8 @@ func_get_candidates(char *funcname, int nargs)
...
@@ -710,8 +710,8 @@ func_get_candidates(char *funcname, int nargs)
current_candidate
=
(
CandidateList
)
current_candidate
=
(
CandidateList
)
palloc
(
sizeof
(
struct
_CandidateList
));
palloc
(
sizeof
(
struct
_CandidateList
));
current_candidate
->
args
=
(
Oid
*
)
current_candidate
->
args
=
(
Oid
*
)
palloc
(
MAXF
ARGS
*
sizeof
(
Oid
));
palloc
(
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
MemSet
(
current_candidate
->
args
,
0
,
MAXF
ARGS
*
sizeof
(
Oid
));
MemSet
(
current_candidate
->
args
,
0
,
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
for
(
i
=
0
;
i
<
nargs
;
i
++
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
current_candidate
->
args
[
i
]
=
pgProcP
->
proargtypes
[
i
];
current_candidate
->
args
[
i
]
=
pgProcP
->
proargtypes
[
i
];
...
@@ -1067,9 +1067,9 @@ argtype_inherit(int nargs, Oid *oid_array)
...
@@ -1067,9 +1067,9 @@ argtype_inherit(int nargs, Oid *oid_array)
{
{
Oid
relid
;
Oid
relid
;
int
i
;
int
i
;
InhPaths
arginh
[
MAXF
ARGS
];
InhPaths
arginh
[
FUNC_MAX_
ARGS
];
for
(
i
=
0
;
i
<
MAXF
ARGS
;
i
++
)
for
(
i
=
0
;
i
<
FUNC_MAX_
ARGS
;
i
++
)
{
{
if
(
i
<
nargs
)
if
(
i
<
nargs
)
{
{
...
@@ -1203,7 +1203,7 @@ gen_cross_product(InhPaths *arginh, int nargs)
...
@@ -1203,7 +1203,7 @@ gen_cross_product(InhPaths *arginh, int nargs)
Oid
*
oneres
;
Oid
*
oneres
;
int
i
,
int
i
,
j
;
j
;
int
cur
[
MAXF
ARGS
];
int
cur
[
FUNC_MAX_
ARGS
];
nanswers
=
1
;
nanswers
=
1
;
for
(
i
=
0
;
i
<
nargs
;
i
++
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
...
@@ -1217,8 +1217,8 @@ gen_cross_product(InhPaths *arginh, int nargs)
...
@@ -1217,8 +1217,8 @@ gen_cross_product(InhPaths *arginh, int nargs)
/* compute the cross product from right to left */
/* compute the cross product from right to left */
for
(;;)
for
(;;)
{
{
oneres
=
(
Oid
*
)
palloc
(
MAXF
ARGS
*
sizeof
(
Oid
));
oneres
=
(
Oid
*
)
palloc
(
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
MemSet
(
oneres
,
0
,
MAXF
ARGS
*
sizeof
(
Oid
));
MemSet
(
oneres
,
0
,
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
for
(
i
=
nargs
-
1
;
i
>=
0
&&
cur
[
i
]
>
arginh
[
i
].
nsupers
;
i
--
)
for
(
i
=
nargs
-
1
;
i
>=
0
&&
cur
[
i
]
>
arginh
[
i
].
nsupers
;
i
--
)
continue
;
continue
;
...
@@ -1508,7 +1508,7 @@ ParseComplexProjection(ParseState *pstate,
...
@@ -1508,7 +1508,7 @@ ParseComplexProjection(ParseState *pstate,
void
void
func_error
(
char
*
caller
,
char
*
funcname
,
int
nargs
,
Oid
*
argtypes
,
char
*
msg
)
func_error
(
char
*
caller
,
char
*
funcname
,
int
nargs
,
Oid
*
argtypes
,
char
*
msg
)
{
{
char
p
[(
NAMEDATALEN
+
2
)
*
MAXFMGR
ARGS
],
char
p
[(
NAMEDATALEN
+
2
)
*
FUNC_MAX_
ARGS
],
*
ptr
;
*
ptr
;
int
i
;
int
i
;
...
...
src/backend/parser/parse_target.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.5
0 1999/12/10 07:37:35 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.5
1 2000/01/10 17:14:36 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -318,14 +318,14 @@ SizeTargetExpr(ParseState *pstate,
...
@@ -318,14 +318,14 @@ SizeTargetExpr(ParseState *pstate,
int32
attrtypmod
)
int32
attrtypmod
)
{
{
char
*
funcname
;
char
*
funcname
;
Oid
oid_array
[
MAXF
ARGS
];
Oid
oid_array
[
FUNC_MAX_
ARGS
];
HeapTuple
ftup
;
HeapTuple
ftup
;
int
i
;
int
i
;
funcname
=
typeidTypeName
(
attrtype
);
funcname
=
typeidTypeName
(
attrtype
);
oid_array
[
0
]
=
attrtype
;
oid_array
[
0
]
=
attrtype
;
oid_array
[
1
]
=
INT4OID
;
oid_array
[
1
]
=
INT4OID
;
for
(
i
=
2
;
i
<
MAXF
ARGS
;
i
++
)
for
(
i
=
2
;
i
<
FUNC_MAX_
ARGS
;
i
++
)
oid_array
[
i
]
=
InvalidOid
;
oid_array
[
i
]
=
InvalidOid
;
/* attempt to find with arguments exactly as specified... */
/* attempt to find with arguments exactly as specified... */
...
...
src/backend/tcop/fastpath.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.3
2 2000/01/10 16:13:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.3
3 2000/01/10 17:14:37
momjian Exp $
*
*
* NOTES
* NOTES
* This cruft is the server side of PQfn.
* This cruft is the server side of PQfn.
...
@@ -116,7 +116,7 @@ SendFunctionResult(Oid fid, /* function id */
...
@@ -116,7 +116,7 @@ SendFunctionResult(Oid fid, /* function id */
/*
/*
* This structure saves enough state so that one can avoid having to
* This structure saves enough state so that one can avoid having to
* do catalog lookups over and over again. (Each RPC can require up
* do catalog lookups over and over again. (Each RPC can require up
* to
MAXFMGR
ARGS+2 lookups, which is quite tedious.)
* to
FUNC_MAX_
ARGS+2 lookups, which is quite tedious.)
*
*
* The previous incarnation of this code just assumed that any argument
* The previous incarnation of this code just assumed that any argument
* of size <= 4 was by value; this is not correct. There is no cheap
* of size <= 4 was by value; this is not correct. There is no cheap
...
@@ -127,8 +127,8 @@ struct fp_info
...
@@ -127,8 +127,8 @@ struct fp_info
{
{
Oid
funcid
;
Oid
funcid
;
int
nargs
;
int
nargs
;
bool
argbyval
[
MAXFMGR
ARGS
];
bool
argbyval
[
FUNC_MAX_
ARGS
];
int32
arglen
[
MAXFMGR
ARGS
];
/* signed (for varlena) */
int32
arglen
[
FUNC_MAX_
ARGS
];
/* signed (for varlena) */
bool
retbyval
;
bool
retbyval
;
int32
retlen
;
/* signed (for varlena) */
int32
retlen
;
/* signed (for varlena) */
TransactionId
xid
;
TransactionId
xid
;
...
@@ -278,7 +278,7 @@ HandleFunctionRequest()
...
@@ -278,7 +278,7 @@ HandleFunctionRequest()
int
argsize
;
int
argsize
;
int
nargs
;
int
nargs
;
int
tmp
;
int
tmp
;
char
*
arg
[
8
];
char
*
arg
[
FUNC_MAX_ARGS
];
char
*
retval
;
char
*
retval
;
int
i
;
int
i
;
uint32
palloced
;
uint32
palloced
;
...
@@ -317,7 +317,7 @@ HandleFunctionRequest()
...
@@ -317,7 +317,7 @@ HandleFunctionRequest()
* need to remember, so that we pfree() it after the call.
* need to remember, so that we pfree() it after the call.
*/
*/
palloced
=
0x0
;
palloced
=
0x0
;
for
(
i
=
0
;
i
<
8
;
++
i
)
for
(
i
=
0
;
i
<
FUNC_MAX_ARGS
;
++
i
)
{
{
if
(
i
>=
nargs
)
if
(
i
>=
nargs
)
arg
[
i
]
=
(
char
*
)
NULL
;
arg
[
i
]
=
(
char
*
)
NULL
;
...
...
src/backend/utils/adt/regproc.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.4
8 2000/01/10 16:13:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.4
9 2000/01/10 17:14:38
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -238,7 +238,6 @@ oidvectortypes(Oid *oidArray)
...
@@ -238,7 +238,6 @@ oidvectortypes(Oid *oidArray)
HeapTuple
typetup
;
HeapTuple
typetup
;
text
*
result
;
text
*
result
;
int
num
;
int
num
;
Oid
*
sp
;
if
(
oidArray
==
NULL
)
if
(
oidArray
==
NULL
)
{
{
...
@@ -247,16 +246,16 @@ oidvectortypes(Oid *oidArray)
...
@@ -247,16 +246,16 @@ oidvectortypes(Oid *oidArray)
return
result
;
return
result
;
}
}
result
=
(
text
*
)
palloc
(
NAMEDATALEN
*
8
+
8
+
VARHDRSZ
);
result
=
(
text
*
)
palloc
(
NAMEDATALEN
*
FUNC_MAX_ARGS
+
FUNC_MAX_ARGS
+
VARHDRSZ
);
*
VARDATA
(
result
)
=
'\0'
;
*
VARDATA
(
result
)
=
'\0'
;
sp
=
oidArray
;
for
(
num
=
0
;
num
<
FUNC_MAX_ARGS
;
num
++
)
for
(
num
=
8
;
num
!=
0
;
num
--
,
sp
++
)
{
{
if
(
*
sp
!=
InvalidOid
)
if
(
oidArray
[
num
]
!=
InvalidOid
)
{
{
typetup
=
SearchSysCacheTuple
(
TYPEOID
,
typetup
=
SearchSysCacheTuple
(
TYPEOID
,
ObjectIdGetDatum
(
*
sp
),
ObjectIdGetDatum
(
oidArray
[
num
]
),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
HeapTupleIsValid
(
typetup
))
if
(
HeapTupleIsValid
(
typetup
))
{
{
...
...
src/backend/utils/adt/selfuncs.c
View file @
8a093d0a
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.4
5 2000/01/09 00:26:20 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.4
6 2000/01/10 17:14:38 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -253,7 +253,7 @@ intltsel(Oid opid,
...
@@ -253,7 +253,7 @@ intltsel(Oid opid,
rtype
=
((
Form_pg_operator
)
GETSTRUCT
(
oprtuple
))
->
oprright
;
rtype
=
((
Form_pg_operator
)
GETSTRUCT
(
oprtuple
))
->
oprright
;
/* Convert the constant to a uniform comparison scale. */
/* Convert the constant to a uniform comparison scale. */
if
(
!
convert_to_scale
(
value
,
if
(
!
convert_to_scale
(
value
,
((
flag
&
SEL_RIGHT
)
?
rtype
:
ltype
),
((
flag
&
SEL_RIGHT
)
?
rtype
:
ltype
),
&
val
))
&
val
))
{
{
...
@@ -310,7 +310,7 @@ intltsel(Oid opid,
...
@@ -310,7 +310,7 @@ intltsel(Oid opid,
* stats are out of date and return a default...
* stats are out of date and return a default...
*/
*/
*
result
=
DEFAULT_INEQ_SEL
;
*
result
=
DEFAULT_INEQ_SEL
;
}
}
else
if
(
val
<=
low
||
val
>=
high
)
else
if
(
val
<=
low
||
val
>=
high
)
{
{
/* If given value is outside the statistical range, return a
/* If given value is outside the statistical range, return a
...
@@ -512,10 +512,10 @@ convert_to_scale(Datum value, Oid typid,
...
@@ -512,10 +512,10 @@ convert_to_scale(Datum value, Oid typid,
/* See whether there is a registered type-conversion function,
/* See whether there is a registered type-conversion function,
* namely a procedure named "float8" with the right signature.
* namely a procedure named "float8" with the right signature.
*/
*/
Oid
oid_array
[
MAXF
ARGS
];
Oid
oid_array
[
FUNC_MAX_
ARGS
];
HeapTuple
ftup
;
HeapTuple
ftup
;
MemSet
(
oid_array
,
0
,
MAXF
ARGS
*
sizeof
(
Oid
));
MemSet
(
oid_array
,
0
,
FUNC_MAX_
ARGS
*
sizeof
(
Oid
));
oid_array
[
0
]
=
typid
;
oid_array
[
0
]
=
typid
;
ftup
=
SearchSysCacheTuple
(
PROCNAME
,
ftup
=
SearchSysCacheTuple
(
PROCNAME
,
PointerGetDatum
(
"float8"
),
PointerGetDatum
(
"float8"
),
...
...
src/backend/utils/fmgr/fmgr.c
View file @
8a093d0a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.3
3 1999/11/22 17:56:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.3
4 2000/01/10 17:14:39
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -44,9 +44,9 @@ fmgr_pl(char *arg0,...)
...
@@ -44,9 +44,9 @@ fmgr_pl(char *arg0,...)
values
.
data
[
0
]
=
arg0
;
values
.
data
[
0
]
=
arg0
;
if
(
n_arguments
>
1
)
if
(
n_arguments
>
1
)
{
{
if
(
n_arguments
>
MAXFMGR
ARGS
)
if
(
n_arguments
>
FUNC_MAX_
ARGS
)
elog
(
ERROR
,
"fmgr_pl: function %u: too many arguments (%d > %d)"
,
elog
(
ERROR
,
"fmgr_pl: function %u: too many arguments (%d > %d)"
,
fmgr_pl_finfo
->
fn_oid
,
n_arguments
,
MAXFMGR
ARGS
);
fmgr_pl_finfo
->
fn_oid
,
n_arguments
,
FUNC_MAX_
ARGS
);
va_start
(
pvar
,
arg0
);
va_start
(
pvar
,
arg0
);
for
(
i
=
1
;
i
<
n_arguments
;
i
++
)
for
(
i
=
1
;
i
<
n_arguments
;
i
++
)
values
.
data
[
i
]
=
va_arg
(
pvar
,
char
*
);
values
.
data
[
i
]
=
va_arg
(
pvar
,
char
*
);
...
@@ -165,22 +165,93 @@ fmgr_c(FmgrInfo *finfo,
...
@@ -165,22 +165,93 @@ fmgr_c(FmgrInfo *finfo,
values
->
data
[
6
],
values
->
data
[
7
]);
values
->
data
[
6
],
values
->
data
[
7
]);
break
;
break
;
case
9
:
case
9
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
]);
break
;
case
10
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
]);
break
;
case
11
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
]);
break
;
case
12
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
]);
break
;
case
13
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
],
values
->
data
[
12
]);
break
;
case
14
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
],
values
->
data
[
12
],
values
->
data
[
13
]);
break
;
case
15
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
],
values
->
data
[
12
],
values
->
data
[
13
],
values
->
data
[
14
]);
break
;
case
16
:
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
],
values
->
data
[
12
],
values
->
data
[
13
],
values
->
data
[
14
],
values
->
data
[
15
]);
break
;
case
17
:
/*
/*
* XXX Note that functions with >
8
arguments can only be
* XXX Note that functions with >
FUNC_MAX_ARGS
arguments can only be
* called from inside the system, not from the user level,
* called from inside the system, not from the user level,
* since the catalogs only store
8
argument types for user
* since the catalogs only store
FUNC_MAX_ARGS
argument types for user
* type-checking!
* type-checking!
*/
*/
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
returnValue
=
(
*
user_fn
)
(
values
->
data
[
0
],
values
->
data
[
1
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
2
],
values
->
data
[
3
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
4
],
values
->
data
[
5
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
6
],
values
->
data
[
7
],
values
->
data
[
8
]);
values
->
data
[
8
],
values
->
data
[
9
],
values
->
data
[
10
],
values
->
data
[
11
],
values
->
data
[
12
],
values
->
data
[
13
],
values
->
data
[
14
],
values
->
data
[
15
]);
break
;
break
;
default:
default:
elog
(
ERROR
,
"fmgr_c: function %u: too many arguments (%d > %d)"
,
elog
(
ERROR
,
"fmgr_c: function %u: too many arguments (%d > %d)"
,
finfo
->
fn_oid
,
n_arguments
,
MAXFMGR
ARGS
);
finfo
->
fn_oid
,
n_arguments
,
FUNC_MAX_
ARGS
);
break
;
break
;
}
}
return
returnValue
;
return
returnValue
;
...
@@ -323,9 +394,9 @@ fmgr(Oid procedureId,...)
...
@@ -323,9 +394,9 @@ fmgr(Oid procedureId,...)
fmgr_info
(
procedureId
,
&
finfo
);
fmgr_info
(
procedureId
,
&
finfo
);
pronargs
=
finfo
.
fn_nargs
;
pronargs
=
finfo
.
fn_nargs
;
if
(
pronargs
>
MAXFMGR
ARGS
)
if
(
pronargs
>
FUNC_MAX_
ARGS
)
elog
(
ERROR
,
"fmgr: function %u: too many arguments (%d > %d)"
,
elog
(
ERROR
,
"fmgr: function %u: too many arguments (%d > %d)"
,
procedureId
,
pronargs
,
MAXFMGR
ARGS
);
procedureId
,
pronargs
,
FUNC_MAX_
ARGS
);
va_start
(
pvar
,
procedureId
);
va_start
(
pvar
,
procedureId
);
for
(
i
=
0
;
i
<
pronargs
;
++
i
)
for
(
i
=
0
;
i
<
pronargs
;
++
i
)
...
@@ -364,10 +435,10 @@ fmgr_ptr(FmgrInfo *finfo,...)
...
@@ -364,10 +435,10 @@ fmgr_ptr(FmgrInfo *finfo,...)
va_start
(
pvar
,
finfo
);
va_start
(
pvar
,
finfo
);
n_arguments
=
va_arg
(
pvar
,
int
);
n_arguments
=
va_arg
(
pvar
,
int
);
local_finfo
->
fn_nargs
=
n_arguments
;
local_finfo
->
fn_nargs
=
n_arguments
;
if
(
n_arguments
>
MAXFMGR
ARGS
)
if
(
n_arguments
>
FUNC_MAX_
ARGS
)
{
{
elog
(
ERROR
,
"fmgr_ptr: function %u: too many arguments (%d > %d)"
,
elog
(
ERROR
,
"fmgr_ptr: function %u: too many arguments (%d > %d)"
,
func_id
,
n_arguments
,
MAXFMGR
ARGS
);
func_id
,
n_arguments
,
FUNC_MAX_
ARGS
);
}
}
for
(
i
=
0
;
i
<
n_arguments
;
++
i
)
for
(
i
=
0
;
i
<
n_arguments
;
++
i
)
values
.
data
[
i
]
=
va_arg
(
pvar
,
char
*
);
values
.
data
[
i
]
=
va_arg
(
pvar
,
char
*
);
...
...
src/bin/pg_dump/pg_dump.c
View file @
8a093d0a
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.13
0 2000/01/10 16:13:16
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.13
1 2000/01/10 17:14:40
momjian Exp $
*
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
*
...
@@ -129,7 +129,7 @@ usage(const char *progname)
...
@@ -129,7 +129,7 @@ usage(const char *progname)
#ifdef HAVE_GETOPT_LONG
#ifdef HAVE_GETOPT_LONG
fprintf
(
stderr
,
fprintf
(
stderr
,
" -a, --data-only dump out only the data, no schema
\n
"
" -a, --data-only dump out only the data, no schema
\n
"
" -c, --clean clean(drop) schema prior to create
\n
"
" -c, --clean clean(drop) schema prior to create
\n
"
" -d, --insert-proper dump data as proper insert strings
\n
"
" -d, --insert-proper dump data as proper insert strings
\n
"
...
@@ -146,11 +146,11 @@ usage(const char *progname)
...
@@ -146,11 +146,11 @@ usage(const char *progname)
" -v, --verbose verbose
\n
"
" -v, --verbose verbose
\n
"
" -x, --no-acl do not dump ACL's (grant/revoke)
\n
"
" -x, --no-acl do not dump ACL's (grant/revoke)
\n
"
" -?, --help show this help message
\n
"
" -?, --help show this help message
\n
"
);
/* fprintf */
);
/* fprintf */
#else
#else
fprintf
(
stderr
,
fprintf
(
stderr
,
" -a dump out only the data, no schema
\n
"
" -a dump out only the data, no schema
\n
"
" -c clean(drop) schema prior to create
\n
"
" -c clean(drop) schema prior to create
\n
"
" -d dump data as proper insert strings
\n
"
" -d dump data as proper insert strings
\n
"
...
@@ -167,10 +167,10 @@ usage(const char *progname)
...
@@ -167,10 +167,10 @@ usage(const char *progname)
" -v verbose
\n
"
" -v verbose
\n
"
" -x do not dump ACL's (grant/revoke)
\n
"
" -x do not dump ACL's (grant/revoke)
\n
"
" -? show this help message
\n
"
" -? show this help message
\n
"
);
/* fprintf */
);
/* fprintf */
#endif
#endif
fprintf
(
stderr
,
fprintf
(
stderr
,
"
\n
If dbname is not supplied, then the DATABASE environment variable value is used.
\n\n
"
);
"
\n
If dbname is not supplied, then the DATABASE environment variable value is used.
\n\n
"
);
...
@@ -566,7 +566,7 @@ main(int argc, char **argv)
...
@@ -566,7 +566,7 @@ main(int argc, char **argv)
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
{
"no-acl"
,
no_argument
,
NULL
,
'x'
},
{
"no-acl"
,
no_argument
,
NULL
,
'x'
},
{
"help"
,
no_argument
,
NULL
,
'?'
},
{
"help"
,
no_argument
,
NULL
,
'?'
},
};
};
int
optindex
;
int
optindex
;
#endif
#endif
...
@@ -667,7 +667,7 @@ main(int argc, char **argv)
...
@@ -667,7 +667,7 @@ main(int argc, char **argv)
"%s: The -z option(dump ACLs) is now the default, continuing.
\n
"
,
"%s: The -z option(dump ACLs) is now the default, continuing.
\n
"
,
progname
);
progname
);
break
;
break
;
case
'?'
:
case
'?'
:
default:
default:
usage
(
progname
);
usage
(
progname
);
break
;
break
;
...
@@ -681,7 +681,7 @@ main(int argc, char **argv)
...
@@ -681,7 +681,7 @@ main(int argc, char **argv)
progname
);
progname
);
exit
(
2
);
exit
(
2
);
}
}
/* open the output file */
/* open the output file */
if
(
filename
==
NULL
)
if
(
filename
==
NULL
)
g_fout
=
stdout
;
g_fout
=
stdout
;
...
@@ -1069,7 +1069,7 @@ clearFuncInfo(FuncInfo *fun, int numFuncs)
...
@@ -1069,7 +1069,7 @@ clearFuncInfo(FuncInfo *fun, int numFuncs)
free
(
fun
[
i
].
proname
);
free
(
fun
[
i
].
proname
);
if
(
fun
[
i
].
usename
)
if
(
fun
[
i
].
usename
)
free
(
fun
[
i
].
usename
);
free
(
fun
[
i
].
usename
);
for
(
a
=
0
;
a
<
8
;
++
a
)
for
(
a
=
0
;
a
<
FUNC_MAX_ARGS
;
++
a
)
if
(
fun
[
i
].
argtypes
[
a
])
if
(
fun
[
i
].
argtypes
[
a
])
free
(
fun
[
i
].
argtypes
[
a
]);
free
(
fun
[
i
].
argtypes
[
a
]);
if
(
fun
[
i
].
prorettype
)
if
(
fun
[
i
].
prorettype
)
...
@@ -1122,8 +1122,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
...
@@ -1122,8 +1122,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
free
(
tblinfo
[
i
].
typnames
);
free
(
tblinfo
[
i
].
typnames
);
if
(
tblinfo
[
i
].
notnull
)
if
(
tblinfo
[
i
].
notnull
)
free
(
tblinfo
[
i
].
notnull
);
free
(
tblinfo
[
i
].
notnull
);
if
(
tblinfo
[
i
].
primary_key
)
if
(
tblinfo
[
i
].
primary_key
)
free
(
tblinfo
[
i
].
primary_key
);
free
(
tblinfo
[
i
].
primary_key
);
}
}
free
(
tblinfo
);
free
(
tblinfo
);
}
}
...
@@ -1611,48 +1611,48 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
...
@@ -1611,48 +1611,48 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else
else
tblinfo
[
i
].
check_expr
=
NULL
;
tblinfo
[
i
].
check_expr
=
NULL
;
/* Get primary key */
/* Get primary key */
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
i_relhasindex
),
"t"
)
==
0
)
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
i_relhasindex
),
"t"
)
==
0
)
{
{
PGresult
*
res2
;
PGresult
*
res2
;
char
str
[
INDEX_MAX_KEYS
*
NAMEDATALEN
+
3
]
=
""
;
char
str
[
INDEX_MAX_KEYS
*
NAMEDATALEN
+
3
]
=
""
;
int
j
;
int
j
;
resetPQExpBuffer
(
query
);
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
appendPQExpBuffer
(
query
,
"SELECT a.attname "
"SELECT a.attname "
"FROM pg_index i, pg_class c, pg_attribute a "
"FROM pg_index i, pg_class c, pg_attribute a "
"WHERE i.indisprimary AND i.indrelid = %s "
"WHERE i.indisprimary AND i.indrelid = %s "
" AND i.indexrelid = c.oid AND a.attnum > 0 AND a.attrelid = c.oid "
" AND i.indexrelid = c.oid AND a.attnum > 0 AND a.attrelid = c.oid "
"ORDER BY a.attnum "
,
"ORDER BY a.attnum "
,
tblinfo
[
i
].
oid
);
tblinfo
[
i
].
oid
);
res2
=
PQexec
(
g_conn
,
query
->
data
);
res2
=
PQexec
(
g_conn
,
query
->
data
);
if
(
!
res2
||
PQresultStatus
(
res2
)
!=
PGRES_TUPLES_OK
)
if
(
!
res2
||
PQresultStatus
(
res2
)
!=
PGRES_TUPLES_OK
)
{
{
fprintf
(
stderr
,
"getTables(): SELECT (for PRIMARY KEY) failed. Explanation from backend: %s"
,
fprintf
(
stderr
,
"getTables(): SELECT (for PRIMARY KEY) failed. Explanation from backend: %s"
,
PQerrorMessage
(
g_conn
));
PQerrorMessage
(
g_conn
));
exit_nicely
(
g_conn
);
exit_nicely
(
g_conn
);
}
}
for
(
j
=
0
;
j
<
PQntuples
(
res2
);
j
++
)
for
(
j
=
0
;
j
<
PQntuples
(
res2
);
j
++
)
{
{
if
(
strlen
(
str
)
>
0
)
if
(
strlen
(
str
)
>
0
)
strcat
(
str
,
", "
);
strcat
(
str
,
", "
);
strcat
(
str
,
fmtId
(
PQgetvalue
(
res2
,
j
,
0
),
force_quotes
));
strcat
(
str
,
fmtId
(
PQgetvalue
(
res2
,
j
,
0
),
force_quotes
));
}
}
if
(
strlen
(
str
)
>
0
)
{
if
(
strlen
(
str
)
>
0
)
{
tblinfo
[
i
].
primary_key
=
strdup
(
str
);
tblinfo
[
i
].
primary_key
=
strdup
(
str
);
if
(
tblinfo
[
i
].
primary_key
==
NULL
)
{
if
(
tblinfo
[
i
].
primary_key
==
NULL
)
{
perror
(
"strdup"
);
perror
(
"strdup"
);
exit
(
1
);
exit
(
1
);
}
}
}
}
else
else
tblinfo
[
i
].
primary_key
=
NULL
;
tblinfo
[
i
].
primary_key
=
NULL
;
}
}
else
else
tblinfo
[
i
].
primary_key
=
NULL
;
tblinfo
[
i
].
primary_key
=
NULL
;
/* Get Triggers */
/* Get Triggers */
if
(
tblinfo
[
i
].
ntrig
>
0
)
if
(
tblinfo
[
i
].
ntrig
>
0
)
...
@@ -2022,7 +2022,7 @@ getIndices(int *numIndices)
...
@@ -2022,7 +2022,7 @@ getIndices(int *numIndices)
*/
*/
appendPQExpBuffer
(
query
,
appendPQExpBuffer
(
query
,
"SELECT t1.relname as indexrelname, t2.relname as indrelname, "
"SELECT t1.relname as indexrelname, t2.relname as indrelname, "
"i.indproc, i.indkey, i.indclass, "
"i.indproc, i.indkey, i.indclass, "
"a.amname as indamname, i.indisunique "
"a.amname as indamname, i.indisunique "
"from pg_index i, pg_class t1, pg_class t2, pg_am a "
"from pg_index i, pg_class t1, pg_class t2, pg_am a "
...
@@ -2849,14 +2849,14 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
...
@@ -2849,14 +2849,14 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
tblinfo
[
i
].
check_expr
[
k
]);
tblinfo
[
i
].
check_expr
[
k
]);
}
}
/* PRIMARY KEY */
/* PRIMARY KEY */
if
(
tblinfo
[
i
].
primary_key
)
{
if
(
tblinfo
[
i
].
primary_key
)
{
if
(
actual_atts
+
tblinfo
[
i
].
ncheck
>
0
)
if
(
actual_atts
+
tblinfo
[
i
].
ncheck
>
0
)
appendPQExpBuffer
(
q
,
",
\n\t
"
);
appendPQExpBuffer
(
q
,
",
\n\t
"
);
appendPQExpBuffer
(
q
,
"PRIMARY KEY (%s)"
,
tblinfo
[
i
].
primary_key
);
appendPQExpBuffer
(
q
,
"PRIMARY KEY (%s)"
,
tblinfo
[
i
].
primary_key
);
}
}
appendPQExpBuffer
(
q
,
"
\n
)"
);
appendPQExpBuffer
(
q
,
"
\n
)"
);
if
(
numParents
>
0
)
if
(
numParents
>
0
)
{
{
...
...
src/bin/pg_dump/pg_dump.h
View file @
8a093d0a
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pg_dump.h,v 1.4
3 1999/12/27 15:42:44
momjian Exp $
* $Id: pg_dump.h,v 1.4
4 2000/01/10 17:14:40
momjian Exp $
*
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
*
...
@@ -61,7 +61,7 @@ typedef struct _funcInfo
...
@@ -61,7 +61,7 @@ typedef struct _funcInfo
char
*
proowner
;
char
*
proowner
;
int
lang
;
int
lang
;
int
nargs
;
int
nargs
;
char
*
argtypes
[
8
];
/* should be derived from obj/fmgr.h
char
*
argtypes
[
FUNC_MAX_ARGS
];
/* should be derived from obj/fmgr.h
* instead of hardwired */
* instead of hardwired */
char
*
prorettype
;
char
*
prorettype
;
int
retset
;
/* 1 if the function returns a set, 0
int
retset
;
/* 1 if the function returns a set, 0
...
...
src/include/access/funcindex.h
View file @
8a093d0a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: funcindex.h,v 1.
7 1999/02/13 23:20:50
momjian Exp $
* $Id: funcindex.h,v 1.
8 2000/01/10 17:14:42
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
typedef
struct
typedef
struct
{
{
int
nargs
;
int
nargs
;
Oid
arglist
[
8
];
Oid
arglist
[
FUNC_MAX_ARGS
];
Oid
procOid
;
Oid
procOid
;
NameData
funcName
;
NameData
funcName
;
}
FuncIndexInfo
;
}
FuncIndexInfo
;
...
...
src/include/config.h.in
View file @
8a093d0a
...
@@ -93,9 +93,11 @@
...
@@ -93,9 +93,11 @@
#define INDEXSCAN_PATCH
#define INDEXSCAN_PATCH
/*
/*
* Maximum number of columns in an index.
* Maximum number of columns in an index and maximum number of args
* to a function. They must be the same value.
*/
*/
#define INDEX_MAX_KEYS 8
#define INDEX_MAX_KEYS 8
#define FUNC_MAX_ARGS INDEX_MAX_KEYS
/*
/*
* Enables debugging print statements in the date/time support routines.
* Enables debugging print statements in the date/time support routines.
...
...
src/include/parser/parse_func.h
View file @
8a093d0a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: parse_func.h,v 1.2
0 1999/12/10 07:37:33 tgl
Exp $
* $Id: parse_func.h,v 1.2
1 2000/01/10 17:14:43 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -15,9 +15,6 @@
...
@@ -15,9 +15,6 @@
#include "parser/parse_node.h"
#include "parser/parse_node.h"
#define MAXFARGS 8
/* max # args to a c or postquel function */
/*
/*
* This structure is used to explore the inheritance hierarchy above
* This structure is used to explore the inheritance hierarchy above
* nodes in the type tree in order to disambiguate among polymorphic
* nodes in the type tree in order to disambiguate among polymorphic
...
...
src/include/utils/rel.h
View file @
8a093d0a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: rel.h,v 1.3
0 1999/11/16 04:14:03
momjian Exp $
* $Id: rel.h,v 1.3
1 2000/01/10 17:14:44
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -51,7 +51,7 @@ typedef struct Trigger
...
@@ -51,7 +51,7 @@ typedef struct Trigger
bool
tgdeferrable
;
bool
tgdeferrable
;
bool
tginitdeferred
;
bool
tginitdeferred
;
int16
tgnargs
;
int16
tgnargs
;
int16
tgattr
[
8
];
int16
tgattr
[
FUNC_MAX_ARGS
];
char
**
tgargs
;
char
**
tgargs
;
}
Trigger
;
}
Trigger
;
...
...
src/pl/plpgsql/src/pl_comp.c
View file @
8a093d0a
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* procedural language
* procedural language
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.1
4 1999/12/20 01:41:32 tgl
Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.1
5 2000/01/10 17:14:45 momjian
Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -114,7 +114,7 @@ plpgsql_compile(Oid fn_oid, int functype)
...
@@ -114,7 +114,7 @@ plpgsql_compile(Oid fn_oid, int functype)
PLpgSQL_row
*
row
;
PLpgSQL_row
*
row
;
PLpgSQL_rec
*
rec
;
PLpgSQL_rec
*
rec
;
int
i
;
int
i
;
int
arg_varnos
[
MAXFMGR
ARGS
];
int
arg_varnos
[
FUNC_MAX_
ARGS
];
/* ----------
/* ----------
* Initialize the compiler
* Initialize the compiler
...
...
src/pl/plpgsql/src/plpgsql.h
View file @
8a093d0a
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* procedural language
* procedural language
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.
4 1999/07/17 20:18:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.
5 2000/01/10 17:14:45
momjian Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -377,7 +377,7 @@ typedef struct PLpgSQL_function
...
@@ -377,7 +377,7 @@ typedef struct PLpgSQL_function
bool
fn_retset
;
bool
fn_retset
;
int
fn_nargs
;
int
fn_nargs
;
int
fn_argvarnos
[
MAXFMGR
ARGS
];
int
fn_argvarnos
[
FUNC_MAX_
ARGS
];
int
found_varno
;
int
found_varno
;
int
new_varno
;
int
new_varno
;
int
old_varno
;
int
old_varno
;
...
...
src/pl/tcl/pltcl.c
View file @
8a093d0a
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* procedural language (PL)
* procedural language (PL)
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.1
6 2000/01/05 18:23:54
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.1
7 2000/01/10 17:14:46
momjian Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -67,10 +67,10 @@ typedef struct pltcl_proc_desc
...
@@ -67,10 +67,10 @@ typedef struct pltcl_proc_desc
Oid
result_in_elem
;
Oid
result_in_elem
;
int
result_in_len
;
int
result_in_len
;
int
nargs
;
int
nargs
;
FmgrInfo
arg_out_func
[
MAXFMGR
ARGS
];
FmgrInfo
arg_out_func
[
FUNC_MAX_
ARGS
];
Oid
arg_out_elem
[
MAXFMGR
ARGS
];
Oid
arg_out_elem
[
FUNC_MAX_
ARGS
];
int
arg_out_len
[
MAXFMGR
ARGS
];
int
arg_out_len
[
FUNC_MAX_
ARGS
];
int
arg_is_rel
[
MAXFMGR
ARGS
];
int
arg_is_rel
[
FUNC_MAX_
ARGS
];
}
pltcl_proc_desc
;
}
pltcl_proc_desc
;
...
...
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