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
22d641a7
Commit
22d641a7
authored
May 17, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the last few uses of typeidTypeName() rather than
format_type_be() in error messages.
parent
940f772a
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
97 deletions
+73
-97
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_aggregate.c
+2
-3
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_proc.c
+2
-2
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+2
-2
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+3
-4
src/backend/executor/nodeGroup.c
src/backend/executor/nodeGroup.c
+4
-4
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+4
-4
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+6
-6
src/backend/parser/parse_expr.c
src/backend/parser/parse_expr.c
+6
-6
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+33
-24
src/backend/parser/parse_type.c
src/backend/parser/parse_type.c
+5
-35
src/include/parser/parse_type.h
src/include/parser/parse_type.h
+1
-2
src/test/regress/expected/errors.out
src/test/regress/expected/errors.out
+4
-4
src/test/regress/expected/privileges.out
src/test/regress/expected/privileges.out
+1
-1
No files found.
src/backend/catalog/pg_aggregate.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.4
4 2002/04/11 19:59:57
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.4
5 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
#include "optimizer/cost.h"
#include "optimizer/cost.h"
#include "parser/parse_coerce.h"
#include "parser/parse_coerce.h"
#include "parser/parse_func.h"
#include "parser/parse_func.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -83,7 +82,7 @@ AggregateCreate(const char *aggName,
...
@@ -83,7 +82,7 @@ AggregateCreate(const char *aggName,
proc
=
(
Form_pg_proc
)
GETSTRUCT
(
tup
);
proc
=
(
Form_pg_proc
)
GETSTRUCT
(
tup
);
if
(
proc
->
prorettype
!=
aggTransType
)
if
(
proc
->
prorettype
!=
aggTransType
)
elog
(
ERROR
,
"return type of transition function %s is not %s"
,
elog
(
ERROR
,
"return type of transition function %s is not %s"
,
NameListToString
(
aggtransfnName
),
typeidTypeNam
e
(
aggTransType
));
NameListToString
(
aggtransfnName
),
format_type_b
e
(
aggTransType
));
/*
/*
* If the transfn is strict and the initval is NULL, make sure input
* If the transfn is strict and the initval is NULL, make sure input
...
...
src/backend/catalog/pg_proc.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.7
0 2002/04/11 19:59:57
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.7
1 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -140,7 +140,7 @@ ProcedureCreate(const char *procedureName,
...
@@ -140,7 +140,7 @@ ProcedureCreate(const char *procedureName,
(
relid
=
typeidTypeRelid
(
typev
[
0
]))
!=
0
&&
(
relid
=
typeidTypeRelid
(
typev
[
0
]))
!=
0
&&
get_attnum
(
relid
,
(
char
*
)
procedureName
)
!=
InvalidAttrNumber
)
get_attnum
(
relid
,
(
char
*
)
procedureName
)
!=
InvalidAttrNumber
)
elog
(
ERROR
,
"method %s already an attribute of type %s"
,
elog
(
ERROR
,
"method %s already an attribute of type %s"
,
procedureName
,
typeidTypeNam
e
(
typev
[
0
]));
procedureName
,
format_type_b
e
(
typev
[
0
]));
/*
/*
* If this is a postquel procedure, we parse it here in order to be
* If this is a postquel procedure, we parse it here in order to be
...
...
src/backend/commands/tablecmds.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.1
3 2002/05/12 23:43:0
2 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.1
4 2002/05/17 22:35:1
2 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -548,7 +548,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
...
@@ -548,7 +548,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
elog
(
ERROR
,
"CREATE TABLE: inherited attribute
\"
%s
\"
type conflict (%s and %s)"
,
elog
(
ERROR
,
"CREATE TABLE: inherited attribute
\"
%s
\"
type conflict (%s and %s)"
,
attributeName
,
attributeName
,
TypeNameToString
(
def
->
typename
),
TypeNameToString
(
def
->
typename
),
typeidTypeNam
e
(
attribute
->
atttypid
));
format_type_b
e
(
attribute
->
atttypid
));
/* Merge of NOT NULL constraints = OR 'em together */
/* Merge of NOT NULL constraints = OR 'em together */
def
->
is_not_null
|=
attribute
->
attnotnull
;
def
->
is_not_null
|=
attribute
->
attnotnull
;
/* Default and other constraints are handled below */
/* Default and other constraints are handled below */
...
...
src/backend/executor/nodeAgg.c
View file @
22d641a7
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.8
3 2002/04/29 22:28:19
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.8
4 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -63,7 +63,6 @@
...
@@ -63,7 +63,6 @@
#include "parser/parse_coerce.h"
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
#include "parser/parse_oper.h"
#include "parser/parse_oper.h"
#include "parser/parse_type.h"
#include "utils/acl.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
...
@@ -938,8 +937,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
...
@@ -938,8 +937,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
inputType
,
inputType
,
inputType
,
inputType
,
true
);
true
);
if
(
!
OidIsValid
(
eq_function
))
if
(
!
OidIsValid
(
eq_function
))
elog
(
ERROR
,
"Unable to identify an equality operator for type
'%s'
"
,
elog
(
ERROR
,
"Unable to identify an equality operator for type
%s
"
,
typeidTypeNam
e
(
inputType
));
format_type_b
e
(
inputType
));
fmgr_info
(
eq_function
,
&
(
peraggstate
->
equalfn
));
fmgr_info
(
eq_function
,
&
(
peraggstate
->
equalfn
));
peraggstate
->
sortOperator
=
any_ordering_op
(
inputType
);
peraggstate
->
sortOperator
=
any_ordering_op
(
inputType
);
peraggstate
->
sortstate
=
NULL
;
peraggstate
->
sortstate
=
NULL
;
...
...
src/backend/executor/nodeGroup.c
View file @
22d641a7
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* locate group boundaries.
* locate group boundaries.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.4
5 2002/04/16 23:08:10
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.4
6 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "executor/executor.h"
#include "executor/executor.h"
#include "executor/nodeGroup.h"
#include "executor/nodeGroup.h"
#include "parser/parse_oper.h"
#include "parser/parse_oper.h"
#include "
parser/parse_type
.h"
#include "
utils/builtins
.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -493,8 +493,8 @@ execTuplesMatchPrepare(TupleDesc tupdesc,
...
@@ -493,8 +493,8 @@ execTuplesMatchPrepare(TupleDesc tupdesc,
eq_function
=
compatible_oper_funcid
(
makeList1
(
makeString
(
"="
)),
eq_function
=
compatible_oper_funcid
(
makeList1
(
makeString
(
"="
)),
typid
,
typid
,
true
);
typid
,
typid
,
true
);
if
(
!
OidIsValid
(
eq_function
))
if
(
!
OidIsValid
(
eq_function
))
elog
(
ERROR
,
"Unable to identify an equality operator for type
'%s'
"
,
elog
(
ERROR
,
"Unable to identify an equality operator for type
%s
"
,
typeidTypeNam
e
(
typid
));
format_type_b
e
(
typid
));
fmgr_info
(
eq_function
,
&
eqfunctions
[
i
]);
fmgr_info
(
eq_function
,
&
eqfunctions
[
i
]);
}
}
...
...
src/backend/optimizer/plan/initsplan.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.7
0 2002/05/12 23:43:03
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.7
1 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "parser/parsetree.h"
#include "parser/parsetree.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
#include "parser/parse_oper.h"
#include "parser/parse_oper.h"
#include "
parser/parse_type
.h"
#include "
utils/builtins
.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -748,7 +748,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
...
@@ -748,7 +748,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
* datatypes? NO, because sortkey selection may screw up anyway.
* datatypes? NO, because sortkey selection may screw up anyway.
*/
*/
elog
(
ERROR
,
"Unable to identify an equality operator for types '%s' and '%s'"
,
elog
(
ERROR
,
"Unable to identify an equality operator for types '%s' and '%s'"
,
typeidTypeName
(
ltype
),
typeidTypeNam
e
(
rtype
));
format_type_be
(
ltype
),
format_type_b
e
(
rtype
));
}
}
pgopform
=
(
Form_pg_operator
)
GETSTRUCT
(
eq_operator
);
pgopform
=
(
Form_pg_operator
)
GETSTRUCT
(
eq_operator
);
...
@@ -759,7 +759,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
...
@@ -759,7 +759,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
pgopform
->
oprrsortop
!=
sortop2
||
pgopform
->
oprrsortop
!=
sortop2
||
pgopform
->
oprresult
!=
BOOLOID
)
pgopform
->
oprresult
!=
BOOLOID
)
elog
(
ERROR
,
"Equality operator for types '%s' and '%s' should be mergejoinable, but isn't"
,
elog
(
ERROR
,
"Equality operator for types '%s' and '%s' should be mergejoinable, but isn't"
,
typeidTypeName
(
ltype
),
typeidTypeNam
e
(
rtype
));
format_type_be
(
ltype
),
format_type_b
e
(
rtype
));
clause
=
makeNode
(
Expr
);
clause
=
makeNode
(
Expr
);
clause
->
typeOid
=
BOOLOID
;
clause
->
typeOid
=
BOOLOID
;
...
...
src/backend/parser/parse_coerce.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.7
2 2002/05/12 23:43:03
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.7
3 2002/05/17 22:35:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -133,7 +133,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
...
@@ -133,7 +133,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
InvalidOid
,
InvalidOid
,
isExplicit
);
isExplicit
);
if
(
!
OidIsValid
(
funcId
))
if
(
!
OidIsValid
(
funcId
))
elog
(
ERROR
,
"coerce_type: no conversion function from
%s to %s
"
,
elog
(
ERROR
,
"coerce_type: no conversion function from
'%s' to '%s'
"
,
format_type_be
(
inputTypeId
),
format_type_be
(
targetTypeId
));
format_type_be
(
inputTypeId
),
format_type_be
(
targetTypeId
));
result
=
build_func_call
(
funcId
,
baseTypeId
,
makeList1
(
node
));
result
=
build_func_call
(
funcId
,
baseTypeId
,
makeList1
(
node
));
...
@@ -392,8 +392,8 @@ select_common_type(List *typeids, const char *context)
...
@@ -392,8 +392,8 @@ select_common_type(List *typeids, const char *context)
* both types in different categories? then not much
* both types in different categories? then not much
* hope...
* hope...
*/
*/
elog
(
ERROR
,
"%s types
\"
%s
\"
and
\"
%s
\"
not matched"
,
elog
(
ERROR
,
"%s types
'%s' and '%s'
not matched"
,
context
,
typeidTypeName
(
ptype
),
typeidTypeNam
e
(
ntype
));
context
,
format_type_be
(
ptype
),
format_type_b
e
(
ntype
));
}
}
else
if
(
IsPreferredType
(
pcategory
,
ntype
)
else
if
(
IsPreferredType
(
pcategory
,
ntype
)
&&
!
IsPreferredType
(
pcategory
,
ptype
)
&&
!
IsPreferredType
(
pcategory
,
ptype
)
...
@@ -448,8 +448,8 @@ coerce_to_common_type(ParseState *pstate, Node *node,
...
@@ -448,8 +448,8 @@ coerce_to_common_type(ParseState *pstate, Node *node,
false
);
false
);
else
else
{
{
elog
(
ERROR
,
"%s unable to convert to type
\"
%s
\"
"
,
elog
(
ERROR
,
"%s unable to convert to type
%s
"
,
context
,
typeidTypeNam
e
(
targetTypeId
));
context
,
format_type_b
e
(
targetTypeId
));
}
}
return
node
;
return
node
;
}
}
...
...
src/backend/parser/parse_expr.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.11
7 2002/05/12 23:43:0
3 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.11
8 2002/05/17 22:35:1
3 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -366,7 +366,7 @@ transformExpr(ParseState *pstate, Node *expr)
...
@@ -366,7 +366,7 @@ transformExpr(ParseState *pstate, Node *expr)
/* Combining operators other than =/<> is dubious... */
/* Combining operators other than =/<> is dubious... */
if
(
length
(
left_list
)
!=
1
&&
if
(
length
(
left_list
)
!=
1
&&
strcmp
(
opname
,
"="
)
!=
0
&&
strcmp
(
opname
,
"<>"
)
!=
0
)
strcmp
(
opname
,
"="
)
!=
0
&&
strcmp
(
opname
,
"<>"
)
!=
0
)
elog
(
ERROR
,
"Row comparison cannot use
'%s'
"
,
elog
(
ERROR
,
"Row comparison cannot use
operator %s
"
,
opname
);
opname
);
/*
/*
...
@@ -405,13 +405,13 @@ transformExpr(ParseState *pstate, Node *expr)
...
@@ -405,13 +405,13 @@ transformExpr(ParseState *pstate, Node *expr)
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
optup
);
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
optup
);
if
(
opform
->
oprresult
!=
BOOLOID
)
if
(
opform
->
oprresult
!=
BOOLOID
)
elog
(
ERROR
,
"
'%s' result type of '%s' must return '%s'
"
elog
(
ERROR
,
"
%s has result type of %s, but must return %s
"
" to be used with quantified predicate subquery"
,
" to be used with quantified predicate subquery"
,
opname
,
typeidTypeNam
e
(
opform
->
oprresult
),
opname
,
format_type_b
e
(
opform
->
oprresult
),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
if
(
get_func_retset
(
opform
->
oprcode
))
if
(
get_func_retset
(
opform
->
oprcode
))
elog
(
ERROR
,
"
'%s'
must not return a set"
elog
(
ERROR
,
"
%s
must not return a set"
" to be used with quantified predicate subquery"
,
" to be used with quantified predicate subquery"
,
opname
);
opname
);
...
...
src/backend/parser/parse_func.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.1
29 2002/05/12 23:43:0
3 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.1
30 2002/05/17 22:35:1
3 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "catalog/namespace.h"
#include "catalog/namespace.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_proc.h"
#include "lib/stringinfo.h"
#include "nodes/makefuncs.h"
#include "nodes/makefuncs.h"
#include "parser/parse_coerce.h"
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
...
@@ -261,9 +262,25 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
...
@@ -261,9 +262,25 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
* give an error message that is appropriate for that case.
* give an error message that is appropriate for that case.
*/
*/
if
(
is_column
)
if
(
is_column
)
elog
(
ERROR
,
"Attribute
\"
%s
\"
not found"
,
{
strVal
(
lfirst
(
funcname
)));
char
*
colname
=
strVal
(
lfirst
(
funcname
));
/* Else generate a detailed complaint */
Oid
relTypeId
;
Assert
(
nargs
==
1
);
if
(
IsA
(
first_arg
,
RangeVar
))
elog
(
ERROR
,
"No such attribute %s.%s"
,
((
RangeVar
*
)
first_arg
)
->
relname
,
colname
);
relTypeId
=
exprType
(
first_arg
);
if
(
!
ISCOMPLEX
(
relTypeId
))
elog
(
ERROR
,
"Attribute notation .%s applied to type %s, which is not a complex type"
,
colname
,
format_type_be
(
relTypeId
));
else
elog
(
ERROR
,
"Attribute
\"
%s
\"
not found in datatype %s"
,
colname
,
format_type_be
(
relTypeId
));
}
/*
* Else generate a detailed complaint for a function
*/
func_error
(
NULL
,
funcname
,
nargs
,
oid_array
,
func_error
(
NULL
,
funcname
,
nargs
,
oid_array
,
"Unable to identify a function that satisfies the "
"Unable to identify a function that satisfies the "
"given argument types"
"given argument types"
...
@@ -1214,39 +1231,31 @@ func_error(const char *caller, List *funcname,
...
@@ -1214,39 +1231,31 @@ func_error(const char *caller, List *funcname,
int
nargs
,
const
Oid
*
argtypes
,
int
nargs
,
const
Oid
*
argtypes
,
const
char
*
msg
)
const
char
*
msg
)
{
{
char
p
[(
NAMEDATALEN
+
2
)
*
FUNC_MAX_ARGS
],
StringInfoData
argbuf
;
*
ptr
;
int
i
;
int
i
;
ptr
=
p
;
initStringInfo
(
&
argbuf
)
;
*
ptr
=
'\0'
;
for
(
i
=
0
;
i
<
nargs
;
i
++
)
for
(
i
=
0
;
i
<
nargs
;
i
++
)
{
{
if
(
i
)
if
(
i
)
{
appendStringInfo
(
&
argbuf
,
", "
);
*
ptr
++
=
','
;
*
ptr
++
=
' '
;
}
if
(
OidIsValid
(
argtypes
[
i
]))
if
(
OidIsValid
(
argtypes
[
i
]))
{
appendStringInfo
(
&
argbuf
,
format_type_be
(
argtypes
[
i
]));
strncpy
(
ptr
,
typeidTypeName
(
argtypes
[
i
]),
NAMEDATALEN
);
*
(
ptr
+
NAMEDATALEN
)
=
'\0'
;
}
else
else
strcpy
(
ptr
,
"opaque"
);
appendStringInfo
(
&
argbuf
,
"opaque"
);
ptr
+=
strlen
(
ptr
);
}
}
if
(
caller
==
NULL
)
if
(
caller
==
NULL
)
{
{
elog
(
ERROR
,
"Function
'%s(%s)'
does not exist%s%s"
,
elog
(
ERROR
,
"Function
%s(%s)
does not exist%s%s"
,
NameListToString
(
funcname
),
p
,
NameListToString
(
funcname
),
argbuf
.
data
,
((
msg
!=
NULL
)
?
"
\n\t
"
:
""
),
((
msg
!=
NULL
)
?
msg
:
""
));
((
msg
!=
NULL
)
?
"
\n\t
"
:
""
),
((
msg
!=
NULL
)
?
msg
:
""
));
}
}
else
else
{
{
elog
(
ERROR
,
"%s: function
'%s(%s)'
does not exist%s%s"
,
elog
(
ERROR
,
"%s: function
%s(%s)
does not exist%s%s"
,
caller
,
NameListToString
(
funcname
),
p
,
caller
,
NameListToString
(
funcname
),
argbuf
.
data
,
((
msg
!=
NULL
)
?
"
\n\t
"
:
""
),
((
msg
!=
NULL
)
?
msg
:
""
));
((
msg
!=
NULL
)
?
"
\n\t
"
:
""
),
((
msg
!=
NULL
)
?
msg
:
""
));
}
}
}
}
...
@@ -1271,10 +1280,10 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
...
@@ -1271,10 +1280,10 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
if
(
!
OidIsValid
(
oid
))
if
(
!
OidIsValid
(
oid
))
{
{
if
(
basetype
==
InvalidOid
)
if
(
basetype
==
InvalidOid
)
elog
(
ERROR
,
"%s: aggregate
'%s' for all types
does not exist"
,
elog
(
ERROR
,
"%s: aggregate
%s(*)
does not exist"
,
caller
,
NameListToString
(
aggname
));
caller
,
NameListToString
(
aggname
));
else
else
elog
(
ERROR
,
"%s: aggregate
'%s' for type %s
does not exist"
,
elog
(
ERROR
,
"%s: aggregate
%s(%s)
does not exist"
,
caller
,
NameListToString
(
aggname
),
caller
,
NameListToString
(
aggname
),
format_type_be
(
basetype
));
format_type_be
(
basetype
));
}
}
...
...
src/backend/parser/parse_type.c
View file @
22d641a7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.4
1 2002/05/12 20:10:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.4
2 2002/05/17 22:35:13
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "parser/parser.h"
#include "parser/parser.h"
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -93,7 +94,7 @@ LookupTypeName(const TypeName *typename)
...
@@ -93,7 +94,7 @@ LookupTypeName(const TypeName *typename)
/* emit nuisance warning */
/* emit nuisance warning */
elog
(
NOTICE
,
"%s converted to %s"
,
elog
(
NOTICE
,
"%s converted to %s"
,
TypeNameToString
(
typename
),
typeidTypeNam
e
(
restype
));
TypeNameToString
(
typename
),
format_type_b
e
(
restype
));
}
}
else
else
{
{
...
@@ -187,7 +188,7 @@ TypeNameToString(const TypeName *typename)
...
@@ -187,7 +188,7 @@ TypeNameToString(const TypeName *typename)
else
else
{
{
/* Look up internally-specified type */
/* Look up internally-specified type */
appendStringInfo
(
&
string
,
"%s"
,
typeidTypeNam
e
(
typename
->
typeid
));
appendStringInfo
(
&
string
,
"%s"
,
format_type_b
e
(
typename
->
typeid
));
}
}
/*
/*
...
@@ -252,12 +253,7 @@ typenameType(const TypeName *typename)
...
@@ -252,12 +253,7 @@ typenameType(const TypeName *typename)
return
(
Type
)
tup
;
return
(
Type
)
tup
;
}
}
/* check to see if a type id is valid,
/* check to see if a type id is valid, returns true if it is */
* returns true if it is. By using this call before calling
* typeidType or typeidTypeName, more meaningful error messages
* can be produced because the caller typically has more context of
* what's going on - jolly
*/
bool
bool
typeidIsValid
(
Oid
id
)
typeidIsValid
(
Oid
id
)
{
{
...
@@ -418,32 +414,6 @@ typeidOutfunc(Oid type_id)
...
@@ -418,32 +414,6 @@ typeidOutfunc(Oid type_id)
}
}
#endif
#endif
/* return a type name, given a typeid */
/* nb: type name is NOT unique; use this only for error messages */
char
*
typeidTypeName
(
Oid
id
)
{
HeapTuple
tup
;
Form_pg_type
typetuple
;
char
*
result
;
tup
=
SearchSysCache
(
TYPEOID
,
ObjectIdGetDatum
(
id
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"Unable to locate type oid %u in catalog"
,
id
);
typetuple
=
(
Form_pg_type
)
GETSTRUCT
(
tup
);
/*
* pstrdup here because result may need to outlive the syscache entry
* (eg, it might end up as part of a parse tree that will outlive the
* current transaction...)
*/
result
=
pstrdup
(
NameStr
(
typetuple
->
typname
));
ReleaseSysCache
(
tup
);
return
result
;
}
/* given a typeid, return the type's typrelid (associated relation, if any) */
/* given a typeid, return the type's typrelid (associated relation, if any) */
Oid
Oid
typeidTypeRelid
(
Oid
type_id
)
typeidTypeRelid
(
Oid
type_id
)
...
...
src/include/parser/parse_type.h
View file @
22d641a7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: parse_type.h,v 1.2
1 2002/03/29 19:06:25
tgl Exp $
* $Id: parse_type.h,v 1.2
2 2002/05/17 22:35:13
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -36,7 +36,6 @@ extern char typeTypeFlag(Type t);
...
@@ -36,7 +36,6 @@ extern char typeTypeFlag(Type t);
extern
Oid
typeTypeRelid
(
Type
typ
);
extern
Oid
typeTypeRelid
(
Type
typ
);
extern
Datum
stringTypeDatum
(
Type
tp
,
char
*
string
,
int32
atttypmod
);
extern
Datum
stringTypeDatum
(
Type
tp
,
char
*
string
,
int32
atttypmod
);
extern
char
*
typeidTypeName
(
Oid
id
);
extern
Oid
typeidTypeRelid
(
Oid
type_id
);
extern
Oid
typeidTypeRelid
(
Oid
type_id
);
extern
void
parseTypeString
(
const
char
*
str
,
Oid
*
type_id
,
int32
*
typmod
);
extern
void
parseTypeString
(
const
char
*
str
,
Oid
*
type_id
,
int32
*
typmod
);
...
...
src/test/regress/expected/errors.out
View file @
22d641a7
...
@@ -102,7 +102,7 @@ create aggregate newavg2 (sfunc = int4pl,
...
@@ -102,7 +102,7 @@ create aggregate newavg2 (sfunc = int4pl,
stype = int4,
stype = int4,
finalfunc = int2um,
finalfunc = int2um,
initcond = '0');
initcond = '0');
ERROR: AggregateCreate: function
'int2um(int4)'
does not exist
ERROR: AggregateCreate: function
int2um(integer)
does not exist
-- left out basetype
-- left out basetype
create aggregate newcnt1 (sfunc = int4inc,
create aggregate newcnt1 (sfunc = int4inc,
stype = int4,
stype = int4,
...
@@ -137,10 +137,10 @@ drop aggregate newcnt (nonesuch);
...
@@ -137,10 +137,10 @@ drop aggregate newcnt (nonesuch);
ERROR: Type "nonesuch" does not exist
ERROR: Type "nonesuch" does not exist
-- no such aggregate
-- no such aggregate
drop aggregate nonesuch (int4);
drop aggregate nonesuch (int4);
ERROR: RemoveAggregate: aggregate
'nonesuch' for type integer
does not exist
ERROR: RemoveAggregate: aggregate
nonesuch(integer)
does not exist
-- no such aggregate for type
-- no such aggregate for type
drop aggregate newcnt (float4);
drop aggregate newcnt (float4);
ERROR: RemoveAggregate: aggregate
'newcnt' for type real
does not exist
ERROR: RemoveAggregate: aggregate
newcnt(real)
does not exist
--
--
-- REMOVE FUNCTION
-- REMOVE FUNCTION
...
@@ -152,7 +152,7 @@ drop function 314159();
...
@@ -152,7 +152,7 @@ drop function 314159();
ERROR: parser: parse error at or near "314159"
ERROR: parser: parse error at or near "314159"
-- no such function
-- no such function
drop function nonesuch();
drop function nonesuch();
ERROR: RemoveFunction: function
'nonesuch()'
does not exist
ERROR: RemoveFunction: function
nonesuch()
does not exist
--
--
-- REMOVE TYPE
-- REMOVE TYPE
...
...
src/test/regress/expected/privileges.out
View file @
22d641a7
...
@@ -205,7 +205,7 @@ GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error
...
@@ -205,7 +205,7 @@ GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error
ERROR: invalid privilege type USAGE for function object
ERROR: invalid privilege type USAGE for function object
GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4;
GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4;
GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4;
GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4;
ERROR: GRANT: function
'testfunc_nosuch(int4)'
does not exist
ERROR: GRANT: function
testfunc_nosuch(integer)
does not exist
SET SESSION AUTHORIZATION regressuser2;
SET SESSION AUTHORIZATION regressuser2;
SELECT testfunc1(5), testfunc2(5); -- ok
SELECT testfunc1(5), testfunc2(5); -- ok
testfunc1 | testfunc2
testfunc1 | testfunc2
...
...
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