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
2e57875b
Commit
2e57875b
authored
Aug 09, 2001
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use format_type sibling in backend error messages, so the user sees
consistent type naming.
parent
51e8dfdd
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
149 additions
and
106 deletions
+149
-106
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+5
-5
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_proc.c
+12
-12
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+7
-5
src/backend/parser/parse_agg.c
src/backend/parser/parse_agg.c
+4
-3
src/backend/parser/parse_clause.c
src/backend/parser/parse_clause.c
+8
-7
src/backend/parser/parse_expr.c
src/backend/parser/parse_expr.c
+13
-13
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+4
-3
src/backend/parser/parse_node.c
src/backend/parser/parse_node.c
+3
-3
src/backend/parser/parse_oper.c
src/backend/parser/parse_oper.c
+25
-12
src/backend/parser/parse_target.c
src/backend/parser/parse_target.c
+5
-4
src/backend/utils/adt/format_type.c
src/backend/utils/adt/format_type.c
+31
-8
src/include/utils/builtins.h
src/include/utils/builtins.h
+2
-1
src/test/regress/expected/alter_table.out
src/test/regress/expected/alter_table.out
+6
-6
src/test/regress/expected/foreign_key.out
src/test/regress/expected/foreign_key.out
+19
-19
src/test/regress/expected/horology.out
src/test/regress/expected/horology.out
+4
-4
src/test/regress/expected/time.out
src/test/regress/expected/time.out
+1
-1
No files found.
src/backend/catalog/heap.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.17
1 2001/07/15 22:48:17 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.17
2 2001/08/09 18:28:16 petere
Exp $
*
*
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
...
@@ -1668,12 +1668,12 @@ AddRelationRawConstraints(Relation rel,
...
@@ -1668,12 +1668,12 @@ AddRelationRawConstraints(Relation rel,
{
{
if
(
CoerceTargetExpr
(
NULL
,
expr
,
type_id
,
if
(
CoerceTargetExpr
(
NULL
,
expr
,
type_id
,
atp
->
atttypid
,
atp
->
atttypmod
)
==
NULL
)
atp
->
atttypid
,
atp
->
atttypmod
)
==
NULL
)
elog
(
ERROR
,
"
Attribute '%s' is of type '%s'
"
elog
(
ERROR
,
"
Column
\"
%s
\"
is of type %s
"
" but default expression is of type
'%s'
"
" but default expression is of type
%s
"
"
\n\t
You will need to rewrite or cast the expression"
,
"
\n\t
You will need to rewrite or cast the expression"
,
NameStr
(
atp
->
attname
),
NameStr
(
atp
->
attname
),
typeidTypeNam
e
(
atp
->
atttypid
),
format_type_b
e
(
atp
->
atttypid
),
typeidTypeNam
e
(
type_id
));
format_type_b
e
(
type_id
));
}
}
}
}
...
...
src/backend/catalog/pg_proc.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.5
5 2001/03/22 06:16:10 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.5
6 2001/08/09 18:28:17 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -343,7 +343,7 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -343,7 +343,7 @@ checkretval(Oid rettype, List *queryTreeList)
{
{
if
(
rettype
!=
InvalidOid
)
if
(
rettype
!=
InvalidOid
)
elog
(
ERROR
,
"function declared to return %s, but no SELECT provided"
,
elog
(
ERROR
,
"function declared to return %s, but no SELECT provided"
,
typeidTypeNam
e
(
rettype
));
format_type_b
e
(
rettype
));
return
;
return
;
}
}
...
@@ -360,14 +360,14 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -360,14 +360,14 @@ checkretval(Oid rettype, List *queryTreeList)
if
(
rettype
==
InvalidOid
)
if
(
rettype
==
InvalidOid
)
{
{
if
(
cmd
==
CMD_SELECT
)
if
(
cmd
==
CMD_SELECT
)
elog
(
ERROR
,
"function declared with no return type, but final
query
is a SELECT"
);
elog
(
ERROR
,
"function declared with no return type, but final
statement
is a SELECT"
);
return
;
return
;
}
}
/* by here, the function is declared to return some type */
/* by here, the function is declared to return some type */
if
(
cmd
!=
CMD_SELECT
)
if
(
cmd
!=
CMD_SELECT
)
elog
(
ERROR
,
"function declared to return %s, but final
query
is not a SELECT"
,
elog
(
ERROR
,
"function declared to return %s, but final
statement
is not a SELECT"
,
typeidTypeNam
e
(
rettype
));
format_type_b
e
(
rettype
));
/*
/*
* Count the non-junk entries in the result targetlist.
* Count the non-junk entries in the result targetlist.
...
@@ -383,12 +383,12 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -383,12 +383,12 @@ checkretval(Oid rettype, List *queryTreeList)
{
{
if
(
tlistlen
!=
1
)
if
(
tlistlen
!=
1
)
elog
(
ERROR
,
"function declared to return %s returns multiple columns in final SELECT"
,
elog
(
ERROR
,
"function declared to return %s returns multiple columns in final SELECT"
,
typeidTypeNam
e
(
rettype
));
format_type_b
e
(
rettype
));
resnode
=
(
Resdom
*
)
((
TargetEntry
*
)
lfirst
(
tlist
))
->
resdom
;
resnode
=
(
Resdom
*
)
((
TargetEntry
*
)
lfirst
(
tlist
))
->
resdom
;
if
(
resnode
->
restype
!=
rettype
)
if
(
resnode
->
restype
!=
rettype
)
elog
(
ERROR
,
"return type mismatch in function: declared to return %s, returns %s"
,
elog
(
ERROR
,
"return type mismatch in function: declared to return %s, returns %s"
,
typeidTypeName
(
rettype
),
typeidTypeNam
e
(
resnode
->
restype
));
format_type_be
(
rettype
),
format_type_b
e
(
resnode
->
restype
));
return
;
return
;
}
}
...
@@ -419,7 +419,7 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -419,7 +419,7 @@ checkretval(Oid rettype, List *queryTreeList)
if
(
tlistlen
!=
relnatts
)
if
(
tlistlen
!=
relnatts
)
elog
(
ERROR
,
"function declared to return %s does not SELECT the right number of columns (%d)"
,
elog
(
ERROR
,
"function declared to return %s does not SELECT the right number of columns (%d)"
,
typeidTypeNam
e
(
rettype
),
relnatts
);
format_type_b
e
(
rettype
),
relnatts
);
/* expect attributes 1 .. n in order */
/* expect attributes 1 .. n in order */
i
=
0
;
i
=
0
;
...
@@ -433,9 +433,9 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -433,9 +433,9 @@ checkretval(Oid rettype, List *queryTreeList)
tletype
=
exprType
(
tle
->
expr
);
tletype
=
exprType
(
tle
->
expr
);
if
(
tletype
!=
reln
->
rd_att
->
attrs
[
i
]
->
atttypid
)
if
(
tletype
!=
reln
->
rd_att
->
attrs
[
i
]
->
atttypid
)
elog
(
ERROR
,
"function declared to return %s returns %s instead of %s at column %d"
,
elog
(
ERROR
,
"function declared to return %s returns %s instead of %s at column %d"
,
typeidTypeNam
e
(
rettype
),
format_type_b
e
(
rettype
),
typeidTypeNam
e
(
tletype
),
format_type_b
e
(
tletype
),
typeidTypeNam
e
(
reln
->
rd_att
->
attrs
[
i
]
->
atttypid
),
format_type_b
e
(
reln
->
rd_att
->
attrs
[
i
]
->
atttypid
),
i
+
1
);
i
+
1
);
i
++
;
i
++
;
}
}
...
@@ -443,7 +443,7 @@ checkretval(Oid rettype, List *queryTreeList)
...
@@ -443,7 +443,7 @@ checkretval(Oid rettype, List *queryTreeList)
/* this shouldn't happen, but let's just check... */
/* this shouldn't happen, but let's just check... */
if
(
i
!=
relnatts
)
if
(
i
!=
relnatts
)
elog
(
ERROR
,
"function declared to return %s does not SELECT the right number of columns (%d)"
,
elog
(
ERROR
,
"function declared to return %s does not SELECT the right number of columns (%d)"
,
typeidTypeNam
e
(
rettype
),
relnatts
);
format_type_b
e
(
rettype
),
relnatts
);
heap_close
(
reln
,
AccessShareLock
);
heap_close
(
reln
,
AccessShareLock
);
}
}
src/backend/commands/indexcmds.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.5
4 2001/08/06 18:09:45 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.5
5 2001/08/09 18:28:17 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -403,8 +403,10 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
...
@@ -403,8 +403,10 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
/* no operator class specified, so find the default */
/* no operator class specified, so find the default */
attribute
->
class
=
GetDefaultOpClass
(
attrType
);
attribute
->
class
=
GetDefaultOpClass
(
attrType
);
if
(
attribute
->
class
==
NULL
)
if
(
attribute
->
class
==
NULL
)
elog
(
ERROR
,
"DefineIndex: type %s has no default operator class"
,
elog
(
ERROR
,
"data type %s has no default operator class"
typeidTypeName
(
attrType
));
"
\n\t
You must specify an operator class for the index or define a"
"
\n\t
default operator class for the data type"
,
format_type_be
(
attrType
));
/* assume we need not check type compatibility */
/* assume we need not check type compatibility */
doTypeCheck
=
false
;
doTypeCheck
=
false
;
}
}
...
@@ -468,8 +470,8 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
...
@@ -468,8 +470,8 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
if
(
attrType
!=
opInputType
&&
if
(
attrType
!=
opInputType
&&
!
IS_BINARY_COMPATIBLE
(
attrType
,
opInputType
))
!
IS_BINARY_COMPATIBLE
(
attrType
,
opInputType
))
elog
(
ERROR
,
"
DefineIndex: opclass
\"
%s
\"
does not accept datatype
\"
%s
\"
"
,
elog
(
ERROR
,
"
operator class
\"
%s
\"
does not accept data type %s
"
,
attribute
->
class
,
typeidTypeNam
e
(
attrType
));
attribute
->
class
,
format_type_b
e
(
attrType
));
ReleaseSysCache
(
tuple
);
ReleaseSysCache
(
tuple
);
}
}
}
}
...
...
src/backend/parser/parse_agg.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.4
4 2001/01/24 19:43:01 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.4
5 2001/08/09 18:28:17 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "parser/parse_expr.h"
#include "parser/parsetree.h"
#include "parser/parsetree.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"
...
@@ -249,6 +250,6 @@ agg_error(char *caller, char *aggname, Oid basetypeID)
...
@@ -249,6 +250,6 @@ agg_error(char *caller, char *aggname, Oid basetypeID)
elog
(
ERROR
,
"%s: aggregate '%s' for all types does not exist"
,
elog
(
ERROR
,
"%s: aggregate '%s' for all types does not exist"
,
caller
,
aggname
);
caller
,
aggname
);
else
else
elog
(
ERROR
,
"%s: aggregate '%s' for
'%s'
does not exist"
,
elog
(
ERROR
,
"%s: aggregate '%s' for
type %s
does not exist"
,
caller
,
aggname
,
typeidTypeNam
e
(
basetypeID
));
caller
,
aggname
,
format_type_b
e
(
basetypeID
));
}
}
src/backend/parser/parse_clause.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.8
1 2001/06/19 22:39:11 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.8
2 2001/08/09 18:28:17 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "parser/parse_relation.h"
#include "parser/parse_relation.h"
#include "parser/parse_target.h"
#include "parser/parse_target.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/guc.h"
...
@@ -292,8 +293,8 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
...
@@ -292,8 +293,8 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
* "=" operator that doesn't return bool is wrong anyway.
* "=" operator that doesn't return bool is wrong anyway.
*/
*/
if
(
exprType
(
result
)
!=
BOOLOID
)
if
(
exprType
(
result
)
!=
BOOLOID
)
elog
(
ERROR
,
"JOIN/USING clause must return type bool, not type %s"
,
elog
(
ERROR
,
"JOIN/USING clause must return type bool
ean
, not type %s"
,
typeidTypeNam
e
(
exprType
(
result
)));
format_type_b
e
(
exprType
(
result
)));
return
result
;
return
result
;
}
/* transformJoinUsingClause() */
}
/* transformJoinUsingClause() */
...
@@ -328,8 +329,8 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
...
@@ -328,8 +329,8 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
result
=
transformExpr
(
pstate
,
j
->
quals
,
EXPR_COLUMN_FIRST
);
result
=
transformExpr
(
pstate
,
j
->
quals
,
EXPR_COLUMN_FIRST
);
if
(
!
coerce_to_boolean
(
pstate
,
&
result
))
if
(
!
coerce_to_boolean
(
pstate
,
&
result
))
elog
(
ERROR
,
"JOIN/ON clause must return type bool, not type %s"
,
elog
(
ERROR
,
"JOIN/ON clause must return type bool
ean
, not type %s"
,
typeidTypeNam
e
(
exprType
(
result
)));
format_type_b
e
(
exprType
(
result
)));
pstate
->
p_namespace
=
save_namespace
;
pstate
->
p_namespace
=
save_namespace
;
...
@@ -775,8 +776,8 @@ transformWhereClause(ParseState *pstate, Node *clause)
...
@@ -775,8 +776,8 @@ transformWhereClause(ParseState *pstate, Node *clause)
qual
=
transformExpr
(
pstate
,
clause
,
EXPR_COLUMN_FIRST
);
qual
=
transformExpr
(
pstate
,
clause
,
EXPR_COLUMN_FIRST
);
if
(
!
coerce_to_boolean
(
pstate
,
&
qual
))
if
(
!
coerce_to_boolean
(
pstate
,
&
qual
))
elog
(
ERROR
,
"WHERE clause must return type bool, not type %s"
,
elog
(
ERROR
,
"WHERE clause must return type bool
ean
, not type %s"
,
typeidTypeNam
e
(
exprType
(
qual
)));
format_type_b
e
(
exprType
(
qual
)));
return
qual
;
return
qual
;
}
}
...
...
src/backend/parser/parse_expr.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.9
8 2001/06/19 22:39:11 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.9
9 2001/08/09 18:28:17 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -179,13 +179,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
...
@@ -179,13 +179,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
if
(
!
coerce_to_boolean
(
pstate
,
&
lexpr
))
if
(
!
coerce_to_boolean
(
pstate
,
&
lexpr
))
elog
(
ERROR
,
"left-hand side of AND is type '%s', not '%s'"
,
elog
(
ERROR
,
"left-hand side of AND is type '%s', not '%s'"
,
typeidTypeNam
e
(
exprType
(
lexpr
)),
format_type_b
e
(
exprType
(
lexpr
)),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
elog
(
ERROR
,
"right-hand side of AND is type '%s', not '%s'"
,
elog
(
ERROR
,
"right-hand side of AND is type '%s', not '%s'"
,
typeidTypeNam
e
(
exprType
(
rexpr
)),
format_type_b
e
(
exprType
(
rexpr
)),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
expr
->
typeOid
=
BOOLOID
;
expr
->
typeOid
=
BOOLOID
;
expr
->
opType
=
AND_EXPR
;
expr
->
opType
=
AND_EXPR
;
...
@@ -205,13 +205,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
...
@@ -205,13 +205,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
if
(
!
coerce_to_boolean
(
pstate
,
&
lexpr
))
if
(
!
coerce_to_boolean
(
pstate
,
&
lexpr
))
elog
(
ERROR
,
"left-hand side of OR is type '%s', not '%s'"
,
elog
(
ERROR
,
"left-hand side of OR is type '%s', not '%s'"
,
typeidTypeNam
e
(
exprType
(
lexpr
)),
format_type_b
e
(
exprType
(
lexpr
)),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
elog
(
ERROR
,
"right-hand side of OR is type '%s', not '%s'"
,
elog
(
ERROR
,
"right-hand side of OR is type '%s', not '%s'"
,
typeidTypeNam
e
(
exprType
(
rexpr
)),
format_type_b
e
(
exprType
(
rexpr
)),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
expr
->
typeOid
=
BOOLOID
;
expr
->
typeOid
=
BOOLOID
;
expr
->
opType
=
OR_EXPR
;
expr
->
opType
=
OR_EXPR
;
...
@@ -228,8 +228,8 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
...
@@ -228,8 +228,8 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
if
(
!
coerce_to_boolean
(
pstate
,
&
rexpr
))
elog
(
ERROR
,
"argument to NOT is type '%s', not '%s'"
,
elog
(
ERROR
,
"argument to NOT is type '%s', not '%s'"
,
typeidTypeNam
e
(
exprType
(
rexpr
)),
format_type_b
e
(
exprType
(
rexpr
)),
typeidTypeNam
e
(
BOOLOID
));
format_type_b
e
(
BOOLOID
));
expr
->
typeOid
=
BOOLOID
;
expr
->
typeOid
=
BOOLOID
;
expr
->
opType
=
NOT_EXPR
;
expr
->
opType
=
NOT_EXPR
;
...
@@ -962,8 +962,8 @@ parser_typecast_expression(ParseState *pstate,
...
@@ -962,8 +962,8 @@ parser_typecast_expression(ParseState *pstate,
targetType
,
typename
->
typmod
);
targetType
,
typename
->
typmod
);
if
(
expr
==
NULL
)
if
(
expr
==
NULL
)
elog
(
ERROR
,
"Cannot cast type '%s' to '%s'"
,
elog
(
ERROR
,
"Cannot cast type '%s' to '%s'"
,
typeidTypeNam
e
(
inputType
),
format_type_b
e
(
inputType
),
typeidTypeNam
e
(
targetType
));
format_type_b
e
(
targetType
));
}
}
/*
/*
...
...
src/backend/parser/parse_func.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.1
09 2001/06/22 19:16:22 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.1
10 2001/08/09 18:28:18 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "parser/parse_func.h"
#include "parser/parse_func.h"
#include "parser/parse_relation.h"
#include "parser/parse_relation.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -288,7 +289,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -288,7 +289,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
{
{
/* Multiple possible matches --- give up */
/* Multiple possible matches --- give up */
elog
(
ERROR
,
"Unable to select an aggregate function %s(%s)"
,
elog
(
ERROR
,
"Unable to select an aggregate function %s(%s)"
,
funcname
,
typeidTypeNam
e
(
basetype
));
funcname
,
format_type_b
e
(
basetype
));
}
}
}
}
...
@@ -300,7 +301,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
...
@@ -300,7 +301,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
* function could not have been meant.
* function could not have been meant.
*/
*/
elog
(
ERROR
,
"There is no aggregate function %s(%s)"
,
elog
(
ERROR
,
"There is no aggregate function %s(%s)"
,
funcname
,
typeidTypeNam
e
(
basetype
));
funcname
,
format_type_b
e
(
basetype
));
}
}
}
}
...
...
src/backend/parser/parse_node.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.5
4 2001/05/22 16:37:16
petere Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.5
5 2001/08/09 18:28:18
petere Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -373,8 +373,8 @@ transformArraySubscripts(ParseState *pstate,
...
@@ -373,8 +373,8 @@ transformArraySubscripts(ParseState *pstate,
elog
(
ERROR
,
"Array assignment requires type '%s'"
elog
(
ERROR
,
"Array assignment requires type '%s'"
" but expression is of type '%s'"
" but expression is of type '%s'"
"
\n\t
You will need to rewrite or cast the expression"
,
"
\n\t
You will need to rewrite or cast the expression"
,
typeidTypeNam
e
(
typeneeded
),
format_type_b
e
(
typeneeded
),
typeidTypeNam
e
(
typesource
));
format_type_b
e
(
typesource
));
}
}
}
}
}
}
...
...
src/backend/parser/parse_oper.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.
49 2001/04/23 04:32:30 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.
50 2001/08/09 18:28:18 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "parser/parse_func.h"
#include "parser/parse_func.h"
#include "parser/parse_oper.h"
#include "parser/parse_oper.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/fmgroids.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
...
@@ -48,7 +49,7 @@ any_ordering_op(Oid argtype)
...
@@ -48,7 +49,7 @@ any_ordering_op(Oid argtype)
if
(
!
OidIsValid
(
order_opid
))
if
(
!
OidIsValid
(
order_opid
))
elog
(
ERROR
,
"Unable to identify an ordering operator '%s' for type '%s'"
elog
(
ERROR
,
"Unable to identify an ordering operator '%s' for type '%s'"
"
\n\t
Use an explicit ordering operator or modify the query"
,
"
\n\t
Use an explicit ordering operator or modify the query"
,
"<"
,
typeidTypeNam
e
(
argtype
));
"<"
,
format_type_b
e
(
argtype
));
return
order_opid
;
return
order_opid
;
}
}
...
@@ -931,7 +932,7 @@ op_error(char *op, Oid arg1, Oid arg2)
...
@@ -931,7 +932,7 @@ op_error(char *op, Oid arg1, Oid arg2)
elog
(
ERROR
,
"Unable to identify an operator '%s' for types '%s' and '%s'"
elog
(
ERROR
,
"Unable to identify an operator '%s' for types '%s' and '%s'"
"
\n\t
You will have to retype this query using an explicit cast"
,
"
\n\t
You will have to retype this query using an explicit cast"
,
op
,
typeidTypeName
(
arg1
),
typeidTypeNam
e
(
arg2
));
op
,
format_type_be
(
arg1
),
format_type_b
e
(
arg2
));
}
}
/* unary_op_error()
/* unary_op_error()
...
@@ -942,13 +943,25 @@ static void
...
@@ -942,13 +943,25 @@ static void
unary_op_error
(
char
*
op
,
Oid
arg
,
bool
is_left_op
)
unary_op_error
(
char
*
op
,
Oid
arg
,
bool
is_left_op
)
{
{
if
(
!
typeidIsValid
(
arg
))
if
(
!
typeidIsValid
(
arg
))
elog
(
ERROR
,
"Argument of %s operator '%s' has an unknown type"
{
"
\n\t
Probably a bad attribute name"
,
if
(
is_left_op
)
(
is_left_op
?
"left"
:
"right"
),
elog
(
ERROR
,
"operand of prefix operator '%s' has an unknown type"
"
\n\t
(probably an invalid column reference)"
,
op
);
op
);
else
elog
(
ERROR
,
"Unable to identify a %s operator '%s' for type '%s'"
elog
(
ERROR
,
"operand of postfix operator '%s' has an unknown type"
"
\n\t
(probably an invalid column reference)"
,
op
);
}
else
{
if
(
is_left_op
)
elog
(
ERROR
,
"Unable to identify a prefix operator '%s' for type '%s'"
"
\n\t
You may need to add parentheses or an explicit cast"
,
"
\n\t
You may need to add parentheses or an explicit cast"
,
(
is_left_op
?
"left"
:
"right"
),
op
,
format_type_be
(
arg
));
op
,
typeidTypeName
(
arg
));
else
elog
(
ERROR
,
"Unable to identify a postfix operator '%s' for type '%s'"
"
\n\t
You may need to add parentheses or an explicit cast"
,
op
,
format_type_be
(
arg
));
}
}
}
src/backend/parser/parse_target.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.
69 2001/06/24 02:41:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.
70 2001/08/09 18:28:18 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "parser/parse_relation.h"
#include "parser/parse_relation.h"
#include "parser/parse_target.h"
#include "parser/parse_target.h"
#include "parser/parse_type.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
static
List
*
ExpandAllTables
(
ParseState
*
pstate
);
static
List
*
ExpandAllTables
(
ParseState
*
pstate
);
...
@@ -265,12 +266,12 @@ updateTargetListEntry(ParseState *pstate,
...
@@ -265,12 +266,12 @@ updateTargetListEntry(ParseState *pstate,
tle
->
expr
=
CoerceTargetExpr
(
pstate
,
tle
->
expr
,
type_id
,
tle
->
expr
=
CoerceTargetExpr
(
pstate
,
tle
->
expr
,
type_id
,
attrtype
,
attrtypmod
);
attrtype
,
attrtypmod
);
if
(
tle
->
expr
==
NULL
)
if
(
tle
->
expr
==
NULL
)
elog
(
ERROR
,
"
Attribute '%s'
is of type '%s'"
elog
(
ERROR
,
"
column
\"
%s
\"
is of type '%s'"
" but expression is of type '%s'"
" but expression is of type '%s'"
"
\n\t
You will need to rewrite or cast the expression"
,
"
\n\t
You will need to rewrite or cast the expression"
,
colname
,
colname
,
typeidTypeNam
e
(
attrtype
),
format_type_b
e
(
attrtype
),
typeidTypeNam
e
(
type_id
));
format_type_b
e
(
type_id
));
}
}
/*
/*
...
...
src/backend/utils/adt/format_type.c
View file @
2e57875b
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,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/utils/adt/format_type.c,v 1.1
3 2001/05/22 16:37:16
petere Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.1
4 2001/08/09 18:28:18
petere Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
#define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
static
char
*
format_type_internal
(
Oid
type_oid
,
int32
typemod
);
static
char
*
format_type_internal
(
Oid
type_oid
,
int32
typemod
,
bool
allow_invalid
);
static
char
*
static
char
*
...
@@ -78,14 +78,27 @@ format_type(PG_FUNCTION_ARGS)
...
@@ -78,14 +78,27 @@ format_type(PG_FUNCTION_ARGS)
else
else
typemod
=
-
1
;
/* default typmod */
typemod
=
-
1
;
/* default typmod */
result
=
format_type_internal
(
type_oid
,
typemod
);
result
=
format_type_internal
(
type_oid
,
typemod
,
true
);
PG_RETURN_DATUM
(
_textin
(
result
));
PG_RETURN_DATUM
(
_textin
(
result
));
}
}
/*
* This version is for use within the backend in error messages, etc.
* One difference is that it will fail for an invalid type.
*/
char
*
format_type_be
(
Oid
type_oid
)
{
return
format_type_internal
(
type_oid
,
-
1
,
false
);
}
static
char
*
static
char
*
format_type_internal
(
Oid
type_oid
,
int32
typemod
)
format_type_internal
(
Oid
type_oid
,
int32
typemod
,
bool
allow_invalid
)
{
{
bool
with_typemod
=
(
typemod
>=
0
);
bool
with_typemod
=
(
typemod
>=
0
);
HeapTuple
tuple
;
HeapTuple
tuple
;
...
@@ -95,14 +108,19 @@ format_type_internal(Oid type_oid, int32 typemod)
...
@@ -95,14 +108,19 @@ format_type_internal(Oid type_oid, int32 typemod)
char
*
name
;
char
*
name
;
char
*
buf
;
char
*
buf
;
if
(
type_oid
==
InvalidOid
)
if
(
type_oid
==
InvalidOid
&&
allow_invalid
)
return
pstrdup
(
"-"
);
return
pstrdup
(
"-"
);
tuple
=
SearchSysCache
(
TYPEOID
,
tuple
=
SearchSysCache
(
TYPEOID
,
ObjectIdGetDatum
(
type_oid
),
ObjectIdGetDatum
(
type_oid
),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
if
(
!
HeapTupleIsValid
(
tuple
))
{
if
(
allow_invalid
)
return
pstrdup
(
"???"
);
return
pstrdup
(
"???"
);
else
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
}
array_base_type
=
((
Form_pg_type
)
GETSTRUCT
(
tuple
))
->
typelem
;
array_base_type
=
((
Form_pg_type
)
GETSTRUCT
(
tuple
))
->
typelem
;
typlen
=
((
Form_pg_type
)
GETSTRUCT
(
tuple
))
->
typlen
;
typlen
=
((
Form_pg_type
)
GETSTRUCT
(
tuple
))
->
typlen
;
...
@@ -114,7 +132,12 @@ format_type_internal(Oid type_oid, int32 typemod)
...
@@ -114,7 +132,12 @@ format_type_internal(Oid type_oid, int32 typemod)
ObjectIdGetDatum
(
array_base_type
),
ObjectIdGetDatum
(
array_base_type
),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
if
(
!
HeapTupleIsValid
(
tuple
))
{
if
(
allow_invalid
)
return
pstrdup
(
"???[]"
);
return
pstrdup
(
"???[]"
);
else
elog
(
ERROR
,
"could not locate data type with oid %u in catalog"
,
type_oid
);
}
is_array
=
true
;
is_array
=
true
;
type_oid
=
array_base_type
;
type_oid
=
array_base_type
;
}
}
...
@@ -305,7 +328,7 @@ oidvectortypes(PG_FUNCTION_ARGS)
...
@@ -305,7 +328,7 @@ oidvectortypes(PG_FUNCTION_ARGS)
for
(
num
=
0
;
num
<
numargs
;
num
++
)
for
(
num
=
0
;
num
<
numargs
;
num
++
)
{
{
char
*
typename
=
format_type_internal
(
oidArray
[
num
],
-
1
);
char
*
typename
=
format_type_internal
(
oidArray
[
num
],
-
1
,
true
);
if
(
left
<
strlen
(
typename
)
+
2
)
if
(
left
<
strlen
(
typename
)
+
2
)
{
{
...
...
src/include/utils/builtins.h
View file @
2e57875b
...
@@ -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: builtins.h,v 1.15
8 2001/07/16 05:07:00 tgl
Exp $
* $Id: builtins.h,v 1.15
9 2001/08/09 18:28:18 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -572,6 +572,7 @@ extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS);
...
@@ -572,6 +572,7 @@ extern Datum PG_char_to_encoding(PG_FUNCTION_ARGS);
/* format_type.c */
/* format_type.c */
extern
Datum
format_type
(
PG_FUNCTION_ARGS
);
extern
Datum
format_type
(
PG_FUNCTION_ARGS
);
extern
char
*
format_type_be
(
Oid
type_oid
);
extern
Datum
oidvectortypes
(
PG_FUNCTION_ARGS
);
extern
Datum
oidvectortypes
(
PG_FUNCTION_ARGS
);
extern
int32
type_maximum_size
(
Oid
type_oid
,
int32
typemod
);
extern
int32
type_maximum_size
(
Oid
type_oid
,
int32
typemod
);
...
...
src/test/regress/expected/alter_table.out
View file @
2e57875b
...
@@ -322,13 +322,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 text);
...
@@ -322,13 +322,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 text);
-- This next should fail, because text=int does not exist
-- This next should fail, because text=int does not exist
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This should also fail for the same reason, but here we
-- This should also fail for the same reason, but here we
-- give the column name
-- give the column name
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This should succeed, even though they are different types
-- This should succeed, even though they are different types
-- because varchar=int does exist
-- because varchar=int does exist
...
@@ -350,7 +350,7 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
...
@@ -350,7 +350,7 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- Again, so should this...
-- Again, so should this...
DROP TABLE FKTABLE;
DROP TABLE FKTABLE;
...
@@ -358,7 +358,7 @@ CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
...
@@ -358,7 +358,7 @@ CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest1, ptest2);
references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This fails because we mixed up the column ordering
-- This fails because we mixed up the column ordering
DROP TABLE FKTABLE;
DROP TABLE FKTABLE;
...
@@ -366,13 +366,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 text);
...
@@ -366,13 +366,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 text);
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
references pktable(ptest2, ptest1);
references pktable(ptest2, ptest1);
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'int
4
' and 'text'
ERROR: Unable to identify an operator '=' for types 'int
eger
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- As does this...
-- As does this...
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
references pktable(ptest1, ptest2);
references pktable(ptest1, ptest2);
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- temp tables should go away by themselves, need not drop them.
-- temp tables should go away by themselves, need not drop them.
-- test check constraint adding
-- test check constraint adding
...
...
src/test/regress/expected/foreign_key.out
View file @
2e57875b
...
@@ -721,13 +721,13 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
...
@@ -721,13 +721,13 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
-- This next should fail, because text=int does not exist
-- This next should fail, because text=int does not exist
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable);
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This should also fail for the same reason, but here we
-- This should also fail for the same reason, but here we
-- give the column name
-- give the column name
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable(ptest1));
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable(ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This should succeed, even though they are different types
-- This should succeed, even though they are different types
-- because varchar=int does exist
-- because varchar=int does exist
...
@@ -749,27 +749,27 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
...
@@ -749,27 +749,27 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
-- This should fail, because we just chose really odd types
-- This should fail, because we just chose really odd types
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable);
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- Again, so should this...
-- Again, so should this...
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2));
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This fails because we mixed up the column ordering
-- This fails because we mixed up the column ordering
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable);
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- As does this...
-- As does this...
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2));
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- And again..
-- And again..
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1));
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'int
4
' and 'text'
ERROR: Unable to identify an operator '=' for types 'int
eger
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- This works...
-- This works...
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1));
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1));
...
@@ -802,21 +802,21 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY
...
@@ -802,21 +802,21 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY
ptest4) REFERENCES pktable(ptest2, ptest1));
ptest4) REFERENCES pktable(ptest2, ptest1));
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'int
4
' and 'text'
ERROR: Unable to identify an operator '=' for types 'int
eger
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types
-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
ptest3) REFERENCES pktable(ptest1, ptest2));
ptest3) REFERENCES pktable(ptest1, ptest2));
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- Not this one either... Same as the last one except we didn't defined the columns being referenced.
-- Not this one either... Same as the last one except we didn't defined the columns being referenced.
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
ptest3) REFERENCES pktable);
ptest3) REFERENCES pktable);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
--
--
-- Now some cases with inheritance
-- Now some cases with inheritance
...
@@ -912,24 +912,24 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
...
@@ -912,24 +912,24 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
-- just generally bad types (with and without column references on the referenced table)
-- just generally bad types (with and without column references on the referenced table)
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable);
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1));
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- let's mix up which columns reference which
-- let's mix up which columns reference which
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable);
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable);
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable(base1, ptest1));
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable(base1, ptest1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table fktable(ftest1 int, ftest2 text, foreign key(ftest1, ftest2) references pktable(ptest1, base1));
create table fktable(ftest1 int, ftest2 text, foreign key(ftest1, ftest2) references pktable(ptest1, base1));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'int
4
' and 'text'
ERROR: Unable to identify an operator '=' for types 'int
eger
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
drop table pktable;
drop table pktable;
drop table pktable_base;
drop table pktable_base;
...
@@ -939,25 +939,25 @@ create table pktable(ptest1 text, ptest2 text[], primary key(base1, ptest1), for
...
@@ -939,25 +939,25 @@ create table pktable(ptest1 text, ptest2 text[], primary key(base1, ptest1), for
pktable(base1, ptest1)) inherits (pktable_base);
pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types '
_text
' and 'text'
ERROR: Unable to identify an operator '=' for types '
text[]
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(base2, ptest2) references
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(base2, ptest2) references
pktable(ptest1, base1)) inherits (pktable_base);
pktable(ptest1, base1)) inherits (pktable_base);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'int
4
' and 'text'
ERROR: Unable to identify an operator '=' for types 'int
eger
' and 'text'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references
pktable(base1, ptest1)) inherits (pktable_base);
pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references
pktable(base1, ptest1)) inherits (pktable_base);
pktable(base1, ptest1)) inherits (pktable_base);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: Unable to identify an operator '=' for types 'text' and 'int
4
'
ERROR: Unable to identify an operator '=' for types 'text' and 'int
eger
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
drop table pktable;
drop table pktable;
ERROR: table "pktable" does not exist
ERROR: table "pktable" does not exist
...
...
src/test/regress/expected/horology.out
View file @
2e57875b
...
@@ -43,7 +43,7 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
...
@@ -43,7 +43,7 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
(1 row)
(1 row)
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
ERROR: Unable to identify an operator '-' for types 'date' and 'time
tz
'
ERROR: Unable to identify an operator '-' for types 'date' and 'time
with time zone
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
--
--
-- timestamp, interval arithmetic
-- timestamp, interval arithmetic
...
@@ -118,9 +118,9 @@ SELECT interval '04:30' - time '01:02' AS "+03:28";
...
@@ -118,9 +118,9 @@ SELECT interval '04:30' - time '01:02' AS "+03:28";
(1 row)
(1 row)
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
ERROR: Cannot cast type
'timetz' to 'interval'
ERROR: Cannot cast type
time with time zone to interval
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
ERROR: Cannot cast type
'interval' to 'timetz'
ERROR: Cannot cast type
interval to time with time zone
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
23:29:00-08
23:29:00-08
-------------
-------------
...
@@ -153,7 +153,7 @@ SELECT CAST(date 'today' + time with time zone '03:30'
...
@@ -153,7 +153,7 @@ SELECT CAST(date 'today' + time with time zone '03:30'
(1 row)
(1 row)
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
ERROR: Unable to identify an operator '-' for types 'interval' and 'time
tz
'
ERROR: Unable to identify an operator '-' for types 'interval' and 'time
with time zone
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
-- We get 100 rows when run in GMT...
-- We get 100 rows when run in GMT...
SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
...
...
src/test/regress/expected/time.out
View file @
2e57875b
...
@@ -71,5 +71,5 @@ SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
...
@@ -71,5 +71,5 @@ SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
ERROR: Unable to identify an operator '+' for types 'time' and 'time'
ERROR: Unable to identify an operator '+' for types 'time' and 'time'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
SELECT f2 + time with time zone '00:01' AS "Illegal" FROM TIME_TBL;
SELECT f2 + time with time zone '00:01' AS "Illegal" FROM TIME_TBL;
ERROR: Unable to identify an operator '+' for types 'time
tz' and 'timetz
'
ERROR: Unable to identify an operator '+' for types 'time
with time zone' and 'time with time zone
'
You will have to retype this query using an explicit cast
You will have to retype this query using an explicit cast
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