Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axze2-0000p7-DV for pgsql-hackers@arkaria.postgresql.org; Wed, 04 May 2016 16:27:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1axze1-00041o-RX for pgsql-hackers@arkaria.postgresql.org; Wed, 04 May 2016 16:27:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1axzcf-0002XT-Fp for pgsql-hackers@postgresql.org; Wed, 04 May 2016 16:26:01 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axzcc-0003Eq-7F for pgsql-hackers@postgresql.org; Wed, 04 May 2016 16:26:00 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 07A2A21C82D0; Wed, 4 May 2016 19:25:56 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4d6q4miG6zrV; Wed, 4 May 2016 19:25:53 +0300 (MSK) Received: from [192.168.27.50] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 04D4721C82C6; Wed, 4 May 2016 19:25:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1462379153; bh=1AAWfFM7zwoS5KgfO6SAcoUugzz3ONDZP5JOPIdNyxM=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=o/IsrrK2TpC2I8xxwH7qZpfapngSrKC+YWwHQlqnv6knz9TkqJrMEBpLr+zyoxNCK VZRh32wt1urES5u8LwPKDBmALwG+/KLQwZb/tIq9Egy++vvnv4gMIlOQzX8D5Pdi7a XGY2vLdq9vNBlUrClK+PIdNb6swFmQR3BFOLjfJc= Content-Type: multipart/mixed; boundary="Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C" Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Naming of new tsvector functions From: Stas Kelvich In-Reply-To: <4328.1462370302@sss.pgh.pa.us> Date: Wed, 4 May 2016 19:25:52 +0300 Cc: David Fetter , pgsql-hackers@postgresql.org Message-Id: <2AF3687B-2B6B-415C-978E-0991EFE9718B@postgrespro.ru> References: <4875.1462210058@sss.pgh.pa.us> <6106.1462211891@sss.pgh.pa.us> <20160502215907.GA1882@fetter.org> <4328.1462370302@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -4.1 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 04 May 2016, at 16:58, Tom Lane wrote: >=20 > Stas Kelvich writes: >>> On 03 May 2016, at 00:59, David Fetter wrote: >>> I suspect that steering that ship would be a good idea starting with >>> deprecation of the old name in 9.6, etc. hs_filter(), perhaps? >=20 >> In 9.5 there already were tsvector functions length(), numnode(), strip() >=20 >> Recent commit added setweight(), delete(), unnest(), tsvector_to_array()= , array_to_tsvector(), filter(). >=20 >> Last bunch can be painlessly renamed, for example to ts_setweight, ts_de= lete, ts_unnest, ts_filter. >=20 >> The question is what to do with old ones? Leave them as is? Rename to ts= _* and create aliases with deprecation warning? >=20 > The other ones are not so problematic because they do not conflict with > SQL keywords. It's only delete() and filter() that scare me. >=20 > regards, tom lane Okay, so changed functions to ts_setweight, ts_delete, ts_unnest, ts_filter. --Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C Content-Disposition: attachment; filename=tsvector_ops_rename.diff Content-Type: application/octet-stream; name="tsvector_ops_rename.diff" Content-Transfer-Encoding: 7bit diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index e1c3b48..5045c80 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -9252,26 +9252,26 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - setweight + ts_setweight - setweight(vector tsvector, weight "char") + ts_setweight(vector tsvector, weight "char") tsvector assign weight to each element of vector - setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A') + ts_setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A') 'cat':3A 'fat':2A,4A 'rat':5A - setweight - setweight for specific lexeme(s) + ts_setweight + ts_setweight for specific lexeme(s) - setweight(vector tsvector, weight "char", lexemes "text"[]) + ts_setweight(vector tsvector, weight "char", lexemes "text"[]) tsvector assign weight to elements of vector that are listed in lexemes array - setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}') + ts_setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}') 'cat':3A 'fat':2,4 'rat':5A @@ -9289,37 +9289,37 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - delete - delete lexeme(s) from tsvector + ts_delete + ts_delete lexeme(s) from tsvector - delete(vector tsvector, lexeme text) + ts_delete(vector tsvector, lexeme text) tsvector remove given lexeme from vector - delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') + ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') 'cat':3 'rat':5A - delete(vector tsvector, lexemes text[]) + ts_delete(vector tsvector, lexemes text[]) tsvector remove any occurrence of lexemes in lexemes array from vector - delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) + ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) 'cat':3 - unnest + ts_unnest for tsvector - unnest(tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text) + ts_unnest(tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text) setof record expand a tsvector to a set of rows - unnest('fat:2,4 cat:3 rat:5A'::tsvector) + ts_unnest('fat:2,4 cat:3 rat:5A'::tsvector) (cat,{3},{D}) ... @@ -9349,14 +9349,14 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - filter + ts_filter for tsvector - filter(vector tsvector, weights "char"[]) + ts_filter(vector tsvector, weights "char"[]) tsvector Select only elements with given weights from vector - filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') + ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') 'cat':3B 'rat':5A diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 021ba50..8ed1a22 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -4534,22 +4534,22 @@ DATA(insert OID = 3711 ( length PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 2 DESCR("number of lexemes"); DATA(insert OID = 3623 ( strip PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 3614 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_strip _null_ _null_ _null_ )); DESCR("strip position information"); -DATA(insert OID = 3624 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 18" _null_ _null_ _null_ _null_ _null_ tsvector_setweight _null_ _null_ _null_ )); +DATA(insert OID = 3624 ( ts_setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 18" _null_ _null_ _null_ _null_ _null_ tsvector_setweight _null_ _null_ _null_ )); DESCR("set given weight for whole tsvector"); -DATA(insert OID = 3320 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 3614 "3614 18 1009" _null_ _null_ _null_ _null_ _null_ tsvector_setweight_by_filter _null_ _null_ _null_ )); +DATA(insert OID = 3320 ( ts_setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 3614 "3614 18 1009" _null_ _null_ _null_ _null_ _null_ tsvector_setweight_by_filter _null_ _null_ _null_ )); DESCR("set given weight for given lexemes"); DATA(insert OID = 3625 ( tsvector_concat PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_concat _null_ _null_ _null_ )); -DATA(insert OID = 3321 ( delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 25" _null_ _null_ _null_ _null_ _null_ tsvector_delete_str _null_ _null_ _null_ )); +DATA(insert OID = 3321 ( ts_delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 25" _null_ _null_ _null_ _null_ _null_ tsvector_delete_str _null_ _null_ _null_ )); DESCR("delete lexeme"); -DATA(insert OID = 3323 ( delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1009" _null_ _null_ _null_ _null_ _null_ tsvector_delete_arr _null_ _null_ _null_ )); +DATA(insert OID = 3323 ( ts_delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1009" _null_ _null_ _null_ _null_ _null_ tsvector_delete_arr _null_ _null_ _null_ )); DESCR("delete given lexemes"); -DATA(insert OID = 3322 ( unnest PGNSP PGUID 12 1 10 0 0 f f f f t t i s 1 0 2249 "3614" "{3614,25,1005,1009}" "{i,o,o,o}" "{tsvector,lexeme,positions,weights}" _null_ _null_ tsvector_unnest _null_ _null_ _null_ )); +DATA(insert OID = 3322 ( ts_unnest PGNSP PGUID 12 1 10 0 0 f f f f t t i s 1 0 2249 "3614" "{3614,25,1005,1009}" "{i,o,o,o}" "{tsvector,lexeme,positions,weights}" _null_ _null_ tsvector_unnest _null_ _null_ _null_ )); DESCR("expand tsvector to set of rows"); DATA(insert OID = 3326 ( tsvector_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 1009 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_to_array _null_ _null_ _null_ )); DESCR("convert to lexeme's array"); DATA(insert OID = 3327 ( array_to_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 3614 "1009" _null_ _null_ _null_ _null_ _null_ array_to_tsvector _null_ _null_ _null_ )); DESCR("build tsvector from lexeme's array"); -DATA(insert OID = 3319 ( filter PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1002" _null_ _null_ _null_ _null_ _null_ tsvector_filter _null_ _null_ _null_ )); +DATA(insert OID = 3319 ( ts_filter PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1002" _null_ _null_ _null_ _null_ _null_ tsvector_filter _null_ _null_ _null_ )); DESCR("returns tsvector that contain only postings with given weights"); DATA(insert OID = 3634 ( ts_match_vq PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_match_vq _null_ _null_ _null_ )); diff --git a/src/test/regress/expected/tstypes.out b/src/test/regress/expected/tstypes.out index c8ca062..c0bc723 100644 --- a/src/test/regress/expected/tstypes.out +++ b/src/test/regress/expected/tstypes.out @@ -979,76 +979,76 @@ SELECT strip('base hidden rebel spaceship strike'::tsvector); 'base' 'hidden' 'rebel' 'spaceship' 'strike' (1 row) -SELECT delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); - delete +SELECT ts_delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); + ts_delete ------------------------------------------ 'base':7 'hidden':6 'rebel':1 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); + ts_delete -------------------------------------------------------------- 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); + ts_delete ----------------------------------------------------------------------- 'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); + ts_delete ----------------------------------------------------------------------- 'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); + ts_delete ------------------------------------------ 'base':7 'hidden':6 'rebel':1 'strike':3 (1 row) -SELECT delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); - delete +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); + ts_delete ---------------------------------- 'base' 'hidden' 'rebel' 'strike' (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); + ts_delete -------------------------------- 'base':7 'hidden':6 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); + ts_delete ------------------------------------------------------------- 'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); + ts_delete ------------------------------------------------------------- 'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3 (1 row) -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); - delete +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); + ts_delete -------------------------------- 'base':7 'hidden':6 'strike':3 (1 row) -SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); - delete +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); + ts_delete -------------------------- 'base' 'hidden' 'strike' (1 row) -SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); ERROR: lexeme array may not contain nulls -SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); - unnest +SELECT ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); + ts_unnest --------------------------------------------- (base,{7},{D}) (hidden,{6},{D}) @@ -1057,8 +1057,8 @@ SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::ts (strike,{3},{D}) (5 rows) -SELECT unnest('base hidden rebel spaceship strike'::tsvector); - unnest +SELECT ts_unnest('base hidden rebel spaceship strike'::tsvector); + ts_unnest --------------- (base,,) (hidden,,) @@ -1067,7 +1067,7 @@ SELECT unnest('base hidden rebel spaceship strike'::tsvector); (strike,,) (5 rows) -SELECT * FROM unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT * FROM ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); lexeme | positions | weights -----------+-----------------+------------- base | {7} | {D} @@ -1077,7 +1077,7 @@ SELECT * FROM unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike strike | {3} | {D} (5 rows) -SELECT * FROM unnest('base hidden rebel spaceship strike'::tsvector); +SELECT * FROM ts_unnest('base hidden rebel spaceship strike'::tsvector); lexeme | positions | weights -----------+-----------+--------- base | | @@ -1087,7 +1087,7 @@ SELECT * FROM unnest('base hidden rebel spaceship strike'::tsvector); strike | | (5 rows) -SELECT lexeme, positions[1] from unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT lexeme, positions[1] from ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); lexeme | positions -----------+----------- base | 7 @@ -1117,55 +1117,55 @@ SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship','strike']); SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship', NULL]); ERROR: lexeme array may not contain nulls -SELECT setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); - setweight +SELECT ts_setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); + ts_setweight ---------------------------------------------------------- 'a':1C,3C 'asd':1C 'w':5C,6C,12C,13C 'zxc':81C,222C,567C (1 row) -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c'); - setweight +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c'); + ts_setweight ---------------------------------------------------------- 'a':1C,3C 'asd':1C 'w':5C,6C,12C,13C 'zxc':81C,222C,567C (1 row) -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); - setweight +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); + ts_setweight ------------------------------------------------------ 'a':1C,3C 'asd':1C 'w':5,6,12B,13A 'zxc':81,222A,567 (1 row) -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); - setweight +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); + ts_setweight ------------------------------------------------------ 'a':1C,3C 'asd':1C 'w':5,6,12B,13A 'zxc':81,222A,567 (1 row) -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a,zxc}'); - setweight +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a,zxc}'); + ts_setweight -------------------------------------------------------- 'a':1C,3C 'asd':1C 'w':5,6,12B,13A 'zxc':81C,222C,567C (1 row) -SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); - setweight +SELECT ts_setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); + ts_setweight --------------------------------- 'a' 'asd' 'w':5,6,12B,13A 'zxc' (1 row) -SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); +SELECT ts_setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); ERROR: lexeme array may not contain nulls -SELECT filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); - filter +SELECT ts_filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); + ts_filter ------------------------------------------------------------- 'base':7A 'hidden':6A 'rebel':1A 'spaceship':2A 'strike':3A (1 row) -SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a}'); - filter --------- +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a}'); + ts_filter +----------- (1 row) -SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); ERROR: weight array may not contain nulls diff --git a/src/test/regress/sql/tstypes.sql b/src/test/regress/sql/tstypes.sql index ecc71c8..927a42a 100644 --- a/src/test/regress/sql/tstypes.sql +++ b/src/test/regress/sql/tstypes.sql @@ -193,25 +193,25 @@ SELECT strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector); SELECT strip('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT strip('base hidden rebel spaceship strike'::tsvector); -SELECT delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); -SELECT delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); - -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); -SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); -SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); -SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); - -SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); -SELECT unnest('base hidden rebel spaceship strike'::tsvector); -SELECT * FROM unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); -SELECT * FROM unnest('base hidden rebel spaceship strike'::tsvector); -SELECT lexeme, positions[1] from unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT ts_delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); + +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); + +SELECT ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT ts_unnest('base hidden rebel spaceship strike'::tsvector); +SELECT * FROM ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT * FROM ts_unnest('base hidden rebel spaceship strike'::tsvector); +SELECT lexeme, positions[1] from ts_unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT tsvector_to_array('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT tsvector_to_array('base hidden rebel spaceship strike'::tsvector); @@ -219,14 +219,14 @@ SELECT tsvector_to_array('base hidden rebel spaceship strike'::tsvector); SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship','strike']); SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship', NULL]); -SELECT setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c'); -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); -SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a,zxc}'); -SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); -SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); - -SELECT filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); -SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a}'); -SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); +SELECT ts_setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c'); +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); +SELECT ts_setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a,zxc}'); +SELECT ts_setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); +SELECT ts_setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); + +SELECT ts_filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a}'); +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); --Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii -- Stas Kelvich Postgres Professional: http://www.postgrespro.com Russian Postgres Company --Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --Apple-Mail=_8C5DF15E-4D04-4AB7-BB93-5D21ED63CE3C--