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
d2e028b1
Commit
d2e028b1
authored
Jun 11, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix brain damage in deciding which python input converter to use.
parent
b952d61c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
66 deletions
+31
-66
src/pl/plpython/plpython.c
src/pl/plpython/plpython.c
+31
-66
No files found.
src/pl/plpython/plpython.c
View file @
d2e028b1
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.3
2 2003/05/27 17:49:47 momjian
Exp $
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.3
3 2003/06/11 18:33:39 tgl
Exp $
*
*
*********************************************************************
*********************************************************************
*/
*/
...
@@ -244,8 +244,8 @@ static void PLy_typeinfo_init(PLyTypeInfo *);
...
@@ -244,8 +244,8 @@ static void PLy_typeinfo_init(PLyTypeInfo *);
static
void
PLy_typeinfo_dealloc
(
PLyTypeInfo
*
);
static
void
PLy_typeinfo_dealloc
(
PLyTypeInfo
*
);
static
void
PLy_output_datum_func
(
PLyTypeInfo
*
,
Form_pg_type
);
static
void
PLy_output_datum_func
(
PLyTypeInfo
*
,
Form_pg_type
);
static
void
PLy_output_datum_func2
(
PLyObToDatum
*
,
Form_pg_type
);
static
void
PLy_output_datum_func2
(
PLyObToDatum
*
,
Form_pg_type
);
static
void
PLy_input_datum_func
(
PLyTypeInfo
*
,
Form_pg_type
);
static
void
PLy_input_datum_func
(
PLyTypeInfo
*
,
Oid
,
Form_pg_type
);
static
void
PLy_input_datum_func2
(
PLyDatumToOb
*
,
Form_pg_type
);
static
void
PLy_input_datum_func2
(
PLyDatumToOb
*
,
Oid
,
Form_pg_type
);
static
void
PLy_output_tuple_funcs
(
PLyTypeInfo
*
,
TupleDesc
);
static
void
PLy_output_tuple_funcs
(
PLyTypeInfo
*
,
TupleDesc
);
static
void
PLy_input_tuple_funcs
(
PLyTypeInfo
*
,
TupleDesc
);
static
void
PLy_input_tuple_funcs
(
PLyTypeInfo
*
,
TupleDesc
);
...
@@ -1152,7 +1152,9 @@ PLy_procedure_create(FunctionCallInfo fcinfo, bool is_trigger,
...
@@ -1152,7 +1152,9 @@ PLy_procedure_create(FunctionCallInfo fcinfo, bool is_trigger,
argTypeStruct
=
(
Form_pg_type
)
GETSTRUCT
(
argTypeTup
);
argTypeStruct
=
(
Form_pg_type
)
GETSTRUCT
(
argTypeTup
);
if
(
argTypeStruct
->
typrelid
==
InvalidOid
)
if
(
argTypeStruct
->
typrelid
==
InvalidOid
)
PLy_input_datum_func
(
&
(
proc
->
args
[
i
]),
argTypeStruct
);
PLy_input_datum_func
(
&
(
proc
->
args
[
i
]),
procStruct
->
proargtypes
[
i
],
argTypeStruct
);
else
else
{
{
TupleTableSlot
*
slot
=
(
TupleTableSlot
*
)
fcinfo
->
arg
[
i
];
TupleTableSlot
*
slot
=
(
TupleTableSlot
*
)
fcinfo
->
arg
[
i
];
...
@@ -1373,7 +1375,9 @@ PLy_input_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc)
...
@@ -1373,7 +1375,9 @@ PLy_input_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc)
typeStruct
=
(
Form_pg_type
)
GETSTRUCT
(
typeTup
);
typeStruct
=
(
Form_pg_type
)
GETSTRUCT
(
typeTup
);
PLy_input_datum_func2
(
&
(
arg
->
in
.
r
.
atts
[
i
]),
typeStruct
);
PLy_input_datum_func2
(
&
(
arg
->
in
.
r
.
atts
[
i
]),
desc
->
attrs
[
i
]
->
atttypid
,
typeStruct
);
ReleaseSysCache
(
typeTup
);
ReleaseSysCache
(
typeTup
);
}
}
...
@@ -1439,85 +1443,46 @@ PLy_output_datum_func2(PLyObToDatum * arg, Form_pg_type typeStruct)
...
@@ -1439,85 +1443,46 @@ PLy_output_datum_func2(PLyObToDatum * arg, Form_pg_type typeStruct)
}
}
void
void
PLy_input_datum_func
(
PLyTypeInfo
*
arg
,
Form_pg_type
typeStruct
)
PLy_input_datum_func
(
PLyTypeInfo
*
arg
,
Oid
typeOid
,
Form_pg_type
typeStruct
)
{
{
enter
();
enter
();
if
(
arg
->
is_rel
==
1
)
if
(
arg
->
is_rel
==
1
)
elog
(
FATAL
,
"plpython: PLyTypeInfo struct is initialized for Tuple"
);
elog
(
FATAL
,
"plpython: PLyTypeInfo struct is initialized for Tuple"
);
arg
->
is_rel
=
0
;
arg
->
is_rel
=
0
;
PLy_input_datum_func2
(
&
(
arg
->
in
.
d
),
typeStruct
);
PLy_input_datum_func2
(
&
(
arg
->
in
.
d
),
type
Oid
,
type
Struct
);
}
}
void
void
PLy_input_datum_func2
(
PLyDatumToOb
*
arg
,
Form_pg_type
typeStruct
)
PLy_input_datum_func2
(
PLyDatumToOb
*
arg
,
Oid
typeOid
,
Form_pg_type
typeStruct
)
{
{
char
*
type
;
/* Get the type's conversion information */
perm_fmgr_info
(
typeStruct
->
typoutput
,
&
arg
->
typfunc
);
perm_fmgr_info
(
typeStruct
->
typoutput
,
&
arg
->
typfunc
);
arg
->
typelem
=
typeStruct
->
typelem
;
arg
->
typelem
=
typeStruct
->
typelem
;
arg
->
typbyval
=
typeStruct
->
typbyval
;
arg
->
typbyval
=
typeStruct
->
typbyval
;
/*
/* Determine which kind of Python object we will convert to */
* hmmm, wierd. means this arg will always be converted to a python
switch
(
typeOid
)
* None
*/
if
(
!
OidIsValid
(
typeStruct
->
typoutput
))
{
elog
(
ERROR
,
"plpython: (FIXME) typeStruct->typoutput is invalid"
);
arg
->
func
=
NULL
;
return
;
}
type
=
NameStr
(
typeStruct
->
typname
);
switch
(
type
[
0
])
{
{
case
'b'
:
case
BOOLOID
:
{
arg
->
func
=
PLyBool_FromString
;
if
(
strcasecmp
(
"bool"
,
type
))
break
;
{
case
FLOAT4OID
:
arg
->
func
=
PLyBool_FromString
;
case
FLOAT8OID
:
return
;
case
NUMERICOID
:
}
arg
->
func
=
PLyFloat_FromString
;
break
;
break
;
}
case
INT2OID
:
case
'f'
:
case
INT4OID
:
{
arg
->
func
=
PLyInt_FromString
;
if
((
strncasecmp
(
"float"
,
type
,
5
)
==
0
)
&&
break
;
((
type
[
5
]
==
'8'
)
||
(
type
[
5
]
==
'4'
)))
case
INT8OID
:
{
arg
->
func
=
PLyLong_FromString
;
arg
->
func
=
PLyFloat_FromString
;
break
;
return
;
}
break
;
}
case
'i'
:
{
if
((
strncasecmp
(
"int"
,
type
,
3
)
==
0
)
&&
((
type
[
3
]
==
'4'
)
||
(
type
[
3
]
==
'2'
))
&&
(
type
[
4
]
==
'\0'
))
{
arg
->
func
=
PLyInt_FromString
;
return
;
}
else
if
(
strcasecmp
(
"int8"
,
type
)
==
0
)
arg
->
func
=
PLyLong_FromString
;
break
;
}
case
'n'
:
{
if
(
strcasecmp
(
"numeric"
,
type
)
==
0
)
{
arg
->
func
=
PLyFloat_FromString
;
return
;
}
break
;
}
default:
default:
arg
->
func
=
PLyString_FromString
;
break
;
break
;
}
}
arg
->
func
=
PLyString_FromString
;
}
}
void
void
...
...
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