aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-05-23 22:33:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-05-23 22:33:23 +0000
commit11d5c82002a07827cc8896e34ea0d1b6cdb93e49 (patch)
tree8ec7a8e3ca50712b30384506e6b2dec293ff9a29 /src/include
parent78d21560660dd1e6cb4850ab2735caaf8527e8b4 (diff)
downloadpostgresql-11d5c82002a07827cc8896e34ea0d1b6cdb93e49.tar.gz
postgresql-11d5c82002a07827cc8896e34ea0d1b6cdb93e49.zip
Improve implementation of btrim/ltrim/rtrim: provide a special case for
single-byte encodings, and a direct C implementation of the single-argument forms (where spaces are always what gets trimmed). This is in preparation for using rtrim1() as the bpchar-to-text cast operator, but is a useful performance improvement even if we decide not to do that.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_proc.h20
-rw-r--r--src/include/utils/builtins.h5
3 files changed, 16 insertions, 13 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 5accd1dc5cc..c7848af9f62 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.194 2003/05/15 15:50:19 petere Exp $
+ * $Id: catversion.h,v 1.195 2003/05/23 22:33:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200305151
+#define CATALOG_VERSION_NO 200305231
#endif
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index f53af27f44f..f2f3e3eff14 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.300 2003/05/15 15:50:19 petere Exp $
+ * $Id: pg_proc.h,v 1.301 2003/05/23 22:33:22 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2134,9 +2134,9 @@ DESCR("left-pad string to length");
DATA(insert OID = 874 ( rpad PGNSP PGUID 12 f f t f i 3 25 "25 23 25" rpad - _null_ ));
DESCR("right-pad string to length");
DATA(insert OID = 875 ( ltrim PGNSP PGUID 12 f f t f i 2 25 "25 25" ltrim - _null_ ));
-DESCR("left-pad string to length");
+DESCR("trim selected characters from left end of string");
DATA(insert OID = 876 ( rtrim PGNSP PGUID 12 f f t f i 2 25 "25 25" rtrim - _null_ ));
-DESCR("right-pad string to length");
+DESCR("trim selected characters from right end of string");
DATA(insert OID = 877 ( substr PGNSP PGUID 12 f f t f i 3 25 "25 23 23" text_substr - _null_ ));
DESCR("return portion of string");
DATA(insert OID = 878 ( translate PGNSP PGUID 12 f f t f i 3 25 "25 25 25" translate - _null_ ));
@@ -2145,16 +2145,16 @@ DATA(insert OID = 879 ( lpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select
DESCR("left-pad string to length");
DATA(insert OID = 880 ( rpad PGNSP PGUID 14 f f t f i 2 25 "25 23" "select rpad($1, $2, \' \')" - _null_ ));
DESCR("right-pad string to length");
-DATA(insert OID = 881 ( ltrim PGNSP PGUID 14 f f t f i 1 25 "25" "select ltrim($1, \' \')" - _null_ ));
-DESCR("remove initial characters from string");
-DATA(insert OID = 882 ( rtrim PGNSP PGUID 14 f f t f i 1 25 "25" "select rtrim($1, \' \')" - _null_ ));
-DESCR("remove trailing characters from string");
+DATA(insert OID = 881 ( ltrim PGNSP PGUID 12 f f t f i 1 25 "25" ltrim1 - _null_ ));
+DESCR("trim spaces from left end of string");
+DATA(insert OID = 882 ( rtrim PGNSP PGUID 12 f f t f i 1 25 "25" rtrim1 - _null_ ));
+DESCR("trim spaces from right end of string");
DATA(insert OID = 883 ( substr PGNSP PGUID 12 f f t f i 2 25 "25 23" text_substr_no_len - _null_ ));
DESCR("return portion of string");
DATA(insert OID = 884 ( btrim PGNSP PGUID 12 f f t f i 2 25 "25 25" btrim - _null_ ));
-DESCR("trim both ends of string");
-DATA(insert OID = 885 ( btrim PGNSP PGUID 14 f f t f i 1 25 "25" "select btrim($1, \' \')" - _null_ ));
-DESCR("trim both ends of string");
+DESCR("trim selected characters from both ends of string");
+DATA(insert OID = 885 ( btrim PGNSP PGUID 12 f f t f i 1 25 "25" btrim1 - _null_ ));
+DESCR("trim spaces from both ends of string");
DATA(insert OID = 936 ( substring PGNSP PGUID 12 f f t f i 3 25 "25 23 23" text_substr - _null_ ));
DESCR("return portion of string");
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 9620483f2c2..539dfbc9de7 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.217 2003/05/15 15:50:20 petere Exp $
+ * $Id: builtins.h,v 1.218 2003/05/23 22:33:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -608,9 +608,12 @@ extern Datum initcap(PG_FUNCTION_ARGS);
extern Datum lpad(PG_FUNCTION_ARGS);
extern Datum rpad(PG_FUNCTION_ARGS);
extern Datum btrim(PG_FUNCTION_ARGS);
+extern Datum btrim1(PG_FUNCTION_ARGS);
extern Datum byteatrim(PG_FUNCTION_ARGS);
extern Datum ltrim(PG_FUNCTION_ARGS);
+extern Datum ltrim1(PG_FUNCTION_ARGS);
extern Datum rtrim(PG_FUNCTION_ARGS);
+extern Datum rtrim1(PG_FUNCTION_ARGS);
extern Datum translate(PG_FUNCTION_ARGS);
extern Datum chr(PG_FUNCTION_ARGS);
extern Datum repeat(PG_FUNCTION_ARGS);