aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>1998-11-17 14:36:51 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>1998-11-17 14:36:51 +0000
commit643c7beddfed0d56c6969acc9c521d022044e770 (patch)
tree5d5e07204fb0fd15760587536d46a52ce9030a4d /src/include
parent8d507c204b82b326ac15be2aaa5fbcf906b8d330 (diff)
downloadpostgresql-643c7beddfed0d56c6969acc9c521d022044e770.tar.gz
postgresql-643c7beddfed0d56c6969acc9c521d022044e770.zip
Add text<->float8 and text<->float4 conversion functions.
This will fix the problem reported by Jose' Soares when trying to cast a float to text.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/pg_proc.h49
-rw-r--r--src/include/utils/builtins.h6
2 files changed, 39 insertions, 16 deletions
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 291ae18951b..a53c2bc9789 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.83 1998/10/29 19:03:50 tgl Exp $
+ * $Id: pg_proc.h,v 1.84 1998/11/17 14:36:51 thomas Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -1067,16 +1067,14 @@ DESCR("convert");
DATA(insert OID = 819 ( text_int4 PGUID 11 f t f 1 f 23 "25" 100 0 0 100 foo bar));
DESCR("convert");
-DATA(insert OID = 849 ( textpos PGUID 11 f t f 2 f 23 "25 25" 100 0 1 0 foo bar ));
-DESCR("return position of substring");
-DATA(insert OID = 850 ( textlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
-DESCR("matches LIKE expression");
-DATA(insert OID = 851 ( textnlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
-DESCR("does not match LIKE expression");
-DATA(insert OID = 858 ( namelike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
-DESCR("matches LIKE expression");
-DATA(insert OID = 859 ( namenlike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
-DESCR("does not match LIKE expression");
+DATA(insert OID = 838 ( text_float8 PGUID 11 f t f 1 f 701 "25" 100 0 0 100 foo bar));
+DESCR("convert");
+DATA(insert OID = 839 ( text_float4 PGUID 11 f t f 1 f 700 "25" 100 0 0 100 foo bar));
+DESCR("convert");
+DATA(insert OID = 840 ( float8_text PGUID 11 f t f 1 f 25 "701" 100 0 0 100 foo bar));
+DESCR("convert");
+DATA(insert OID = 841 ( float4_text PGUID 11 f t f 1 f 25 "700" 100 0 0 100 foo bar));
+DESCR("convert");
DATA(insert OID = 846 ( cash_mul_flt4 PGUID 11 f t f 2 f 790 "790 700" 100 0 0 100 foo bar ));
DESCR("multiply");
@@ -1085,6 +1083,13 @@ DESCR("divide");
DATA(insert OID = 848 ( flt4_mul_cash PGUID 11 f t f 2 f 790 "700 790" 100 0 0 100 foo bar ));
DESCR("multiply");
+DATA(insert OID = 849 ( textpos PGUID 11 f t f 2 f 23 "25 25" 100 0 1 0 foo bar ));
+DESCR("return position of substring");
+DATA(insert OID = 850 ( textlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DESCR("matches LIKE expression");
+DATA(insert OID = 851 ( textnlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DESCR("does not match LIKE expression");
+
DATA(insert OID = 852 ( int48eq PGUID 11 f t f 2 f 16 "21 20" 100 0 0 100 foo bar ));
DESCR("equal");
DATA(insert OID = 853 ( int48ne PGUID 11 f t f 2 f 16 "21 20" 100 0 0 100 foo bar ));
@@ -1098,6 +1103,11 @@ DESCR("less-than-or-equal");
DATA(insert OID = 857 ( int48ge PGUID 11 f t f 2 f 16 "21 20" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equal");
+DATA(insert OID = 858 ( namelike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
+DESCR("matches LIKE expression");
+DATA(insert OID = 859 ( namenlike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
+DESCR("does not match LIKE expression");
+
DATA(insert OID = 860 ( char_bpchar PGUID 11 f t f 1 f 1042 "18" 100 0 0 100 foo bar ));
DESCR("convert to bpchar");
DATA(insert OID = 861 ( bpchar_char PGUID 11 f t f 1 f 18 "1042" 100 0 0 100 foo bar ));
@@ -1981,13 +1991,22 @@ DESCR("convert int8 to float8");
/* OIDS 1600 - 1699 */
DATA(insert OID = 1600 ( line PGUID 14 f t f 2 f 628 "600 600" 100 0 0 100 "select line_construct_pp($1, $2)" - ));
-DESCR("");
+DESCR("points to line");
DATA(insert OID = 1601 ( ishorizontal PGUID 14 f t f 1 f 16 "628" 100 0 0 100 "select line_horizontal($1)" - ));
-DESCR("");
+DESCR("is line horizontal?");
DATA(insert OID = 1602 ( isvertical PGUID 14 f t f 1 f 16 "628" 100 0 0 100 "select line_vertical($1)" - ));
-DESCR("");
+DESCR("is line vertical?");
DATA(insert OID = 1603 ( isparallel PGUID 14 f t f 2 f 16 "628 628" 100 0 0 100 "select line_parallel($1, $2)" - ));
-DESCR("");
+DESCR("are lines parallel?");
+
+DATA(insert OID = 1604 ( float8 PGUID 14 f t f 1 f 701 "25" 100 0 0 100 "select text_float8($1)" - ));
+DESCR("convert");
+DATA(insert OID = 1605 ( float4 PGUID 14 f t f 1 f 700 "25" 100 0 0 100 "select text_float4($1)" - ));
+DESCR("convert");
+DATA(insert OID = 1606 ( text PGUID 14 f t f 1 f 25 "701" 100 0 0 100 "select float8_text($1)" - ));
+DESCR("convert");
+DATA(insert OID = 1607 ( text PGUID 14 f t f 1 f 25 "700" 100 0 0 100 "select float4_text($1)" - ));
+DESCR("convert");
/* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */
DATA(insert OID = 868 ( strpos PGUID 14 f t f 2 f 23 "25 25" 100 0 0 100 "select textpos($1, $2)" - ));
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 288c9db46e9..f92cce66960 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.69 1998/10/29 18:07:09 momjian Exp $
+ * $Id: builtins.h,v 1.70 1998/11/17 14:36:37 thomas Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@@ -280,6 +280,10 @@ extern float32 i4tof(int32 num);
extern float32 i2tof(int16 num);
extern int32 ftoi4(float32 num);
extern int16 ftoi2(float32 num);
+extern float64 text_float8(text *str);
+extern float32 text_float4(text *str);
+extern text *float8_text(float64 num);
+extern text *float4_text(float32 num);
extern float64 dround(float64 arg1);
extern float64 dtrunc(float64 arg1);
extern float64 dsqrt(float64 arg1);