diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 6ffde9e529..054d495a92 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -1899,14 +1899,14 @@ PostgreSQL documentation - split(string text, + split_part(string text, delimiter text, column integer) text Split string on delimiter returning the resulting (one based) column number. - split('abc~@~def~@~ghi','~@~',2) + split_part('abc~@~def~@~ghi','~@~',2) def diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 6e351df041..ff2200d2cc 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.270 2002/09/04 20:31:38 momjian Exp $ + * $Id: pg_proc.h,v 1.271 2002/09/12 00:21:24 momjian Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -2130,7 +2130,7 @@ DATA(insert OID = 937 ( substring PGNSP PGUID 12 f f t f i 2 25 "25 23" tex DESCR("return portion of string"); DATA(insert OID = 2087 ( replace PGNSP PGUID 12 f f t f i 3 25 "25 25 25" replace_text - _null_ )); DESCR("replace all occurrences of old_substr with new_substr in string"); -DATA(insert OID = 2088 ( split PGNSP PGUID 12 f f t f i 3 25 "25 25 23" split_text - _null_ )); +DATA(insert OID = 2088 ( split_part PGNSP PGUID 12 f f t f i 3 25 "25 25 23" split_text - _null_ )); DESCR("split string by field_sep and return field_num"); DATA(insert OID = 2089 ( to_hex PGNSP PGUID 12 f f t f i 1 25 "23" to_hex32 - _null_ )); DESCR("convert int32 number to hex"); diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out index ae0b48590c..ce81969936 100644 --- a/src/test/regress/expected/strings.out +++ b/src/test/regress/expected/strings.out @@ -719,29 +719,29 @@ SELECT replace('yabadoo', 'bad', '') AS "yaoo"; (1 row) -- --- test split +-- test split_part -- -select split('joeuser@mydatabase','@',0) AS "an error"; +select split_part('joeuser@mydatabase','@',0) AS "an error"; ERROR: field position must be > 0 -select split('joeuser@mydatabase','@',1) AS "joeuser"; +select split_part('joeuser@mydatabase','@',1) AS "joeuser"; joeuser --------- joeuser (1 row) -select split('joeuser@mydatabase','@',2) AS "mydatabase"; +select split_part('joeuser@mydatabase','@',2) AS "mydatabase"; mydatabase ------------ mydatabase (1 row) -select split('joeuser@mydatabase','@',3) AS "empty string"; +select split_part('joeuser@mydatabase','@',3) AS "empty string"; empty string -------------- (1 row) -select split('@joeuser@mydatabase@','@',2) AS "joeuser"; +select split_part('@joeuser@mydatabase@','@',2) AS "joeuser"; joeuser --------- joeuser diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql index 2095848a39..692233793d 100644 --- a/src/test/regress/sql/strings.sql +++ b/src/test/regress/sql/strings.sql @@ -288,17 +288,17 @@ SELECT replace('yabadabadoo', 'ba', '123') AS "ya123da123doo"; SELECT replace('yabadoo', 'bad', '') AS "yaoo"; -- --- test split +-- test split_part -- -select split('joeuser@mydatabase','@',0) AS "an error"; +select split_part('joeuser@mydatabase','@',0) AS "an error"; -select split('joeuser@mydatabase','@',1) AS "joeuser"; +select split_part('joeuser@mydatabase','@',1) AS "joeuser"; -select split('joeuser@mydatabase','@',2) AS "mydatabase"; +select split_part('joeuser@mydatabase','@',2) AS "mydatabase"; -select split('joeuser@mydatabase','@',3) AS "empty string"; +select split_part('joeuser@mydatabase','@',3) AS "empty string"; -select split('@joeuser@mydatabase@','@',2) AS "joeuser"; +select split_part('@joeuser@mydatabase@','@',2) AS "joeuser"; -- -- test to_hex