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
481487b9
Commit
481487b9
authored
Aug 24, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetAttributeByName and GetAttributeByNum should be declared to return
Datum, not char*, for portability's sake.
parent
d9eb7d8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+11
-14
src/include/executor/executor.h
src/include/executor/executor.h
+4
-4
src/test/regress/regress.c
src/test/regress/regress.c
+3
-3
No files found.
src/backend/executor/execQual.c
View file @
481487b9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.
79 2000/08/24 03:29:03
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.
80 2000/08/24 23:34:09
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -502,13 +502,8 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
* named attribute out of the tuple from the arg slot. User defined
* C functions which take a tuple as an argument are expected
* to use this. Ex: overpaid(EMP) might call GetAttributeByNum().
*
* XXX these two functions are misdeclared: they should be declared to
* return Datum. They are not used anywhere in the backend proper, and
* exist only for use by user-defined functions. Should we change their
* definitions, at risk of breaking user code?
*/
char
*
Datum
GetAttributeByNum
(
TupleTableSlot
*
slot
,
AttrNumber
attrno
,
bool
*
isNull
)
...
...
@@ -527,7 +522,7 @@ GetAttributeByNum(TupleTableSlot *slot,
if
(
TupIsNull
(
slot
))
{
*
isNull
=
true
;
return
(
char
*
)
NULL
;
return
(
Datum
)
0
;
}
retval
=
heap_getattr
(
slot
->
val
,
...
...
@@ -535,11 +530,12 @@ GetAttributeByNum(TupleTableSlot *slot,
slot
->
ttc_tupleDescriptor
,
isNull
);
if
(
*
isNull
)
return
(
char
*
)
NULL
;
return
(
char
*
)
retval
;
return
(
Datum
)
0
;
return
retval
;
}
char
*
Datum
GetAttributeByName
(
TupleTableSlot
*
slot
,
char
*
attname
,
bool
*
isNull
)
{
AttrNumber
attrno
;
...
...
@@ -557,7 +553,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
if
(
TupIsNull
(
slot
))
{
*
isNull
=
true
;
return
(
char
*
)
NULL
;
return
(
Datum
)
0
;
}
tupdesc
=
slot
->
ttc_tupleDescriptor
;
...
...
@@ -581,8 +577,9 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
tupdesc
,
isNull
);
if
(
*
isNull
)
return
(
char
*
)
NULL
;
return
(
char
*
)
retval
;
return
(
Datum
)
0
;
return
retval
;
}
/*
...
...
src/include/executor/executor.h
View file @
481487b9
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: executor.h,v 1.
49 2000/08/24 03:29:10
tgl Exp $
* $Id: executor.h,v 1.
50 2000/08/24 23:34:09
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -74,9 +74,9 @@ extern void ExecEndNode(Plan *node, Plan *parent);
*/
extern
Datum
ExecEvalParam
(
Param
*
expression
,
ExprContext
*
econtext
,
bool
*
isNull
);
extern
char
*
GetAttributeByNum
(
TupleTableSlot
*
slot
,
AttrNumber
attrno
,
bool
*
isNull
);
extern
char
*
GetAttributeByName
(
TupleTableSlot
*
slot
,
char
*
attname
,
extern
Datum
GetAttributeByNum
(
TupleTableSlot
*
slot
,
AttrNumber
attrno
,
bool
*
isNull
);
extern
Datum
GetAttributeByName
(
TupleTableSlot
*
slot
,
char
*
attname
,
bool
*
isNull
);
extern
Datum
ExecMakeFunctionResult
(
FunctionCachePtr
fcache
,
List
*
arguments
,
...
...
src/test/regress/regress.c
View file @
481487b9
/*
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.4
3 2000/07/30 20:43:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.4
4 2000/08/24 23:34:11
tgl Exp $
*/
#include <float.h>
/* faked on sunos */
...
...
@@ -187,9 +187,9 @@ overpaid(PG_FUNCTION_ARGS)
{
TUPLE
tuple
=
(
TUPLE
)
PG_GETARG_POINTER
(
0
);
bool
isnull
;
long
salary
;
int32
salary
;
salary
=
(
long
)
GetAttributeByName
(
tuple
,
"salary"
,
&
isnull
);
salary
=
DatumGetInt32
(
GetAttributeByName
(
tuple
,
"salary"
,
&
isnull
)
);
if
(
isnull
)
PG_RETURN_NULL
();
PG_RETURN_BOOL
(
salary
>
699
);
...
...
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