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
1bdd7c68
Commit
1bdd7c68
authored
May 29, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid redundant SysCache searches in coerce_type, for another
few percent speedup in INSERT...
parent
b325dab6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
37 deletions
+24
-37
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+7
-5
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+2
-2
src/backend/parser/parse_type.c
src/backend/parser/parse_type.c
+12
-27
src/include/parser/parse_type.h
src/include/parser/parse_type.h
+3
-3
No files found.
src/backend/parser/parse_coerce.c
View file @
1bdd7c68
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.1
6 1999/05/25 16:10:15 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.1
7 1999/05/29 03:17:19 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -39,6 +39,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId,
int32
atttypmod
)
{
Node
*
result
=
NULL
;
Type
targetType
;
Oid
infunc
;
Datum
val
;
...
...
@@ -79,10 +80,11 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId,
Const
*
con
=
(
Const
*
)
node
;
val
=
(
Datum
)
textout
((
struct
varlena
*
)
con
->
constvalue
);
infunc
=
typeidInfunc
(
targetTypeId
);
targetType
=
typeidType
(
targetTypeId
);
infunc
=
typeInfunc
(
targetType
);
con
=
makeNode
(
Const
);
con
->
consttype
=
targetTypeId
;
con
->
constlen
=
typeLen
(
t
ypeidType
(
targetTypeId
)
);
con
->
constlen
=
typeLen
(
t
argetType
);
/*
* Use "-1" for varchar() type. For char(), we need to pad
...
...
@@ -92,10 +94,10 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId,
*/
con
->
constvalue
=
(
Datum
)
fmgr
(
infunc
,
val
,
typeidTypElem
(
targetTypeId
),
typeTypElem
(
targetType
),
(
targetTypeId
!=
BPCHAROID
)
?
-
1
:
atttypmod
);
con
->
constisnull
=
false
;
con
->
constbyval
=
typeByVal
(
t
ypeidType
(
targetTypeId
)
);
con
->
constbyval
=
typeByVal
(
t
argetType
);
con
->
constisset
=
false
;
result
=
(
Node
*
)
con
;
}
...
...
src/backend/parser/parse_target.c
View file @
1bdd7c68
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.4
0 1999/05/25 16:10:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.4
1 1999/05/29 03:17:20 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -241,7 +241,7 @@ MakeTargetEntryExpr(ParseState *pstate,
Oid
typelem
;
if
(
arrayRef
&&
!
(((
A_Indices
*
)
lfirst
(
arrayRef
))
->
lidx
))
typelem
=
type
idTypElem
(
attrtype
);
typelem
=
type
TypElem
(
typeidType
(
attrtype
)
);
else
typelem
=
attrtype
;
...
...
src/backend/parser/parse_type.c
View file @
1bdd7c68
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.2
1 1999/05/25 16:10:22 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.2
2 1999/05/29 03:17:19 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -58,7 +58,7 @@ typeidTypeName(Oid id)
return
(
typetuple
->
typname
).
data
;
}
/* return a Type structure, given a
n typ
id */
/* return a Type structure, given a
type
id */
Type
typeidType
(
Oid
id
)
{
...
...
@@ -180,7 +180,6 @@ typeidTypeRelid(Oid type_id)
{
HeapTuple
typeTuple
;
Form_pg_type
type
;
Oid
infunc
;
typeTuple
=
SearchSysCacheTuple
(
TYPOID
,
ObjectIdGetDatum
(
type_id
),
...
...
@@ -189,8 +188,7 @@ typeidTypeRelid(Oid type_id)
elog
(
ERROR
,
"typeidTypeRelid: Invalid type - oid = %u"
,
type_id
);
type
=
(
Form_pg_type
)
GETSTRUCT
(
typeTuple
);
infunc
=
type
->
typrelid
;
return
infunc
;
return
type
->
typrelid
;
}
Oid
...
...
@@ -204,18 +202,13 @@ typeTypeRelid(Type typ)
}
Oid
type
idTypElem
(
Oid
type_id
)
type
TypElem
(
Type
typ
)
{
HeapTuple
typeTuple
;
Form_pg_type
type
;
Form_pg_type
typtup
;
if
(
!
(
typeTuple
=
SearchSysCacheTuple
(
TYPOID
,
ObjectIdGetDatum
(
type_id
),
0
,
0
,
0
)))
elog
(
ERROR
,
"type id lookup of %u failed"
,
type_id
);
type
=
(
Form_pg_type
)
GETSTRUCT
(
typeTuple
);
typtup
=
(
Form_pg_type
)
GETSTRUCT
(
typ
);
return
typ
e
->
typelem
;
return
typ
tup
->
typelem
;
}
/* Given the attribute type of an array return the attribute type of
...
...
@@ -247,21 +240,13 @@ GetArrayElementType(Oid typearray)
return
type_struct_array
->
typelem
;
}
/* Given a type
id, returns
the in-conversion function of the type */
/* Given a type
structure, return
the in-conversion function of the type */
Oid
type
idInfunc
(
Oid
type_id
)
type
Infunc
(
Type
typ
)
{
HeapTuple
typeTuple
;
Form_pg_type
type
;
Oid
infunc
;
Form_pg_type
typtup
;
typeTuple
=
SearchSysCacheTuple
(
TYPOID
,
ObjectIdGetDatum
(
type_id
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
typeTuple
))
elog
(
ERROR
,
"typeidInfunc: Invalid type - oid = %u"
,
type_id
);
typtup
=
(
Form_pg_type
)
GETSTRUCT
(
typ
);
type
=
(
Form_pg_type
)
GETSTRUCT
(
typeTuple
);
infunc
=
type
->
typinput
;
return
infunc
;
return
typtup
->
typinput
;
}
src/include/parser/parse_type.h
View file @
1bdd7c68
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parse_type.h,v 1.
9 1998/10/08 18:30:39 momjian
Exp $
* $Id: parse_type.h,v 1.
10 1999/05/29 03:17:19 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,8 +29,8 @@ extern char typeTypeFlag(Type t);
extern
char
*
stringTypeString
(
Type
tp
,
char
*
string
,
int32
atttypmod
);
extern
Oid
typeidTypeRelid
(
Oid
type_id
);
extern
Oid
typeTypeRelid
(
Type
typ
);
extern
Oid
type
idTypElem
(
Oid
type_id
);
extern
Oid
type
TypElem
(
Type
typ
);
extern
Oid
GetArrayElementType
(
Oid
typearray
);
extern
Oid
type
idInfunc
(
Oid
type_id
);
extern
Oid
type
Infunc
(
Type
typ
);
#endif
/* PARSE_TYPE_H */
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