Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3c49c4b

Browse files
committed
Mark the float8 -> int8 cast as implicit. This resolves the problem
pointed out by Barry Lind: UPDATE bigintcol = 10000000000 fails because the constant is initially taken as float8. We really need a better way, but it's not gonna happen for 7.3. Also, remove int4reltime() function, which is redundant with the existing binary-compatibility coercion path from int4 to reltime, and probably has been unreachable code for a long while.
1 parent 845a6c3 commit 3c49c4b

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

src/backend/utils/adt/nabstime.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.96 2002/08/04 06:44:47 thomas Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.97 2002/09/01 00:58:06 tgl Exp $
1313
*
1414
* NOTES
1515
*
@@ -1735,15 +1735,6 @@ istinterval(char *i_string,
17351735
*
17361736
*****************************************************************************/
17371737

1738-
Datum
1739-
int4reltime(PG_FUNCTION_ARGS)
1740-
{
1741-
int32 timevalue = PG_GETARG_INT32(0);
1742-
1743-
/* Just coerce it directly to RelativeTime ... */
1744-
PG_RETURN_RELATIVETIME((RelativeTime) timevalue);
1745-
}
1746-
17471738
/*
17481739
* timeofday -
17491740
* returns the current time as a text. similar to timenow() but returns

src/include/catalog/pg_cast.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
/*-------------------------------------------------------------------------
22
*
3-
* $Header: /cvsroot/pgsql/src/include/catalog/pg_cast.h,v 1.1 2002/07/18 23:11:30 petere Exp $
3+
* pg_cast.h
4+
* definition of the system "type casts" relation (pg_cast)
5+
* along with the relation's initial contents.
6+
*
47
*
58
* Copyright (c) 2002, PostgreSQL Global Development Group
69
*
10+
* $Id: pg_cast.h,v 1.2 2002/09/01 00:58:06 tgl Exp $
11+
*
12+
* NOTES
13+
* the genbki.sh script reads this file and generates .bki
14+
* information from the DATA() statements.
15+
*
716
*-------------------------------------------------------------------------
817
*/
918
#ifndef PG_CAST_H
1019
#define PG_CAST_H
1120

1221
CATALOG(pg_cast)
1322
{
14-
Oid castsource;
15-
Oid casttarget;
23+
Oid castsource; /* source datatype for cast */
24+
Oid casttarget; /* destination datatype for cast */
1625
Oid castfunc; /* 0 = binary compatible */
17-
bool castimplicit;
26+
bool castimplicit; /* allow implicit casting? */
1827
} FormData_pg_cast;
1928

2029
typedef FormData_pg_cast *Form_pg_cast;
@@ -115,7 +124,10 @@ DATA(insert ( 1562 1560 0 t ));
115124
* This list can be obtained from the following query as long as the
116125
* naming convention of the cast functions remains the same:
117126
*
118-
* select p.proargtypes[0] as source, p.prorettype as target, p.oid as func, p.proimplicit as implicit from pg_proc p, pg_type t where p.pronargs=1 and p.proname = t.typname and p.prorettype = t.oid order by 1, 2;
127+
* select p.proargtypes[0] as source, p.prorettype as target, p.oid as func,
128+
* p.proimplicit as implicit
129+
* from pg_proc p, pg_type t where p.pronargs=1 and p.proname = t.typname
130+
* and p.prorettype = t.oid order by 1, 2;
119131
*/
120132
DATA(insert ( 18 25 946 t ));
121133
DATA(insert ( 18 1042 860 t ));
@@ -139,7 +151,6 @@ DATA(insert ( 23 21 314 t ));
139151
DATA(insert ( 23 25 112 t ));
140152
DATA(insert ( 23 700 318 t ));
141153
DATA(insert ( 23 701 316 t ));
142-
/*xDATA(insert ( 23 703 1200 f ));*/
143154
DATA(insert ( 23 1043 1619 f ));
144155
DATA(insert ( 23 1700 1740 t ));
145156
DATA(insert ( 25 18 944 t ));
@@ -159,7 +170,7 @@ DATA(insert ( 25 1114 2022 f ));
159170
DATA(insert ( 25 1184 1191 f ));
160171
DATA(insert ( 25 1186 1263 f ));
161172
DATA(insert ( 25 1266 938 f ));
162-
DATA(insert ( 26 25 114 f ));
173+
DATA(insert ( 26 25 114 t ));
163174
DATA(insert ( 601 600 1532 f ));
164175
DATA(insert ( 602 600 1533 f ));
165176
DATA(insert ( 602 604 1449 f ));
@@ -176,7 +187,7 @@ DATA(insert ( 700 23 319 f ));
176187
DATA(insert ( 700 25 841 t ));
177188
DATA(insert ( 700 701 311 t ));
178189
DATA(insert ( 700 1700 1742 t ));
179-
DATA(insert ( 701 20 483 f ));
190+
DATA(insert ( 701 20 483 t ));
180191
DATA(insert ( 701 21 237 f ));
181192
DATA(insert ( 701 23 317 f ));
182193
DATA(insert ( 701 25 840 t ));

src/include/catalog/pg_proc.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.266 2002/08/27 04:00:28 momjian Exp $
10+
* $Id: pg_proc.h,v 1.267 2002/09/01 00:58:06 tgl Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -1479,9 +1479,6 @@ DESCR("date difference preserving months and years");
14791479

14801480
/* OIDS 1200 - 1299 */
14811481

1482-
DATA(insert OID = 1200 ( reltime PGNSP PGUID 12 f f t f i 1 703 "23" int4reltime - _null_ ));
1483-
DESCR("convert int4 to reltime");
1484-
14851482
DATA(insert OID = 1215 ( obj_description PGNSP PGUID 14 f f t f s 2 25 "26 19" "select description from pg_description where objoid = $1 and classoid = (select oid from pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" - _null_ ));
14861483
DESCR("get description for object id and catalog name");
14871484
DATA(insert OID = 1216 ( col_description PGNSP PGUID 14 f f t f s 2 25 "26 23" "select description from pg_description where objoid = $1 and classoid = \'pg_catalog.pg_class\'::regclass and objsubid = $2" - _null_ ));

src/include/utils/nabstime.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: nabstime.h,v 1.36 2002/06/20 20:29:53 momjian Exp $
10+
* $Id: nabstime.h,v 1.37 2002/09/01 00:58:07 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -152,7 +152,6 @@ extern Datum tintervalct(PG_FUNCTION_ARGS);
152152
extern Datum tintervalov(PG_FUNCTION_ARGS);
153153
extern Datum tintervalstart(PG_FUNCTION_ARGS);
154154
extern Datum tintervalend(PG_FUNCTION_ARGS);
155-
extern Datum int4reltime(PG_FUNCTION_ARGS);
156155
extern Datum timeofday(PG_FUNCTION_ARGS);
157156

158157
/* non-fmgr-callable support routines */

0 commit comments

Comments
 (0)