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
d1af54cf
Commit
d1af54cf
authored
May 19, 2001
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure fmgr_info() fills in fn_oid last, so that no partially
initialized FmgrInfo structs linger after elog.
parent
cb8b40e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/fmgr.c
+22
-13
No files found.
src/backend/utils/fmgr/fmgr.c
View file @
d1af54cf
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.5
1 2001/03/22 03:59:59 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.5
2 2001/05/19 09:28:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -57,8 +57,8 @@ typedef struct
}
Oldstyle_fnextra
;
static
void
fmgr_info_C_lang
(
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
);
static
void
fmgr_info_other_lang
(
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
);
static
void
fmgr_info_C_lang
(
Oid
functionId
,
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
);
static
void
fmgr_info_other_lang
(
Oid
functionId
,
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
);
static
Datum
fmgr_oldstyle
(
PG_FUNCTION_ARGS
);
static
Datum
fmgr_untrusted
(
PG_FUNCTION_ARGS
);
...
...
@@ -123,7 +123,11 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
Form_pg_proc
procedureStruct
;
char
*
prosrc
;
finfo
->
fn_oid
=
functionId
;
/*
* fn_oid *must* be filled in last. Code may assume that is fn_oid is valid,
* the whole struct is valid. Some FmgrInfo struct's do survive elogs.
*/
finfo
->
fn_oid
=
InvalidOid
;
finfo
->
fn_extra
=
NULL
;
finfo
->
fn_mcxt
=
CurrentMemoryContext
;
...
...
@@ -138,6 +142,7 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
finfo
->
fn_strict
=
fbp
->
strict
;
finfo
->
fn_retset
=
fbp
->
retset
;
finfo
->
fn_addr
=
fbp
->
func
;
finfo
->
fn_oid
=
functionId
;
return
;
}
...
...
@@ -158,6 +163,7 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
{
/* This isn't really supported anymore... */
finfo
->
fn_addr
=
fmgr_untrusted
;
finfo
->
fn_oid
=
functionId
;
ReleaseSysCache
(
procedureTuple
);
return
;
}
...
...
@@ -187,7 +193,7 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
break
;
case
ClanguageId
:
fmgr_info_C_lang
(
finfo
,
procedureTuple
);
fmgr_info_C_lang
(
f
unctionId
,
f
info
,
procedureTuple
);
break
;
case
SQLlanguageId
:
...
...
@@ -195,18 +201,20 @@ fmgr_info(Oid functionId, FmgrInfo *finfo)
break
;
default:
fmgr_info_other_lang
(
finfo
,
procedureTuple
);
fmgr_info_other_lang
(
f
unctionId
,
f
info
,
procedureTuple
);
break
;
}
finfo
->
fn_oid
=
functionId
;
ReleaseSysCache
(
procedureTuple
);
}
/*
* Special fmgr_info processing for C-language functions
* Special fmgr_info processing for C-language functions. Note that
* finfo->fn_oid is not valid yet.
*/
static
void
fmgr_info_C_lang
(
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
)
fmgr_info_C_lang
(
Oid
functionId
,
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
)
{
Form_pg_proc
procedureStruct
=
(
Form_pg_proc
)
GETSTRUCT
(
procedureTuple
);
Datum
prosrcattr
,
...
...
@@ -224,14 +232,14 @@ fmgr_info_C_lang(FmgrInfo *finfo, HeapTuple procedureTuple)
Anum_pg_proc_prosrc
,
&
isnull
);
if
(
isnull
)
elog
(
ERROR
,
"fmgr: Could not extract prosrc for %u from pg_proc"
,
f
info
->
fn_oi
d
);
f
unctionI
d
);
prosrcstring
=
DatumGetCString
(
DirectFunctionCall1
(
textout
,
prosrcattr
));
probinattr
=
SysCacheGetAttr
(
PROCOID
,
procedureTuple
,
Anum_pg_proc_probin
,
&
isnull
);
if
(
isnull
)
elog
(
ERROR
,
"fmgr: Could not extract probin for %u from pg_proc"
,
f
info
->
fn_oi
d
);
f
unctionI
d
);
probinstring
=
DatumGetCString
(
DirectFunctionCall1
(
textout
,
probinattr
));
/* Look up the function itself */
...
...
@@ -276,10 +284,11 @@ fmgr_info_C_lang(FmgrInfo *finfo, HeapTuple procedureTuple)
}
/*
* Special fmgr_info processing for other-language functions
* Special fmgr_info processing for other-language functions. Note
* that finfo->fn_oid is not valid yet.
*/
static
void
fmgr_info_other_lang
(
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
)
fmgr_info_other_lang
(
Oid
functionId
,
FmgrInfo
*
finfo
,
HeapTuple
procedureTuple
)
{
Form_pg_proc
procedureStruct
=
(
Form_pg_proc
)
GETSTRUCT
(
procedureTuple
);
Oid
language
=
procedureStruct
->
prolang
;
...
...
@@ -312,7 +321,7 @@ fmgr_info_other_lang(FmgrInfo *finfo, HeapTuple procedureTuple)
else
{
elog
(
ERROR
,
"fmgr_info: function %u: unsupported language %u"
,
f
info
->
fn_oi
d
,
language
);
f
unctionI
d
,
language
);
}
ReleaseSysCache
(
languageTuple
);
}
...
...
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