Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMaJO-0058wp-0g for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Dec 2024 22:08:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tMaJL-007PZe-6u for pgsql-hackers@arkaria.postgresql.org; Sat, 14 Dec 2024 22:08:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMaJK-007PYU-Rv for pgsql-hackers@lists.postgresql.org; Sat, 14 Dec 2024 22:08:32 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMaJE-002sEj-Cx for pgsql-hackers@lists.postgresql.org; Sat, 14 Dec 2024 22:08:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4BEM8JnH1493398; Sat, 14 Dec 2024 17:08:19 -0500 From: Tom Lane To: Ronan Dunklau cc: Michael Paquier , pgsql-hackers@lists.postgresql.org, Peter Eisentraut Subject: Re: Converting contrib SQL functions to new style In-reply-to: <1471865.1734212070@sss.pgh.pa.us> References: <3395418.1618352794@sss.pgh.pa.us> <2345099.ElGaqSPkdT@aivenlaptop> <1400205.1734199200@sss.pgh.pa.us> <1471865.1734212070@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 14 Dec 2024 16:34:30 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1493382.1734214090.0@sss.pgh.pa.us> Date: Sat, 14 Dec 2024 17:08:19 -0500 Message-ID: <1493397.1734214099@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1493382.1734214090.1@sss.pgh.pa.us> Here's the remaining two patches in the current set. This is just to pacify the cfbot: I've not done anything to them, just verified that they still apply and pass regression. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name*0="v4-0003-Use-new-style-SQL-function-in-citext-extension.patc"; name*1="h"; charset="us-ascii" Content-ID: <1493382.1734214090.2@sss.pgh.pa.us> Content-Description: v4-0003-Use-new-style-SQL-function-in-citext-extension.patch Content-Transfer-Encoding: quoted-printable From 9c5235cd123eeb55b95b8bfd281dfcc37df197c5 Mon Sep 17 00:00:00 2001 From: Ronan Dunklau Date: Mon, 28 Oct 2024 16:13:35 +0100 Subject: [PATCH v4 3/6] Use "new style" SQL function in citext extension Author: Tom Lane Discussion: https://www.postgresql.org/message-id/3395418.1618352794%40sss= .pgh.pa.us --- contrib/citext/Makefile | 1 + contrib/citext/citext--1.7--1.8.sql | 60 +++++++++++++++++++++++++++++ contrib/citext/citext.control | 2 +- contrib/citext/meson.build | 1 + 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 contrib/citext/citext--1.7--1.8.sql diff --git a/contrib/citext/Makefile b/contrib/citext/Makefile index b9b3713f537..fc990607bf2 100644 --- a/contrib/citext/Makefile +++ b/contrib/citext/Makefile @@ -4,6 +4,7 @@ MODULES =3D citext = EXTENSION =3D citext DATA =3D citext--1.4.sql \ + citext--1.7--1.8.sql \ citext--1.6--1.7.sql \ citext--1.5--1.6.sql \ citext--1.4--1.5.sql \ diff --git a/contrib/citext/citext--1.7--1.8.sql b/contrib/citext/citext--= 1.7--1.8.sql new file mode 100644 index 00000000000..7c95a9883aa --- /dev/null +++ b/contrib/citext/citext--1.7--1.8.sql @@ -0,0 +1,60 @@ +/* contrib/citext/citext--1.7--1.8.sql */ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION citext UPDATE TO '1.8'" to load this file. \qu= it + +CREATE OR REPLACE FUNCTION regexp_match(string citext, pattern citext) RE= TURNS TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_match( $1::pg_catalog.text, $2::pg_catalog.text,= 'i' ); + +CREATE OR REPLACE FUNCTION regexp_match(string citext, pattern citext, fl= ags text) RETURNS TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_match( $1::pg_catalog.text, $2::pg_catalog.text,= CASE WHEN pg_catalog.strpos($3, 'c') =3D 0 THEN $3 || 'i' ELSE $3 END ); + +CREATE OR REPLACE FUNCTION regexp_matches(string citext, pattern citext) = RETURNS SETOF TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE ROWS 1 +RETURN pg_catalog.regexp_matches( $1::pg_catalog.text, $2::pg_catalog.tex= t, 'i' ); + +CREATE OR REPLACE FUNCTION regexp_matches(string citext, pattern citext, = flags text) RETURNS SETOF TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE ROWS 10 +RETURN pg_catalog.regexp_matches( $1::pg_catalog.text, $2::pg_catalog.tex= t, CASE WHEN pg_catalog.strpos($3, 'c') =3D 0 THEN $3 || 'i' ELSE $3 END = ); + +CREATE OR REPLACE FUNCTION regexp_replace(string citext, pattern citext, = replacement text) returns TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_replace( $1::pg_catalog.text, $2::pg_catalog.tex= t, $3, 'i'); + +CREATE OR REPLACE FUNCTION regexp_replace(string citext, pattern citext, = replacement text, flags text) returns TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_replace( $1::pg_catalog.text, $2::pg_catalog.tex= t, $3, CASE WHEN pg_catalog.strpos($4, 'c') =3D 0 THEN $4 || 'i' ELSE $4 = END); + +CREATE OR REPLACE FUNCTION regexp_split_to_array(string citext, pattern c= itext) RETURNS TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_split_to_array( $1::pg_catalog.text, $2::pg_cata= log.text, 'i' ); + +CREATE OR REPLACE FUNCTION regexp_split_to_array(string citext, pattern c= itext, flags text) RETURNS TEXT[] +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_split_to_array( $1::pg_catalog.text, $2::pg_cata= log.text, CASE WHEN pg_catalog.strpos($3, 'c') =3D 0 THEN $3 || 'i' ELSE = $3 END ); + +CREATE OR REPLACE FUNCTION regexp_split_to_table(string citext, pattern c= itext) RETURNS SETOF TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_split_to_table( $1::pg_catalog.text, $2::pg_cata= log.text, 'i' ); + +CREATE OR REPLACE FUNCTION regexp_split_to_table(string citext, pattern c= itext, flags text) RETURNS SETOF TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_split_to_table( $1::pg_catalog.text, $2::pg_cata= log.text, CASE WHEN pg_catalog.strpos($3, 'c') =3D 0 THEN $3 || 'i' ELSE = $3 END ); + +CREATE OR REPLACE FUNCTION strpos( citext, citext ) RETURNS INT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.strpos( pg_catalog.lower( $1::pg_catalog.text ), pg_cat= alog.lower( $2::pg_catalog.text ) ); + +CREATE OR REPLACE FUNCTION replace( citext, citext, citext ) RETURNS TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.regexp_replace( $1::pg_catalog.text, pg_catalog.regexp_= replace($2::pg_catalog.text, '([^a-zA-Z_0-9])', E'\\\\\\1', 'g'), $3::pg_c= atalog.text, 'gi' ); + +CREATE OR REPLACE FUNCTION split_part( citext, citext, int ) RETURNS TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN (pg_catalog.regexp_split_to_array( $1::pg_catalog.text, pg_catalog= .regexp_replace($2::pg_catalog.text, '([^a-zA-Z_0-9])', E'\\\\\\1', 'g'), = 'i'))[$3]; + +CREATE OR REPLACE FUNCTION translate( citext, citext, text ) RETURNS TEXT +LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE +RETURN pg_catalog.translate( pg_catalog.translate( $1::pg_catalog.text, p= g_catalog.lower($2::pg_catalog.text), $3), pg_catalog.upper($2::pg_catalog= .text), $3); diff --git a/contrib/citext/citext.control b/contrib/citext/citext.control index f82265b3347..2b0f3fa8407 100644 --- a/contrib/citext/citext.control +++ b/contrib/citext/citext.control @@ -1,6 +1,6 @@ # citext extension comment =3D 'data type for case-insensitive character strings' -default_version =3D '1.7' +default_version =3D '1.8' module_pathname =3D '$libdir/citext' relocatable =3D true trusted =3D true diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build index 40cdd0d2f18..ae87445e6a4 100644 --- a/contrib/citext/meson.build +++ b/contrib/citext/meson.build @@ -26,6 +26,7 @@ install_data( 'citext--1.4--1.5.sql', 'citext--1.5--1.6.sql', 'citext--1.6--1.7.sql', + 'citext--1.7--1.8.sql', kwargs: contrib_data_args, ) = -- = 2.47.0 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v4-0005-Use-new-style-SQL-function-in-xml2-extension.patch"; charset="us-ascii" Content-ID: <1493382.1734214090.3@sss.pgh.pa.us> Content-Description: v4-0005-Use-new-style-SQL-function-in-xml2-extension.patch Content-Transfer-Encoding: quoted-printable From ca3f87189eaf060a91486b5d2167930ecdf7b541 Mon Sep 17 00:00:00 2001 From: Ronan Dunklau Date: Mon, 28 Oct 2024 16:25:52 +0100 Subject: [PATCH v4 5/6] Use "new style" SQL function in xml2 extension Author: Tom Lane Discussion: https://www.postgresql.org/message-id/3395418.1618352794%40sss= .pgh.pa.us --- contrib/xml2/Makefile | 4 +++- contrib/xml2/meson.build | 1 + contrib/xml2/xml2--1.1--1.2.sql | 18 ++++++++++++++++++ contrib/xml2/xml2.control | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 contrib/xml2/xml2--1.1--1.2.sql diff --git a/contrib/xml2/Makefile b/contrib/xml2/Makefile index 0d703fe0e8f..8597e9aa9c5 100644 --- a/contrib/xml2/Makefile +++ b/contrib/xml2/Makefile @@ -7,7 +7,9 @@ OBJS =3D \ xslt_proc.o = EXTENSION =3D xml2 -DATA =3D xml2--1.1.sql xml2--1.0--1.1.sql +DATA =3D xml2--1.1.sql \ + xml2--1.1--1.2.sql \ + xml2--1.0--1.1.sql PGFILEDESC =3D "xml2 - XPath querying and XSLT" = REGRESS =3D xml2 diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build index 5e80e17f824..32d9ab53cbd 100644 --- a/contrib/xml2/meson.build +++ b/contrib/xml2/meson.build @@ -27,6 +27,7 @@ contrib_targets +=3D xml2 install_data( 'xml2--1.0--1.1.sql', 'xml2--1.1.sql', + 'xml2--1.1--1.2.sql', 'xml2.control', kwargs: contrib_data_args, ) diff --git a/contrib/xml2/xml2--1.1--1.2.sql b/contrib/xml2/xml2--1.1--1.2= .sql new file mode 100644 index 00000000000..12d00064e8f --- /dev/null +++ b/contrib/xml2/xml2--1.1--1.2.sql @@ -0,0 +1,18 @@ +/* contrib/xml2/xml2--1.1--1.2.sql */ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION xml2 UPDATE TO '1.2'" to load this file. \quit + +CREATE OR REPLACE FUNCTION xpath_list(text,text) RETURNS text +LANGUAGE SQL STRICT IMMUTABLE PARALLEL SAFE +RETURN xpath_list($1,$2,','); + +CREATE OR REPLACE FUNCTION xpath_nodeset(text,text) +RETURNS text +LANGUAGE SQL STRICT IMMUTABLE PARALLEL SAFE +RETURN xpath_nodeset($1,$2,'',''); + +CREATE OR REPLACE FUNCTION xpath_nodeset(text,text,text) +RETURNS text +LANGUAGE SQL STRICT IMMUTABLE PARALLEL SAFE +RETURN xpath_nodeset($1,$2,'',$3); diff --git a/contrib/xml2/xml2.control b/contrib/xml2/xml2.control index ba2c0599a37..b32156c949e 100644 --- a/contrib/xml2/xml2.control +++ b/contrib/xml2/xml2.control @@ -1,6 +1,6 @@ # xml2 extension comment =3D 'XPath querying and XSLT' -default_version =3D '1.1' +default_version =3D '1.2' module_pathname =3D '$libdir/pgxml' # XXX do we still need this to be non-relocatable? relocatable =3D false -- = 2.47.0 ------- =_aaaaaaaaaa0--