public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] remove deprecated v8.2 containment operators
58+ messages / 4 participants
[nested] [flat]
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277
684ad6a92fcc33adebdab65c4e7d72a68ba05408
---
contrib/cube/cube.c | 4 --
contrib/hstore/hstore.h | 1 -
contrib/hstore/hstore_gist.c | 3 +-
contrib/intarray/_int_gin.c | 4 --
contrib/intarray/_int_gist.c | 2 -
contrib/intarray/_intbig_gist.c | 2 -
contrib/intarray/intarray--1.2.sql | 6 --
contrib/intarray/intarray--1.3--1.4.sql | 7 ---
contrib/seg/seg.c | 4 --
doc/src/sgml/cube.sgml | 8 ---
doc/src/sgml/func.sgml | 9 ---
doc/src/sgml/hstore.sgml | 10 ----
doc/src/sgml/intarray.sgml | 8 ---
doc/src/sgml/seg.sgml | 8 ---
src/backend/access/brin/brin_inclusion.c | 2 -
src/backend/access/gist/gistproc.c | 4 --
src/include/access/stratnum.h | 2 -
src/include/catalog/pg_amop.dat | 16 ------
src/include/catalog/pg_operator.dat | 65 ----------------------
src/test/regress/expected/create_am.out | 12 ++--
src/test/regress/expected/create_index.out | 24 ++++----
src/test/regress/expected/opr_sanity.out | 7 +--
src/test/regress/sql/create_am.sql | 6 +-
src/test/regress/sql/create_index.sql | 12 ++--
24 files changed, 28 insertions(+), 198 deletions(-)
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 6f810b26c5..57b89d91b8 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -634,11 +634,9 @@ g_cube_leaf_consistent(NDBOX *key,
retval = (cube_cmp_v0(key, query) == 0);
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = cube_contains_v0(key, query);
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval = cube_contains_v0(query, key);
break;
default:
@@ -661,11 +659,9 @@ g_cube_internal_consistent(NDBOX *key,
break;
case RTSameStrategyNumber:
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = (bool) cube_contains_v0(key, query);
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval = (bool) cube_overlap_v0(key, query);
break;
default:
diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h
index bf4a565ed9..8713a22dcc 100644
--- a/contrib/hstore/hstore.h
+++ b/contrib/hstore/hstore.h
@@ -181,7 +181,6 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs);
#define HStoreExistsStrategyNumber 9
#define HStoreExistsAnyStrategyNumber 10
#define HStoreExistsAllStrategyNumber 11
-#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */
/*
* defining HSTORE_POLLUTE_NAMESPACE=0 will prevent use of old function names;
diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c
index 102c9cea72..10c9906fa5 100644
--- a/contrib/hstore/hstore_gist.c
+++ b/contrib/hstore/hstore_gist.c
@@ -517,8 +517,7 @@ ghstore_consistent(PG_FUNCTION_ARGS)
sign = GETSIGN(entry);
- if (strategy == HStoreContainsStrategyNumber ||
- strategy == HStoreOldContainsStrategyNumber)
+ if (strategy == HStoreContainsStrategyNumber)
{
HStore *query = PG_GETARG_HSTORE_P(1);
HEntry *qe = ARRPTR(query);
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index b7958d8eca..72cfbc2fd7 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -78,7 +78,6 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
*searchMode = GIN_SEARCH_MODE_DEFAULT;
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
/* empty set is contained in everything */
*searchMode = GIN_SEARCH_MODE_INCLUDE_EMPTY;
break;
@@ -89,7 +88,6 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
*searchMode = GIN_SEARCH_MODE_INCLUDE_EMPTY;
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
if (*nentries > 0)
*searchMode = GIN_SEARCH_MODE_DEFAULT;
else /* everything contains the empty set */
@@ -127,7 +125,6 @@ ginint4_consistent(PG_FUNCTION_ARGS)
res = true;
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
/* we will need recheck */
*recheck = true;
/* at least one element in check[] is true, so result = true */
@@ -148,7 +145,6 @@ ginint4_consistent(PG_FUNCTION_ARGS)
}
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
/* result is not lossy */
*recheck = false;
/* Must have all elements in check[] true */
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index f1817a6cce..e0535d9934 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -87,12 +87,10 @@ g_int_consistent(PG_FUNCTION_ARGS)
query);
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
query);
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
/*
* This code is unreachable as of intarray 1.4, because the <@
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c
index 18ecd8cda6..56a77d8053 100644
--- a/contrib/intarray/_intbig_gist.c
+++ b/contrib/intarray/_intbig_gist.c
@@ -527,12 +527,10 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
query, siglen);
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = _intbig_contains((GISTTYPE *) DatumGetPointer(entry->key),
query, siglen);
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
/*
* This code is unreachable as of intarray 1.4, because the <@
diff --git a/contrib/intarray/intarray--1.2.sql b/contrib/intarray/intarray--1.2.sql
index f10b53db1c..4d2c86b818 100644
--- a/contrib/intarray/intarray--1.2.sql
+++ b/contrib/intarray/intarray--1.2.sql
@@ -402,8 +402,6 @@ DEFAULT FOR TYPE _int4 USING gist AS
OPERATOR 6 = (anyarray, anyarray),
OPERATOR 7 @>,
OPERATOR 8 <@,
- OPERATOR 13 @,
- OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 g_int_consistent (internal, _int4, smallint, oid, internal),
FUNCTION 2 g_int_union (internal, internal),
@@ -479,8 +477,6 @@ AS
OPERATOR 6 = (anyarray, anyarray),
OPERATOR 7 @>,
OPERATOR 8 <@,
- OPERATOR 13 @,
- OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 g_intbig_consistent (internal, _int4, smallint, oid, internal),
FUNCTION 2 g_intbig_union (internal, internal),
@@ -510,8 +506,6 @@ AS
OPERATOR 6 = (anyarray, anyarray),
OPERATOR 7 @>,
OPERATOR 8 <@,
- OPERATOR 13 @,
- OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 btint4cmp (int4, int4),
FUNCTION 2 ginarrayextract (anyarray, internal, internal),
diff --git a/contrib/intarray/intarray--1.3--1.4.sql b/contrib/intarray/intarray--1.3--1.4.sql
index 3fbebb5417..7669529e8a 100644
--- a/contrib/intarray/intarray--1.3--1.4.sql
+++ b/contrib/intarray/intarray--1.3--1.4.sql
@@ -12,10 +12,3 @@ DROP OPERATOR 8 (_int4, _int4);
ALTER OPERATOR FAMILY gist__intbig_ops USING gist
DROP OPERATOR 8 (_int4, _int4);
--- Likewise for the old spelling ~.
-
-ALTER OPERATOR FAMILY gist__int_ops USING gist
-DROP OPERATOR 14 (_int4, _int4);
-
-ALTER OPERATOR FAMILY gist__intbig_ops USING gist
-DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c
index 4a8e2be329..91c7231779 100644
--- a/contrib/seg/seg.c
+++ b/contrib/seg/seg.c
@@ -457,11 +457,9 @@ gseg_leaf_consistent(Datum key, Datum query, StrategyNumber strategy)
retval = DirectFunctionCall2(seg_same, key, query);
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = DirectFunctionCall2(seg_contains, key, query);
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval = DirectFunctionCall2(seg_contained, key, query);
break;
default:
@@ -504,12 +502,10 @@ gseg_internal_consistent(Datum key, Datum query, StrategyNumber strategy)
break;
case RTSameStrategyNumber:
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval =
DatumGetBool(DirectFunctionCall2(seg_contains, key, query));
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval =
DatumGetBool(DirectFunctionCall2(seg_overlap, key, query));
break;
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3b39147d14..1053f45437 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 54d7e51083..4cff809bdc 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10886,15 +10886,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
</para>
</caution>
- <note>
- <para>
- Before <productname>PostgreSQL</productname> 8.2, the containment
- operators <literal>@></literal> and <literal><@</literal> were respectively
- called <literal>~</literal> and <literal>@</literal>. These names are still
- available, but are deprecated and will eventually be removed.
- </para>
- </note>
-
<table id="functions-geometry-func-table">
<title>Geometric Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index 14a36ade00..5fa012a6b5 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/src/backend/access/brin/brin_inclusion.c b/src/backend/access/brin/brin_inclusion.c
index 7e380d66ed..986f76bd9b 100644
--- a/src/backend/access/brin/brin_inclusion.c
+++ b/src/backend/access/brin/brin_inclusion.c
@@ -378,7 +378,6 @@ brin_inclusion_consistent(PG_FUNCTION_ARGS)
case RTOverlapStrategyNumber:
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
case RTContainsElemStrategyNumber:
case RTSubStrategyNumber:
case RTSubEqualStrategyNumber:
@@ -399,7 +398,6 @@ brin_inclusion_consistent(PG_FUNCTION_ARGS)
*/
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
case RTSuperStrategyNumber:
case RTSuperEqualStrategyNumber:
finfo = inclusion_get_strategy_procinfo(bdesc, attno, subtype,
diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c
index 27d9c0f77c..b03c4b55a0 100644
--- a/src/backend/access/gist/gistproc.c
+++ b/src/backend/access/gist/gistproc.c
@@ -907,13 +907,11 @@ gist_box_leaf_consistent(BOX *key, BOX *query, StrategyNumber strategy)
PointerGetDatum(query)));
break;
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_contain,
PointerGetDatum(key),
PointerGetDatum(query)));
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_contained,
PointerGetDatum(key),
PointerGetDatum(query)));
@@ -990,13 +988,11 @@ rtree_internal_consistent(BOX *key, BOX *query, StrategyNumber strategy)
break;
case RTSameStrategyNumber:
case RTContainsStrategyNumber:
- case RTOldContainsStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_contain,
PointerGetDatum(key),
PointerGetDatum(query)));
break;
case RTContainedByStrategyNumber:
- case RTOldContainedByStrategyNumber:
retval = DatumGetBool(DirectFunctionCall2(box_overlap,
PointerGetDatum(key),
PointerGetDatum(query)));
diff --git a/src/include/access/stratnum.h b/src/include/access/stratnum.h
index d280f7e4fc..1929942bea 100644
--- a/src/include/access/stratnum.h
+++ b/src/include/access/stratnum.h
@@ -60,8 +60,6 @@ typedef uint16 StrategyNumber;
#define RTBelowStrategyNumber 10 /* for <<| */
#define RTAboveStrategyNumber 11 /* for |>> */
#define RTOverAboveStrategyNumber 12 /* for |&> */
-#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */
-#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */
#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */
#define RTContainsElemStrategyNumber 16 /* for range types @> elem */
#define RTAdjacentStrategyNumber 17 /* for -|- */
diff --git a/src/include/catalog/pg_amop.dat b/src/include/catalog/pg_amop.dat
index 1dfb6fd373..ad02cfda76 100644
--- a/src/include/catalog/pg_amop.dat
+++ b/src/include/catalog/pg_amop.dat
@@ -1100,10 +1100,6 @@
amopstrategy => '11', amopopr => '|>>(box,box)', amopmethod => 'gist' },
{ amopfamily => 'gist/box_ops', amoplefttype => 'box', amoprighttype => 'box',
amopstrategy => '12', amopopr => '|&>(box,box)', amopmethod => 'gist' },
-{ amopfamily => 'gist/box_ops', amoplefttype => 'box', amoprighttype => 'box',
- amopstrategy => '13', amopopr => '~(box,box)', amopmethod => 'gist' },
-{ amopfamily => 'gist/box_ops', amoplefttype => 'box', amoprighttype => 'box',
- amopstrategy => '14', amopopr => '@(box,box)', amopmethod => 'gist' },
{ amopfamily => 'gist/box_ops', amoplefttype => 'box', amoprighttype => 'point',
amopstrategy => '15', amoppurpose => 'o', amopopr => '<->(box,point)',
amopmethod => 'gist', amopsortfamily => 'btree/float_ops' },
@@ -1175,12 +1171,6 @@
{ amopfamily => 'gist/poly_ops', amoplefttype => 'polygon',
amoprighttype => 'polygon', amopstrategy => '12',
amopopr => '|&>(polygon,polygon)', amopmethod => 'gist' },
-{ amopfamily => 'gist/poly_ops', amoplefttype => 'polygon',
- amoprighttype => 'polygon', amopstrategy => '13',
- amopopr => '~(polygon,polygon)', amopmethod => 'gist' },
-{ amopfamily => 'gist/poly_ops', amoplefttype => 'polygon',
- amoprighttype => 'polygon', amopstrategy => '14',
- amopopr => '@(polygon,polygon)', amopmethod => 'gist' },
{ amopfamily => 'gist/poly_ops', amoplefttype => 'polygon',
amoprighttype => 'point', amopstrategy => '15', amoppurpose => 'o',
amopopr => '<->(polygon,point)', amopmethod => 'gist',
@@ -1223,12 +1213,6 @@
{ amopfamily => 'gist/circle_ops', amoplefttype => 'circle',
amoprighttype => 'circle', amopstrategy => '12',
amopopr => '|&>(circle,circle)', amopmethod => 'gist' },
-{ amopfamily => 'gist/circle_ops', amoplefttype => 'circle',
- amoprighttype => 'circle', amopstrategy => '13',
- amopopr => '~(circle,circle)', amopmethod => 'gist' },
-{ amopfamily => 'gist/circle_ops', amoplefttype => 'circle',
- amoprighttype => 'circle', amopstrategy => '14',
- amopopr => '@(circle,circle)', amopmethod => 'gist' },
{ amopfamily => 'gist/circle_ops', amoplefttype => 'circle',
amoprighttype => 'point', amopstrategy => '15', amoppurpose => 'o',
amopopr => '<->(circle,point)', amopmethod => 'gist',
diff --git a/src/include/catalog/pg_operator.dat b/src/include/catalog/pg_operator.dat
index 7cc812adda..feb8edece5 100644
--- a/src/include/catalog/pg_operator.dat
+++ b/src/include/catalog/pg_operator.dat
@@ -2777,71 +2777,6 @@
oprname => '||', oprleft => 'anynonarray', oprright => 'text',
oprresult => 'text', oprcode => 'anytextcat' },
-# obsolete names for contains/contained-by operators; remove these someday
-{ oid => '2860', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'polygon', oprright => 'polygon',
- oprresult => 'bool', oprcom => '~(polygon,polygon)',
- oprcode => 'poly_contained', oprrest => 'contsel', oprjoin => 'contjoinsel' },
-{ oid => '2861', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'polygon', oprright => 'polygon',
- oprresult => 'bool', oprcom => '@(polygon,polygon)',
- oprcode => 'poly_contain', oprrest => 'contsel', oprjoin => 'contjoinsel' },
-{ oid => '2862', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'box', oprright => 'box', oprresult => 'bool',
- oprcom => '~(box,box)', oprcode => 'box_contained', oprrest => 'contsel',
- oprjoin => 'contjoinsel' },
-{ oid => '2863', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'box', oprright => 'box', oprresult => 'bool',
- oprcom => '@(box,box)', oprcode => 'box_contain', oprrest => 'contsel',
- oprjoin => 'contjoinsel' },
-{ oid => '2864', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'circle', oprright => 'circle',
- oprresult => 'bool', oprcom => '~(circle,circle)',
- oprcode => 'circle_contained', oprrest => 'contsel',
- oprjoin => 'contjoinsel' },
-{ oid => '2865', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'circle', oprright => 'circle',
- oprresult => 'bool', oprcom => '@(circle,circle)',
- oprcode => 'circle_contain', oprrest => 'contsel', oprjoin => 'contjoinsel' },
-{ oid => '2866', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'box', oprresult => 'bool',
- oprcode => 'on_pb' },
-{ oid => '2867', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'path', oprresult => 'bool',
- oprcom => '~(path,point)', oprcode => 'on_ppath' },
-{ oid => '2868', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'path', oprright => 'point', oprresult => 'bool',
- oprcom => '@(point,path)', oprcode => 'path_contain_pt' },
-{ oid => '2869', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'polygon',
- oprresult => 'bool', oprcom => '~(polygon,point)',
- oprcode => 'pt_contained_poly' },
-{ oid => '2870', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'polygon', oprright => 'point',
- oprresult => 'bool', oprcom => '@(point,polygon)',
- oprcode => 'poly_contain_pt' },
-{ oid => '2871', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'circle', oprresult => 'bool',
- oprcom => '~(circle,point)', oprcode => 'pt_contained_circle' },
-{ oid => '2872', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => 'circle', oprright => 'point', oprresult => 'bool',
- oprcom => '@(point,circle)', oprcode => 'circle_contain_pt' },
-{ oid => '2873', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'line', oprresult => 'bool',
- oprcode => 'on_pl' },
-{ oid => '2874', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'point', oprright => 'lseg', oprresult => 'bool',
- oprcode => 'on_ps' },
-{ oid => '2875', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'lseg', oprright => 'line', oprresult => 'bool',
- oprcode => 'on_sl' },
-{ oid => '2876', descr => 'deprecated, use <@ instead',
- oprname => '@', oprleft => 'lseg', oprright => 'box', oprresult => 'bool',
- oprcode => 'on_sb' },
-{ oid => '2877', descr => 'deprecated, use @> instead',
- oprname => '~', oprleft => '_aclitem', oprright => 'aclitem',
- oprresult => 'bool', oprcode => 'aclcontains' },
-
# uuid operators
{ oid => '2972', descr => 'equal',
oprname => '=', oprcanmerge => 't', oprcanhash => 't', oprleft => 'uuid',
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b9dc82dd3c..0dfb26c301 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -27,8 +27,6 @@ CREATE OPERATOR CLASS box_ops DEFAULT
OPERATOR 10 <<|,
OPERATOR 11 |>>,
OPERATOR 12 |&>,
- OPERATOR 13 ~,
- OPERATOR 14 @,
FUNCTION 1 gist_box_consistent(internal, box, smallint, oid, internal),
FUNCTION 2 gist_box_union(internal, internal),
-- don't need compress, decompress, or fetch functions
@@ -46,18 +44,18 @@ SET enable_indexscan = ON;
SET enable_bitmapscan = OFF;
EXPLAIN (COSTS OFF)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
- QUERY PLAN
-----------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------
Sort
Sort Key: ((home_base[0])[0])
-> Index Only Scan using grect2ind2 on fast_emp4000
- Index Cond: (home_base @ '(2000,1000),(200,200)'::box)
+ Index Cond: (home_base <@ '(2000,1000),(200,200)'::box)
(4 rows)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
home_base
-----------------------
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out
index 6ace7662ee..3686006212 100644
--- a/src/test/regress/expected/create_index.out
+++ b/src/test/regress/expected/create_index.out
@@ -75,7 +75,7 @@ SET enable_seqscan = ON;
SET enable_indexscan = OFF;
SET enable_bitmapscan = OFF;
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
home_base
-----------------------
@@ -95,7 +95,7 @@ SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
278
(1 row)
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
f1
---------------------
@@ -259,18 +259,18 @@ SET enable_indexscan = ON;
SET enable_bitmapscan = OFF;
EXPLAIN (COSTS OFF)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
- QUERY PLAN
-----------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------------
Sort
Sort Key: ((home_base[0])[0])
-> Index Only Scan using grect2ind on fast_emp4000
- Index Cond: (home_base @ '(2000,1000),(200,200)'::box)
+ Index Cond: (home_base <@ '(2000,1000),(200,200)'::box)
(4 rows)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
home_base
-----------------------
@@ -309,17 +309,17 @@ SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
(1 row)
EXPLAIN (COSTS OFF)
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
- QUERY PLAN
------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------
Sort
Sort Key: ((poly_center(f1))[0])
-> Index Scan using gpolygonind on polygon_tbl
- Index Cond: (f1 ~ '((1,1),(2,2),(2,1))'::polygon)
+ Index Cond: (f1 @> '((1,1),(2,2),(2,1))'::polygon)
(4 rows)
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
f1
---------------------
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 7825a765cd..7ed29b4961 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -1163,14 +1163,13 @@ ORDER BY 1, 2;
?-| | ?-|
?| | ?|
?|| | ?||
- @ | ~
@@ | @@
@@@ | @@@
| | |
~<=~ | ~>=~
~<~ | ~>~
~= | ~=
-(30 rows)
+(29 rows)
-- Likewise for negator pairs.
SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2
@@ -1990,8 +1989,6 @@ ORDER BY 1, 2, 3;
783 | 11 | >^
783 | 11 | |>>
783 | 12 | |&>
- 783 | 13 | ~
- 783 | 14 | @
783 | 15 | <->
783 | 16 | @>
783 | 18 | =
@@ -2084,7 +2081,7 @@ ORDER BY 1, 2, 3;
4000 | 26 | >>
4000 | 27 | >>=
4000 | 28 | ^@
-(125 rows)
+(123 rows)
-- Check that all opclass search operators have selectivity estimators.
-- This is not absolutely required, but it seems a reasonable thing
diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql
index 97df244d17..9a359466ce 100644
--- a/src/test/regress/sql/create_am.sql
+++ b/src/test/regress/sql/create_am.sql
@@ -28,8 +28,6 @@ CREATE OPERATOR CLASS box_ops DEFAULT
OPERATOR 10 <<|,
OPERATOR 11 |>>,
OPERATOR 12 |&>,
- OPERATOR 13 ~,
- OPERATOR 14 @,
FUNCTION 1 gist_box_consistent(internal, box, smallint, oid, internal),
FUNCTION 2 gist_box_union(internal, internal),
-- don't need compress, decompress, or fetch functions
@@ -50,10 +48,10 @@ SET enable_bitmapscan = OFF;
EXPLAIN (COSTS OFF)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
EXPLAIN (COSTS OFF)
diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql
index 37f7259da9..1bb8347ee6 100644
--- a/src/test/regress/sql/create_index.sql
+++ b/src/test/regress/sql/create_index.sql
@@ -107,14 +107,14 @@ SET enable_indexscan = OFF;
SET enable_bitmapscan = OFF;
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box;
SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1)
@@ -161,10 +161,10 @@ SET enable_bitmapscan = OFF;
EXPLAIN (COSTS OFF)
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
SELECT * FROM fast_emp4000
- WHERE home_base @ '(200,200),(2000,1000)'::box
+ WHERE home_base <@ '(200,200),(2000,1000)'::box
ORDER BY (home_base[0])[0];
EXPLAIN (COSTS OFF)
@@ -176,9 +176,9 @@ SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
EXPLAIN (COSTS OFF)
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
-SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon
+SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
ORDER BY (poly_center(f1))[0];
EXPLAIN (COSTS OFF)
--
2.17.0
--UFRfxei4j9xfgtfb--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 8 ++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.8--1.9.sql | 7 +++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 10 ++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 8 ++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
16 files changed, 41 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..54492e5d18
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,8 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (cube, cube);
+DROP OPERATOR ~ (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..7cd3467c55
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..d0ac11545c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+DROP OPERATOR @ (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+DROP OPERATOR ~ (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..13babddba4
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,8 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+DROP OPERATOR @ (seg, seg);
+DROP OPERATOR ~ (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--0OWHXb1mYLuhj1Ox--
^ permalink raw reply [nested|flat] 58+ messages in thread
* [PATCH] remove deprecated v8.2 containment operators
@ 2020-04-12 03:57 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Justin Pryzby @ 2020-04-12 03:57 UTC (permalink / raw)
See also:
ba920e1c9182eac55d5f1327ab0d29b721154277 684ad6a92fcc33adebdab65c4e7d72a68ba05408
3165426e54df02a6199c0a216546e5095e875a0a 2f70fdb0644c32c4154236c2b5c241bec92eac5e 591d282e8d3e0448ec1339c6b066e10953f040a2
---
contrib/cube/Makefile | 2 +-
contrib/cube/cube--1.4--1.5.sql | 10 ++++++++++
contrib/cube/cube.control | 2 +-
contrib/hstore/Makefile | 1 +
contrib/hstore/hstore--1.0--1.1.sql | 7 +++++++
contrib/hstore/hstore--1.8--1.9.sql | 8 ++++++++
contrib/hstore/hstore.control | 2 +-
contrib/intarray/Makefile | 2 +-
contrib/intarray/intarray--1.4--1.5.sql | 18 ++++++++++++++++++
contrib/intarray/intarray.control | 2 +-
contrib/seg/Makefile | 2 +-
contrib/seg/seg--1.3--1.4.sql | 11 +++++++++++
contrib/seg/seg.control | 2 +-
doc/src/sgml/cube.sgml | 8 --------
doc/src/sgml/hstore.sgml | 10 ----------
doc/src/sgml/intarray.sgml | 8 --------
doc/src/sgml/seg.sgml | 8 --------
17 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 contrib/cube/cube--1.4--1.5.sql
create mode 100644 contrib/hstore/hstore--1.0--1.1.sql
create mode 100644 contrib/hstore/hstore--1.8--1.9.sql
create mode 100644 contrib/intarray/intarray--1.4--1.5.sql
create mode 100644 contrib/seg/seg--1.3--1.4.sql
diff --git a/contrib/cube/Makefile b/contrib/cube/Makefile
index 54f609db17..cf195506c7 100644
--- a/contrib/cube/Makefile
+++ b/contrib/cube/Makefile
@@ -7,7 +7,7 @@ OBJS = \
cubeparse.o
EXTENSION = cube
-DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql \
+DATA = cube--1.2.sql cube--1.2--1.3.sql cube--1.3--1.4.sql cube--1.4--1.5.sql \
cube--1.1--1.2.sql cube--1.0--1.1.sql
PGFILEDESC = "cube - multidimensional cube data type"
diff --git a/contrib/cube/cube--1.4--1.5.sql b/contrib/cube/cube--1.4--1.5.sql
new file mode 100644
index 0000000000..07a5f0755d
--- /dev/null
+++ b/contrib/cube/cube--1.4--1.5.sql
@@ -0,0 +1,10 @@
+/* contrib/cube/cube--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION cube UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 13 (cube, cube);
+ALTER OPERATOR FAMILY gist_cube_ops USING gist
+DROP OPERATOR 14 (cube, cube);
diff --git a/contrib/cube/cube.control b/contrib/cube/cube.control
index 3e238fc937..50427ec117 100644
--- a/contrib/cube/cube.control
+++ b/contrib/cube/cube.control
@@ -1,6 +1,6 @@
# cube extension
comment = 'data type for multidimensional cubes'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/cube'
relocatable = true
trusted = true
diff --git a/contrib/hstore/Makefile b/contrib/hstore/Makefile
index c4e339b57c..97b228b65f 100644
--- a/contrib/hstore/Makefile
+++ b/contrib/hstore/Makefile
@@ -12,6 +12,7 @@ OBJS = \
EXTENSION = hstore
DATA = hstore--1.4.sql \
+ hstore--1.8--1.9.sql \
hstore--1.7--1.8.sql \
hstore--1.6--1.7.sql \
hstore--1.5--1.6.sql \
diff --git a/contrib/hstore/hstore--1.0--1.1.sql b/contrib/hstore/hstore--1.0--1.1.sql
new file mode 100644
index 0000000000..4e32a575c5
--- /dev/null
+++ b/contrib/hstore/hstore--1.0--1.1.sql
@@ -0,0 +1,7 @@
+/* contrib/hstore/hstore--1.0--1.1.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.1'" to load this file. \quit
+
+ALTER EXTENSION hstore DROP OPERATOR => (text, text);
+DROP OPERATOR => (text, text);
diff --git a/contrib/hstore/hstore--1.8--1.9.sql b/contrib/hstore/hstore--1.8--1.9.sql
new file mode 100644
index 0000000000..2220fee444
--- /dev/null
+++ b/contrib/hstore/hstore--1.8--1.9.sql
@@ -0,0 +1,8 @@
+/* contrib/hstore/hstore--1.8--1.9.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION hstore UPDATE TO '1.9'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist_hstore_ops USING gist
+DROP OPERATOR 13 (hstore, hstore);
diff --git a/contrib/hstore/hstore.control b/contrib/hstore/hstore.control
index 89e3c746c4..b73c28aa4d 100644
--- a/contrib/hstore/hstore.control
+++ b/contrib/hstore/hstore.control
@@ -1,6 +1,6 @@
# hstore extension
comment = 'data type for storing sets of (key, value) pairs'
-default_version = '1.8'
+default_version = '1.9'
module_pathname = '$libdir/hstore'
relocatable = true
trusted = true
diff --git a/contrib/intarray/Makefile b/contrib/intarray/Makefile
index 01faa36b10..3817c1669a 100644
--- a/contrib/intarray/Makefile
+++ b/contrib/intarray/Makefile
@@ -12,7 +12,7 @@ OBJS = \
_intbig_gist.o
EXTENSION = intarray
-DATA = intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
+DATA = intarray--1.4--1.5.sql intarray--1.3--1.4.sql intarray--1.2--1.3.sql \
intarray--1.2.sql intarray--1.1--1.2.sql \
intarray--1.0--1.1.sql
PGFILEDESC = "intarray - functions and operators for arrays of integers"
diff --git a/contrib/intarray/intarray--1.4--1.5.sql b/contrib/intarray/intarray--1.4--1.5.sql
new file mode 100644
index 0000000000..adb6ce136c
--- /dev/null
+++ b/contrib/intarray/intarray--1.4--1.5.sql
@@ -0,0 +1,18 @@
+/* contrib/intarray/intarray--1.4--1.5.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION intarray UPDATE TO '1.5'" to load this file. \quit
+
+-- Remove @
+ALTER OPERATOR FAMILY gist__int_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gist__intbig_ops USING gist
+DROP OPERATOR 13 (_int4, _int4);
+
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 13 (_int4, _int4);
+
+-- Remove ~ from GIN - it was removed from gist in 1.4
+ALTER OPERATOR FAMILY gin__int_ops USING gin
+DROP OPERATOR 14 (_int4, _int4);
diff --git a/contrib/intarray/intarray.control b/contrib/intarray/intarray.control
index bbc837c573..c3ff753e2c 100644
--- a/contrib/intarray/intarray.control
+++ b/contrib/intarray/intarray.control
@@ -1,6 +1,6 @@
# intarray extension
comment = 'functions, operators, and index support for 1-D arrays of integers'
-default_version = '1.4'
+default_version = '1.5'
module_pathname = '$libdir/_int'
relocatable = true
trusted = true
diff --git a/contrib/seg/Makefile b/contrib/seg/Makefile
index f3578a8634..bb63e83506 100644
--- a/contrib/seg/Makefile
+++ b/contrib/seg/Makefile
@@ -7,7 +7,7 @@ OBJS = \
segparse.o
EXTENSION = seg
-DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql \
+DATA = seg--1.1.sql seg--1.1--1.2.sql seg--1.2--1.3.sql seg--1.3--1.4.sql \
seg--1.0--1.1.sql
PGFILEDESC = "seg - line segment data type"
diff --git a/contrib/seg/seg--1.3--1.4.sql b/contrib/seg/seg--1.3--1.4.sql
new file mode 100644
index 0000000000..8bdf1dd99b
--- /dev/null
+++ b/contrib/seg/seg--1.3--1.4.sql
@@ -0,0 +1,11 @@
+/* contrib/seg/seg--1.3--1.4.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION seg UPDATE TO '1.4'" to load this file. \quit
+
+-- Remove @ and ~
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 13 (seg, seg);
+
+ALTER OPERATOR FAMILY gist_seg_ops USING gist
+DROP OPERATOR 14 (seg, seg);
diff --git a/contrib/seg/seg.control b/contrib/seg/seg.control
index 9ac3080848..e2c6a4750f 100644
--- a/contrib/seg/seg.control
+++ b/contrib/seg/seg.control
@@ -1,6 +1,6 @@
# seg extension
comment = 'data type for representing line segments or floating-point intervals'
-default_version = '1.3'
+default_version = '1.4'
module_pathname = '$libdir/seg'
relocatable = true
trusted = true
diff --git a/doc/src/sgml/cube.sgml b/doc/src/sgml/cube.sgml
index 3dd89bb14d..adf8dbaa91 100644
--- a/doc/src/sgml/cube.sgml
+++ b/doc/src/sgml/cube.sgml
@@ -222,14 +222,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index e867fcc5ae..db5779052a 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -318,16 +318,6 @@ key => NULL
</tgroup>
</table>
- <note>
- <para>
- Prior to PostgreSQL 8.2, the containment operators <literal>@></literal>
- and <literal><@</literal> were called <literal>@</literal> and <literal>~</literal>,
- respectively. These names are still available, but are deprecated and will
- eventually be removed. Notice that the old names are reversed from the
- convention formerly followed by the core geometric data types!
- </para>
- </note>
-
<table id="hstore-func-table">
<title><type>hstore</type> Functions</title>
<tgroup cols="1">
diff --git a/doc/src/sgml/intarray.sgml b/doc/src/sgml/intarray.sgml
index af44c7b214..dfe98279c0 100644
--- a/doc/src/sgml/intarray.sgml
+++ b/doc/src/sgml/intarray.sgml
@@ -364,14 +364,6 @@
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and
- <literal><@</literal> were respectively called <literal>@</literal> and <literal>~</literal>.
- These names are still available, but are deprecated and will eventually be
- retired. Notice that the old names are reversed from the convention
- formerly followed by the core geometric data types!)
- </para>
-
<para>
The operators <literal>&&</literal>, <literal>@></literal> and
<literal><@</literal> are equivalent to <productname>PostgreSQL</productname>'s built-in
diff --git a/doc/src/sgml/seg.sgml b/doc/src/sgml/seg.sgml
index e0dfbc76cf..9be69e3609 100644
--- a/doc/src/sgml/seg.sgml
+++ b/doc/src/sgml/seg.sgml
@@ -352,14 +352,6 @@ test=> select '6.25 .. 6.50'::seg as "pH";
</tgroup>
</table>
- <para>
- (Before PostgreSQL 8.2, the containment operators <literal>@></literal> and <literal><@</literal> were
- respectively called <literal>@</literal> and <literal>~</literal>. These names are still available, but are
- deprecated and will eventually be retired. Notice that the old names
- are reversed from the convention formerly followed by the core geometric
- data types!)
- </para>
-
<para>
In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
--
2.17.0
--2NLGdgz3UMHa/lqP--
^ permalink raw reply [nested|flat] 58+ messages in thread
* POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-02-28 07:10 Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-02-28 07:10 UTC (permalink / raw)
To: PostgreSQL Hackers <[email protected]>
Hi
I wrote PoC for previously proposed plpgsql statement FOREACH IN JSON ARRAY
It looks like:
do $$
declare x int;
begin
foreach x in json array '[1,2,3,4]'
loop
raise notice 'x: %', x;
end loop;
end;
$$
do $$
declare x int; y int;
begin
foreach x, y in json array '[{"x": 100, "y": 1000}, {"y": 1000, "x":
100}]'
loop
raise notice 'x: %, y: %', x, y;
end loop;
end
$$
My first motivation for this patch is performance. This is faster (3 - 4 x)
than using FOR IN SELECT FROM json_array_elements, because there is no
overhead of SQL executor. Second motivation is a little bit better
readability, because inside plpgsql' statements we have info about used
variables and we can use it.
The behavior is very similar to FOREACH IN ARRAY with one significant
difference - the values of JSON objects are assigned to the composite
variable or lists of variables by names (not by position). It made this
decision because jsonb doesn't preserve the position of the field in
object, and then assignment based on position cannot work.
The code is relatively short now - about 400 lines +/- and the code is
simple without risks.
There are some open questions - mainly if default mode for mapping json
fields to plpgsql variables should be in lax or strict mode. Now, it is
something between (cast errors are raised) - it is consistent
with jsonb_populate_record - but it should not be the final design. I
cannot say what is better - currently implemented behavior is consistent
with common plpgsql behaviour, but SQL/JSON is different. I can imagine
that default behaviour will be lax, and with some optional clauses we can
push behave to strict mode. I have no strong opinion about it. Maybe I
prefer the current "strict" behaviour a little bit, because it is more
"safe", but it is only my personal opinion. But again, I have no strong
opinion about this question and I very much invite any discussion about it.
This is proof of concept patch - casting between plpgsql arrays and json
arrays is not supported, documentation and regress tests are minimalistic,
but it is good enough for testing and good enough for decision, if this
feature is wanted or not (or if it needs some modifications).
This is a new feature (and proprietary feature). There should not be any
compatibility issues.
What do you think about this feature?
Regards
Pavel
Attachments:
[text/x-patch] v20260228-1-0001-FOREACH-scalar-IN-JSON-ARRAY.patch (28.0K, ../../CAFj8pRD9Jjv+m=6DP6vWWn5NnZeTPH9eoPFCnA1JE5hRKRDMxQ@mail.gmail.com/3-v20260228-1-0001-FOREACH-scalar-IN-JSON-ARRAY.patch)
download | inline diff:
From c9f041e5408351961425eabeef161c4b72b93d1c Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN JSON ARRAY
this patch introduce FOREACH scalar_var IN JSON ARRAY. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN JSON ARRAY '[1,2,3.14]'
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN JSON ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 63 ++++
src/backend/utils/adt/jsonb_util.c | 1 +
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 119 +++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_comp.c | 4 +-
src/pl/plpgsql/src/pl_exec.c | 296 +++++++++++++++++-
src/pl/plpgsql/src/pl_funcs.c | 29 ++
src/pl/plpgsql/src/pl_gram.y | 39 ++-
src/pl/plpgsql/src/pl_unreserved_kwlist.h | 1 +
src/pl/plpgsql/src/plpgsql.h | 35 ++-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 89 ++++++
12 files changed, 669 insertions(+), 10 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..c11f44676bf 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2780,6 +2780,69 @@ NOTICE: row = {10,11,12}
</para>
</sect2>
+ <sect2 id="plpgsql-foreach-json-array">
+ <title>Looping through JSON arrays</title>
+
+ <para>
+ The <literal>FOREACH</literal> loop is much like a <literal>FOREACH</literal> loop,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of an JSON array value
+ (expression is internaly casted to jsonb type).
+
+<synopsis>
+<optional> <<<replaceable>label</replaceable>>> </optional>
+FOREACH <replaceable>target</replaceable> IN JSON ARRAY <replaceable>expression</replaceable> LOOP
+ <replaceable>statements</replaceable>
+END LOOP <optional> <replaceable>label</replaceable> </optional>;
+</synopsis>
+ </para>
+
+ <para>
+ Target can be scalar variable, composite variable or list of
+ scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION scan_rows(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN JSON ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT scan_rows('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION scan_rows(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN JSON ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT scan_rows('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ Assigning to PLpgSQL array variables is not supported.
+ </para>
+ </sect2>
+
<sect2 id="plpgsql-error-trapping">
<title>Trapping Errors</title>
diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c
index 91fb9ea09bf..7513b1198dd 100644
--- a/src/backend/utils/adt/jsonb_util.c
+++ b/src/backend/utils/adt/jsonb_util.c
@@ -18,6 +18,7 @@
#include "common/hashfn.h"
#include "miscadmin.h"
#include "port/pg_bitutils.h"
+#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datetime.h"
#include "utils/datum.h"
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..43ae84412f1
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,119 @@
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in json array '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in json array '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in json array '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over json array
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in json array '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in json array '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 5ecc7766757..8fa60976cfd 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -1253,6 +1253,7 @@ make_datum_param(PLpgSQL_expr *expr, int dno, int location)
PLpgSQL_datum *datum;
Param *param;
MemoryContext oldcontext;
+ char *refname;
/* see comment in resolve_column_ref */
estate = expr->func->cur_estate;
@@ -1273,7 +1274,8 @@ make_datum_param(PLpgSQL_expr *expr, int dno, int location)
datum,
¶m->paramtype,
¶m->paramtypmod,
- ¶m->paramcollid);
+ ¶m->paramcollid,
+ &refname);
param->location = location;
return (Node *) param;
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 84552e32c87..3383b42c39a 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -41,6 +41,8 @@
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
+#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
@@ -305,6 +307,8 @@ static int exec_stmt_forc(PLpgSQL_execstate *estate,
PLpgSQL_stmt_forc *stmt);
static int exec_stmt_foreach_a(PLpgSQL_execstate *estate,
PLpgSQL_stmt_foreach_a *stmt);
+static int exec_stmt_foreach_json_a(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_foreach_json_a *stmt);
static int exec_stmt_open(PLpgSQL_execstate *estate,
PLpgSQL_stmt_open *stmt);
static int exec_stmt_fetch(PLpgSQL_execstate *estate,
@@ -2075,6 +2079,10 @@ exec_stmts(PLpgSQL_execstate *estate, List *stmts)
rc = exec_stmt_foreach_a(estate, (PLpgSQL_stmt_foreach_a *) stmt);
break;
+ case PLPGSQL_STMT_FOREACH_JSON_A:
+ rc = exec_stmt_foreach_json_a(estate, (PLpgSQL_stmt_foreach_json_a *) stmt);
+ break;
+
case PLPGSQL_STMT_EXIT:
rc = exec_stmt_exit(estate, (PLpgSQL_stmt_exit *) stmt);
break;
@@ -2995,6 +3003,240 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
}
+/*
+ * Convert JsonbValue to Datum that can be assigned to PLpgSQL_var.
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ if (expected_typid == JSONBOID)
+ {
+ *typid = JSONBOID;
+ *typmod = -1;
+ *isnull = false;
+
+ return PointerGetDatum(JsonbValueToJsonb(jbv));
+ }
+ else if (expected_typid == JSONOID)
+ {
+ Jsonb *jsonb;
+ char *str;
+
+ /* serialize JsonValue to JSON text */
+ jsonb = JsonbValueToJsonb(jbv);
+ str = JsonbToCString(NULL, &jsonb->root, VARSIZE(jsonb));
+
+ *typid = TEXTOID;
+ *typmod = -1;
+ *isnull = false;
+
+ return PointerGetDatum(cstring_to_text(str));
+ }
+ else if (jbv->type == jbvNull)
+ {
+ *typid = expected_typid;
+ *typmod = -1;
+ *isnull = true;
+
+ return (Datum) 0;
+ }
+ else if (jbv->type == jbvString)
+ {
+ *typid = TEXTOID;
+ *typmod = -1;
+ *isnull = false;
+
+ return PointerGetDatum(cstring_to_text_with_len(jbv->val.string.val, jbv->val.string.len));
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ *typid = NUMERICOID;
+ *typmod = -1;
+ *isnull = false;
+
+ return PointerGetDatum(jbv->val.numeric);
+ }
+ else if (jbv->type == jbvBool)
+ {
+ *typid = BOOLOID;
+ *typmod = -1;
+ *isnull = false;
+
+ return BoolGetDatum(jbv->val.boolean);
+ }
+ else
+ {
+ Jsonb *jsonb;
+ Datum result;
+
+ jsonb = JsonbValueToJsonb(jbv);
+ result = json_populate_type(PointerGetDatum(jsonb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+
+ return result;
+ }
+}
+
+/* ----------
+ * exec_stmt_foreach_json_a Loop over elements in json array
+ *
+ * When target is a composite, then target is populated like json_to_populate_record.
+ * jsonb doesn't preserve attribute order, so position based mapping between
+ * target and source can be possibly dangerous (with unexpected behave).
+ * ----------
+ */
+static int
+exec_stmt_foreach_json_a(PLpgSQL_execstate *estate,
+ PLpgSQL_stmt_foreach_json_a *stmt)
+{
+ Oid exprtypeid;
+ int32 exprtypmod;
+ Datum exprdatum;
+ PLpgSQL_datum *loop_var;
+ Oid loop_var_typid;
+ int32 loop_var_typmod;
+ Oid loop_var_collation;
+ char *loop_var_name;
+ Jsonb *jb;
+ JsonbIterator *it;
+ JsonbValue jbv;
+ JsonbIteratorToken r;
+ MemoryContext stmt_mcontext;
+ MemoryContext oldcontext;
+ MemoryContext tmp_cxt;
+ bool found = false;
+ bool isnull;
+ bool skipNested = false;
+ int rc = PLPGSQL_RC_OK;
+ void *cache = NULL;
+
+ /* get the value of the expression */
+ exprdatum = exec_eval_expr(estate, stmt->expr, &isnull,
+ &exprtypeid, &exprtypmod);
+ if (isnull)
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("FOREACH expression must not be null")));
+
+ /*
+ * Do as much as possible of the code below in stmt_mcontext, to avoid any
+ * leaks from called subroutines. We need a private stmt_mcontext since
+ * we'll be calling arbitrary statement code.
+ */
+ stmt_mcontext = get_stmt_mcontext(estate);
+ push_stmt_mcontext(estate);
+ oldcontext = MemoryContextSwitchTo(stmt_mcontext);
+
+ tmp_cxt = AllocSetContextCreate(CurrentMemoryContext,
+ "FOREACH IN JSON ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
+
+ /* cast to jsonb */
+ exprdatum = exec_cast_value(estate, exprdatum, &isnull,
+ exprtypeid, exprtypmod,
+ JSONBOID, -1);
+
+ Assert(!isnull);
+
+ /*
+ * We must copy the array into stmt_mcontext, else it will disappear in
+ * exec_eval_cleanup. This is annoying, but cleanup will certainly happen
+ * while running the loop body, so we have little choice.
+ */
+ jb = DatumGetJsonbPCopy(exprdatum);
+
+ /* Clean up any leftover temporary memory */
+ exec_eval_cleanup(estate);
+
+ /*
+ * This is compatible with jsonb_array_element. SQL/JSON functions are not
+ * too strict like PostgreSQL proprietary (old json) functions. In SQL/JSON
+ * a scalar is equal to one element array. The basic question is if FOREACH
+ * should be more restrictive like old JSON function, or less restrictive
+ * like SQL/JSON functions.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot extract elements from a scalar")));
+ else if (!JB_ROOT_IS_ARRAY(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot extract elements from an object")));
+
+ /* Set up the loop variable and see if it is of an array type */
+ loop_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, loop_var,
+ &loop_var_typid, &loop_var_typmod,
+ &loop_var_collation, &loop_var_name);
+
+ it = JsonbIteratorInit(&jb->root);
+
+ while ((r = JsonbIteratorNext(&it, &jbv, skipNested)) != WJB_DONE)
+ {
+ skipNested = true;
+
+ if (r == WJB_ELEM)
+ {
+ Datum val;
+ Oid valtypid;
+ int32 valtypmod;
+ bool valisnull;
+
+ MemoryContextSwitchTo(tmp_cxt);
+
+ val = JsonbValueToDatum(&jbv,
+ &valtypid, &valtypmod, &valisnull,
+ loop_var_typid, loop_var_typmod,
+ &cache, stmt_mcontext);
+
+ /* exec_assign_value and exec_stmts must run in the main context */
+ MemoryContextSwitchTo(oldcontext);
+
+ /* Assign current element/slice to the loop variable */
+ exec_assign_value(estate, loop_var, val,
+ valisnull, valtypid, valtypmod);
+
+ MemoryContextReset(tmp_cxt);
+
+ /*
+ * Execute the statements
+ */
+ rc = exec_stmts(estate, stmt->body);
+
+ LOOP_RC_PROCESSING(stmt->label, break);
+
+ MemoryContextSwitchTo(stmt_mcontext);
+ }
+ }
+
+ /* Restore memory context state */
+ MemoryContextSwitchTo(oldcontext);
+ pop_stmt_mcontext(estate);
+
+ /* Release temporary memory, including the array value */
+ MemoryContextReset(stmt_mcontext);
+
+ /*
+ * Set the FOUND variable to indicate the result of executing the loop
+ * (namely, whether we looped one or more times). This must be set here so
+ * that it does not interfere with the value of the FOUND variable inside
+ * the loop processing itself.
+ */
+ exec_set_found(estate, found);
+
+ return rc;
+}
+
/* ----------
* exec_stmt_foreach_a Loop over elements or slices of an array
*
@@ -5522,7 +5764,8 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
void
plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum,
- Oid *typeId, int32 *typMod, Oid *collation)
+ Oid *typeId, int32 *typMod, Oid *collation,
+ char **refname)
{
switch (datum->dtype)
{
@@ -5534,6 +5777,54 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
*typeId = var->datatype->typoid;
*typMod = var->datatype->atttypmod;
*collation = var->datatype->collation;
+ *refname = var->refname;
+ break;
+ }
+
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+ char *varname;
+
+ /*
+ * We cannot to use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation, &varname);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ varname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ *refname = row->refname;
break;
}
@@ -5556,6 +5847,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
}
/* composite types are never collatable */
*collation = InvalidOid;
+ *refname = rec->refname;
break;
}
@@ -5593,6 +5885,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
*typeId = recfield->finfo.ftypeid;
*typMod = recfield->finfo.ftypmod;
*collation = recfield->finfo.fcollation;
+ *refname = recfield->fieldname;
break;
}
@@ -5601,6 +5894,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
*typeId = InvalidOid; /* keep compiler quiet */
*typMod = -1;
*collation = InvalidOid;
+ *refname = NULL;
break;
}
}
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 92cd9116c0e..7511fab7e68 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -253,6 +253,8 @@ plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
return _("FOR over cursor");
case PLPGSQL_STMT_FOREACH_A:
return _("FOREACH over array");
+ case PLPGSQL_STMT_FOREACH_JSON_A:
+ return _("FOREACH over json array");
case PLPGSQL_STMT_EXIT:
return ((PLpgSQL_stmt_exit *) stmt)->is_exit ? "EXIT" : "CONTINUE";
case PLPGSQL_STMT_RETURN:
@@ -467,6 +469,14 @@ plpgsql_statement_tree_walker_impl(PLpgSQL_stmt *stmt,
{
PLpgSQL_stmt_foreach_a *fstmt = (PLpgSQL_stmt_foreach_a *) stmt;
+ E_WALK(fstmt->expr);
+ S_LIST_WALK(fstmt->body);
+ break;
+ }
+ case PLPGSQL_STMT_FOREACH_JSON_A:
+ {
+ PLpgSQL_stmt_foreach_json_a *fstmt = (PLpgSQL_stmt_foreach_json_a *) stmt;
+
E_WALK(fstmt->expr);
S_LIST_WALK(fstmt->body);
break;
@@ -795,6 +805,7 @@ static void dump_fori(PLpgSQL_stmt_fori *stmt);
static void dump_fors(PLpgSQL_stmt_fors *stmt);
static void dump_forc(PLpgSQL_stmt_forc *stmt);
static void dump_foreach_a(PLpgSQL_stmt_foreach_a *stmt);
+static void dump_foreach_json_a(PLpgSQL_stmt_foreach_json_a *stmt);
static void dump_exit(PLpgSQL_stmt_exit *stmt);
static void dump_return(PLpgSQL_stmt_return *stmt);
static void dump_return_next(PLpgSQL_stmt_return_next *stmt);
@@ -861,6 +872,9 @@ dump_stmt(PLpgSQL_stmt *stmt)
case PLPGSQL_STMT_FOREACH_A:
dump_foreach_a((PLpgSQL_stmt_foreach_a *) stmt);
break;
+ case PLPGSQL_STMT_FOREACH_JSON_A:
+ dump_foreach_json_a((PLpgSQL_stmt_foreach_json_a *) stmt);
+ break;
case PLPGSQL_STMT_EXIT:
dump_exit((PLpgSQL_stmt_exit *) stmt);
break;
@@ -1157,6 +1171,21 @@ dump_foreach_a(PLpgSQL_stmt_foreach_a *stmt)
printf(" ENDFOREACHA");
}
+static void
+dump_foreach_json_a(PLpgSQL_stmt_foreach_json_a *stmt)
+{
+ dump_ind();
+ printf("FOREACHA var %d ", stmt->varno);
+ printf("IN JSON ARRAY ");
+ dump_expr(stmt->expr);
+ printf("\n");
+
+ dump_stmts(stmt->body);
+
+ dump_ind();
+ printf(" ENDFOREACHA");
+}
+
static void
dump_open(PLpgSQL_stmt_open *stmt)
{
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 5009e59a78f..23b465b10d5 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -178,6 +178,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
PLpgSQL_diag_item *diagitem;
PLpgSQL_stmt_fetch *fetch;
PLpgSQL_case_when *casewhen;
+ PLpgSQL_stmt_foreach *foreach;
}
%type <declhdr> decl_sect
@@ -220,6 +221,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%type <casewhen> case_when
%type <list> case_when_list opt_case_else
+%type <foreach> foreach_type
%type <boolean> getdiag_area_opt
%type <list> getdiag_list
@@ -341,6 +343,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%token <keyword> K_PRINT_STRICT_PARAMS
%token <keyword> K_PRIOR
%token <keyword> K_QUERY
+%token <keyword> K_JSON
%token <keyword> K_RAISE
%token <keyword> K_RELATIVE
%token <keyword> K_RETURN
@@ -1671,16 +1674,29 @@ for_variable : T_DATUM
}
;
-stmt_foreach_a : opt_loop_label K_FOREACH for_variable foreach_slice K_IN K_ARRAY expr_until_loop loop_body
+stmt_foreach_a : opt_loop_label K_FOREACH for_variable foreach_slice K_IN foreach_type expr_until_loop loop_body
{
- PLpgSQL_stmt_foreach_a *new;
+ PLpgSQL_stmt_foreach *new;
- new = palloc0_object(PLpgSQL_stmt_foreach_a);
- new->cmd_type = PLPGSQL_STMT_FOREACH_A;
+ new = $6;
new->lineno = plpgsql_location_to_lineno(@2, yyscanner);
new->stmtid = ++plpgsql_curr_compile->nstatements;
new->label = $1;
- new->slice = $4;
+
+ if ($4 > 0)
+ {
+ /* slicing is supported only by FOREACH IN ARRAY */
+ if (new->cmd_type == PLPGSQL_STMT_FOREACH_A)
+ {
+ ((PLpgSQL_stmt_foreach_a *) new)->slice = $4;
+ }
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("not zero slice is allowed only for arrays"),
+ parser_errposition(@4)));
+ }
+
new->expr = $7;
new->body = $8.stmts;
@@ -1719,6 +1735,19 @@ foreach_slice :
}
;
+foreach_type :
+ K_ARRAY
+ {
+ $$ = (PLpgSQL_stmt_foreach *) palloc0_object(PLpgSQL_stmt_foreach_a);
+ $$->cmd_type = PLPGSQL_STMT_FOREACH_A;
+ }
+ | K_JSON K_ARRAY
+ {
+ $$ = (PLpgSQL_stmt_foreach *) palloc0_object(PLpgSQL_stmt_foreach_json_a);
+ $$->cmd_type = PLPGSQL_STMT_FOREACH_JSON_A;
+ }
+ ;
+
stmt_exit : exit_type opt_label opt_exitcond
{
PLpgSQL_stmt_exit *new;
diff --git a/src/pl/plpgsql/src/pl_unreserved_kwlist.h b/src/pl/plpgsql/src/pl_unreserved_kwlist.h
index 6379e86c8cb..d7588d3b4ad 100644
--- a/src/pl/plpgsql/src/pl_unreserved_kwlist.h
+++ b/src/pl/plpgsql/src/pl_unreserved_kwlist.h
@@ -69,6 +69,7 @@ PG_KEYWORD("import", K_IMPORT)
PG_KEYWORD("info", K_INFO)
PG_KEYWORD("insert", K_INSERT)
PG_KEYWORD("is", K_IS)
+PG_KEYWORD("json", K_JSON)
PG_KEYWORD("last", K_LAST)
PG_KEYWORD("log", K_LOG)
PG_KEYWORD("merge", K_MERGE)
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..4a1e9ba65bc 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -112,6 +112,7 @@ typedef enum PLpgSQL_stmt_type
PLPGSQL_STMT_FORS,
PLPGSQL_STMT_FORC,
PLPGSQL_STMT_FOREACH_A,
+ PLPGSQL_STMT_FOREACH_JSON_A,
PLPGSQL_STMT_EXIT,
PLPGSQL_STMT_RETURN,
PLPGSQL_STMT_RETURN_NEXT,
@@ -766,6 +767,20 @@ typedef struct PLpgSQL_stmt_dynfors
List *params; /* USING expressions */
} PLpgSQL_stmt_dynfors;
+/*
+ * FOREACH loop (ancestor IN ARRAY and IN JSON ARRAY loop)
+ */
+typedef struct PLpgSQL_stmt_foreach
+{
+ PLpgSQL_stmt_type cmd_type;
+ int lineno;
+ unsigned int stmtid;
+ char *label;
+ int varno; /* loop target variable */
+ PLpgSQL_expr *expr; /* set expression */
+ List *body; /* List of statements */
+} PLpgSQL_stmt_foreach;
+
/*
* FOREACH item in array loop
*/
@@ -776,11 +791,27 @@ typedef struct PLpgSQL_stmt_foreach_a
unsigned int stmtid;
char *label;
int varno; /* loop target variable */
- int slice; /* slice dimension, or 0 */
PLpgSQL_expr *expr; /* array expression */
List *body; /* List of statements */
+ /* end of fields that must match PLpgSQL_stmt_foreach */
+ int slice; /* slice dimension, or 0 */
} PLpgSQL_stmt_foreach_a;
+/*
+ * FOREACH item in array loop
+ */
+typedef struct PLpgSQL_stmt_foreach_json_a
+{
+ PLpgSQL_stmt_type cmd_type;
+ int lineno;
+ unsigned int stmtid;
+ char *label;
+ int varno; /* loop target variable */
+ PLpgSQL_expr *expr; /* array expression */
+ List *body; /* List of statements */
+ /* end of fields that must match PLpgSQL_stmt_foreach */
+} PLpgSQL_stmt_foreach_json_a;
+
/*
* OPEN a curvar
*/
@@ -1274,7 +1305,7 @@ extern PGDLLEXPORT Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate,
extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum,
Oid *typeId, int32 *typMod,
- Oid *collation);
+ Oid *collation, char **refname);
/*
* Functions for namespace handling in pl_funcs.c
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..7e7abfe2568
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,89 @@
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in json array '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in json array '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in json array '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in json array '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in json array '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in json array '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
--
2.53.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-03-11 20:57 Peter Eisentraut <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Peter Eisentraut @ 2026-03-11 20:57 UTC (permalink / raw)
To: Pavel Stehule <[email protected]>; PostgreSQL Hackers <[email protected]>
On 28.02.26 08:10, Pavel Stehule wrote:
> I wrote PoC for previously proposed plpgsql statement FOREACH IN JSON ARRAY
Maybe this could be written in such a way that it doesn't hardcode JSON
arrays specifically, but a type could have an iteration helper function
that would feed this feature?
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-03-12 07:00 Pavel Stehule <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-03-12 07:00 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
čt 12. 3. 2026 v 5:30 odesílatel Tom Lane <[email protected]> napsal:
> Peter Eisentraut <[email protected]> writes:
> > Maybe this could be written in such a way that it doesn't hardcode JSON
> > arrays specifically, but a type could have an iteration helper function
> > that would feed this feature?
>
> +1. ISTM that this feature would make sense for subscriptable types,
> so one way to shoehorn it into the system without a lot of new overhead
> could be to extend struct SubscriptRoutines to offer optional support
> function(s) for iterating through all the elements of a subscriptable
> object.
>
I'll try to write second patch in this way
Regards
Pavel
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-03-17 06:58 Pavel Stehule <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-03-17 06:58 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
čt 12. 3. 2026 v 8:00 odesílatel Pavel Stehule <[email protected]>
napsal:
> Hi
>
> čt 12. 3. 2026 v 5:30 odesílatel Tom Lane <[email protected]> napsal:
>
>> Peter Eisentraut <[email protected]> writes:
>> > Maybe this could be written in such a way that it doesn't hardcode JSON
>> > arrays specifically, but a type could have an iteration helper function
>> > that would feed this feature?
>>
>> +1. ISTM that this feature would make sense for subscriptable types,
>> so one way to shoehorn it into the system without a lot of new overhead
>> could be to extend struct SubscriptRoutines to offer optional support
>> function(s) for iterating through all the elements of a subscriptable
>> object.
>>
>
>
attached patch do this - new interface has two
methods: CreateForeachAIterator and iterate
diff --git a/src/include/nodes/subscripting.h
b/src/include/nodes/subscripting.h
index 301f21dac2f..08bfe59ede4 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,32 @@ typedef void (*SubscriptExecSetup) (const
SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid target_typid,
+ int32 target_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +189,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof?
*/
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
Regards
Pavel
>
>
> Regards
>
> Pavel
>
>
>>
>> regards, tom lane
>>
>
Attachments:
[text/x-patch] v20260317-7-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (37.0K, ../../CAFj8pRDHdO9bLM4=8=p0MF8rNpSKdw-F_=zG=YxWui8S4vn5RQ@mail.gmail.com/3-v20260317-7-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From b7b6509381a7d6b4629b3b25ebb4a189b1eb34be Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 97 +++++-
src/backend/utils/adt/jsonbsubs.c | 181 ++++++++++-
src/include/nodes/subscripting.h | 29 ++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 297 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 189 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 1016 insertions(+), 97 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..a42248ed633 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,96 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ForeachAArrayIterState;
+
+static bool
+foreach_a_array_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAArrayIterState *iter = (ForeachAArrayIterState *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * Used by plpgsql FOREACH IN ARRAY when input expression is an array
+ */
+static ForeachAIterator *
+create_foreach_a_array_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAArrayIterState *iter = palloc0(sizeof(ForeachAArrayIterState));
+ ArrayType *arr;
+ Oid target_elem_typid;
+
+ /* check the type of the expression - must be an array */
+ if (!OidIsValid(get_element_type(typid)))
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH expression must yield an array, not type %s",
+ format_type_be(typid))));
+
+ /*
+ * We must copy the array into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ arr = DatumGetArrayTypePCopy(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ /*
+ * Sanity-check the target type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(target_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH ... SLICE loop variable must be of an array type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH loop variable must not be of an array type")));
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = foreach_a_array_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +636,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +664,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..ad2edf525de 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid target_typid;
+ int32 target_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} ForeachAJsonbIterState;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,172 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used in
+ * generic array iterator, that is used by FOREACH plpgsql
+ * statement. Against other cases, the result should not be
+ * necessary of expected_typid, because the value can be
+ * converted later when the value is assigned to PL/pgSQL
+ * variable. This can be more effective than generic IO
+ * cast used by json_populate_type.
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+foreach_a_jsonb_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAJsonbIterState *iter = (ForeachAJsonbIterState *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->target_typid, iter->target_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_foreach_a_jsonb_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAJsonbIterState *iter = palloc0(sizeof(ForeachAJsonbIterState));
+ Jsonb *jb;
+
+ if (typid != JSONBOID)
+ elog(ERROR, "unexpected source type");
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ /*
+ * We must copy the JSON into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ jb = DatumGetJsonbPCopy(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errhint("Cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errdetail("Cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ iter->target_typid = target_typid;
+ iter->target_typmod = target_typmod;
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = foreach_a_jsonb_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +585,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_jsonb_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..08bfe59ede4 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,32 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid target_typid,
+ int32 target_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +189,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..ddc571f3c79
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,297 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+HINT: Cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+DETAIL: Cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 84552e32c87..331d64119c1 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -2994,40 +2995,49 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3037,79 +3047,34 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
- * We must copy the array into stmt_mcontext, else it will disappear in
- * exec_eval_cleanup. This is annoying, but cleanup will certainly happen
- * while running the loop body, so we have little choice.
+ * inside iterator constroctor, the expr should be copied to
+ * current memory context (stmt_mcontext). Without it, it will be released
+ * by next exec_eval_cleanup. The iterator constructor should
+ * be called under stmt memory context.
*/
- arr = DatumGetArrayTypePCopy(value);
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
+ MemoryContextSwitchTo(tmp_cxt);
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
-
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
-
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3117,12 +3082,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3131,7 +3093,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5537,6 +5499,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.53.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-03-21 18:40 Pavel Stehule <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-03-21 18:40 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
only rebase
Regards
Pavel
Attachments:
[text/x-patch] v20260321-8-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (37.0K, ../../CAFj8pRAHrHmpPmmFfm6B5ig3GzWfVVSh_3CofcQYM8utrSQoFQ@mail.gmail.com/3-v20260321-8-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From a08a1205caaf0b546b7f21a1a6251551db2a0196 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 97 +++++-
src/backend/utils/adt/jsonbsubs.c | 181 ++++++++++-
src/include/nodes/subscripting.h | 29 ++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 297 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 189 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 1016 insertions(+), 97 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..a42248ed633 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,96 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ForeachAArrayIterState;
+
+static bool
+foreach_a_array_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAArrayIterState *iter = (ForeachAArrayIterState *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * Used by plpgsql FOREACH IN ARRAY when input expression is an array
+ */
+static ForeachAIterator *
+create_foreach_a_array_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAArrayIterState *iter = palloc0(sizeof(ForeachAArrayIterState));
+ ArrayType *arr;
+ Oid target_elem_typid;
+
+ /* check the type of the expression - must be an array */
+ if (!OidIsValid(get_element_type(typid)))
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH expression must yield an array, not type %s",
+ format_type_be(typid))));
+
+ /*
+ * We must copy the array into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ arr = DatumGetArrayTypePCopy(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ /*
+ * Sanity-check the target type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(target_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH ... SLICE loop variable must be of an array type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH loop variable must not be of an array type")));
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = foreach_a_array_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +636,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +664,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..ad2edf525de 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid target_typid;
+ int32 target_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} ForeachAJsonbIterState;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,172 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used in
+ * generic array iterator, that is used by FOREACH plpgsql
+ * statement. Against other cases, the result should not be
+ * necessary of expected_typid, because the value can be
+ * converted later when the value is assigned to PL/pgSQL
+ * variable. This can be more effective than generic IO
+ * cast used by json_populate_type.
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+foreach_a_jsonb_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAJsonbIterState *iter = (ForeachAJsonbIterState *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->target_typid, iter->target_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_foreach_a_jsonb_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAJsonbIterState *iter = palloc0(sizeof(ForeachAJsonbIterState));
+ Jsonb *jb;
+
+ if (typid != JSONBOID)
+ elog(ERROR, "unexpected source type");
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ /*
+ * We must copy the JSON into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ jb = DatumGetJsonbPCopy(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errhint("Cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errdetail("Cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ iter->target_typid = target_typid;
+ iter->target_typmod = target_typmod;
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = foreach_a_jsonb_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +585,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_jsonb_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..08bfe59ede4 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,32 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid target_typid,
+ int32 target_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +189,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..ddc571f3c79
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,297 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+HINT: Cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+DETAIL: Cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 45d667428f4..9ed346f13ab 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,49 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3079,34 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
- * We must copy the array into stmt_mcontext, else it will disappear in
- * exec_eval_cleanup. This is annoying, but cleanup will certainly happen
- * while running the loop body, so we have little choice.
+ * inside iterator constroctor, the expr should be copied to
+ * current memory context (stmt_mcontext). Without it, it will be released
+ * by next exec_eval_cleanup. The iterator constructor should
+ * be called under stmt memory context.
*/
- arr = DatumGetArrayTypePCopy(value);
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
+ MemoryContextSwitchTo(tmp_cxt);
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
-
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
-
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3114,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3125,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5637,6 +5599,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.53.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-05-26 06:51 Pavel Stehule <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-05-26 06:51 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
fresh rebase
Regards
Pavel
Attachments:
[text/x-patch] v20260526-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (37.0K, ../../CAFj8pRAS5_1ObWfM-eNP6ei60bdLw884BpAa=Z7bAmw9WiSxFQ@mail.gmail.com/3-v20260526-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From 78a4eb85d8a4cf9b2aaa6082bcbadc46a7472e60 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 97 +++++-
src/backend/utils/adt/jsonbsubs.c | 181 ++++++++++-
src/include/nodes/subscripting.h | 29 ++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 297 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 189 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 1016 insertions(+), 97 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..a42248ed633 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,96 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ForeachAArrayIterState;
+
+static bool
+foreach_a_array_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAArrayIterState *iter = (ForeachAArrayIterState *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * Used by plpgsql FOREACH IN ARRAY when input expression is an array
+ */
+static ForeachAIterator *
+create_foreach_a_array_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAArrayIterState *iter = palloc0(sizeof(ForeachAArrayIterState));
+ ArrayType *arr;
+ Oid target_elem_typid;
+
+ /* check the type of the expression - must be an array */
+ if (!OidIsValid(get_element_type(typid)))
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH expression must yield an array, not type %s",
+ format_type_be(typid))));
+
+ /*
+ * We must copy the array into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ arr = DatumGetArrayTypePCopy(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ /*
+ * Sanity-check the target type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(target_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH ... SLICE loop variable must be of an array type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH loop variable must not be of an array type")));
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = foreach_a_array_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +636,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +664,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..ad2edf525de 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid target_typid;
+ int32 target_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} ForeachAJsonbIterState;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,172 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used in
+ * generic array iterator, that is used by FOREACH plpgsql
+ * statement. Against other cases, the result should not be
+ * necessary of expected_typid, because the value can be
+ * converted later when the value is assigned to PL/pgSQL
+ * variable. This can be more effective than generic IO
+ * cast used by json_populate_type.
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+foreach_a_jsonb_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAJsonbIterState *iter = (ForeachAJsonbIterState *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->target_typid, iter->target_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_foreach_a_jsonb_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAJsonbIterState *iter = palloc0(sizeof(ForeachAJsonbIterState));
+ Jsonb *jb;
+
+ if (typid != JSONBOID)
+ elog(ERROR, "unexpected source type");
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ /*
+ * We must copy the JSON into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ jb = DatumGetJsonbPCopy(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errhint("Cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errdetail("Cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ iter->target_typid = target_typid;
+ iter->target_typmod = target_typmod;
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = foreach_a_jsonb_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +585,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_jsonb_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..08bfe59ede4 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,32 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid target_typid,
+ int32 target_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +189,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..ddc571f3c79
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,297 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+HINT: Cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+DETAIL: Cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 65b0fd0790f..1c1d98157df 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,49 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3079,34 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
- * We must copy the array into stmt_mcontext, else it will disappear in
- * exec_eval_cleanup. This is annoying, but cleanup will certainly happen
- * while running the loop body, so we have little choice.
+ * inside iterator constroctor, the expr should be copied to
+ * current memory context (stmt_mcontext). Without it, it will be released
+ * by next exec_eval_cleanup. The iterator constructor should
+ * be called under stmt memory context.
*/
- arr = DatumGetArrayTypePCopy(value);
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
+ MemoryContextSwitchTo(tmp_cxt);
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
-
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
-
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3114,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3125,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5639,6 +5601,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.54.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-06-16 07:52 Pavel Stehule <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-06-16 07:52 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
rebase
Regards
Pavel
Attachments:
[text/x-patch] v20260616-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (37.0K, ../../CAFj8pRDT5LvSMNxorBROZk9Ma41Z_7_0w6Ynq3rn9X6dTocbaQ@mail.gmail.com/3-v20260616-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From c4581a4ae2025cf2240b5bda4d4d753fbb3166ea Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 97 +++++-
src/backend/utils/adt/jsonbsubs.c | 181 ++++++++++-
src/include/nodes/subscripting.h | 29 ++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 297 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 189 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 1016 insertions(+), 97 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..a42248ed633 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,96 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ForeachAArrayIterState;
+
+static bool
+foreach_a_array_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAArrayIterState *iter = (ForeachAArrayIterState *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * Used by plpgsql FOREACH IN ARRAY when input expression is an array
+ */
+static ForeachAIterator *
+create_foreach_a_array_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAArrayIterState *iter = palloc0(sizeof(ForeachAArrayIterState));
+ ArrayType *arr;
+ Oid target_elem_typid;
+
+ /* check the type of the expression - must be an array */
+ if (!OidIsValid(get_element_type(typid)))
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH expression must yield an array, not type %s",
+ format_type_be(typid))));
+
+ /*
+ * We must copy the array into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ arr = DatumGetArrayTypePCopy(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ /*
+ * Sanity-check the target type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(target_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH ... SLICE loop variable must be of an array type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("FOREACH loop variable must not be of an array type")));
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = foreach_a_array_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +636,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +664,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_array_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..ad2edf525de 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid target_typid;
+ int32 target_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} ForeachAJsonbIterState;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,172 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used in
+ * generic array iterator, that is used by FOREACH plpgsql
+ * statement. Against other cases, the result should not be
+ * necessary of expected_typid, because the value can be
+ * converted later when the value is assigned to PL/pgSQL
+ * variable. This can be more effective than generic IO
+ * cast used by json_populate_type.
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+foreach_a_jsonb_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ForeachAJsonbIterState *iter = (ForeachAJsonbIterState *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->target_typid, iter->target_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_foreach_a_jsonb_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid target_typid, int32 target_typmod)
+{
+ ForeachAJsonbIterState *iter = palloc0(sizeof(ForeachAJsonbIterState));
+ Jsonb *jb;
+
+ if (typid != JSONBOID)
+ elog(ERROR, "unexpected source type");
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ /*
+ * We must copy the JSON into current context, because input expression
+ * is evaluated in context cleaned by exec_eval_cleanup.
+ */
+ jb = DatumGetJsonbPCopy(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errhint("Cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("FOREACH expression must evaluate to a JSON array"),
+ errdetail("Cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ iter->target_typid = target_typid;
+ iter->target_typmod = target_typmod;
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = foreach_a_jsonb_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +585,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_foreach_a_jsonb_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..08bfe59ede4 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,32 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid target_typid,
+ int32 target_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +189,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..ddc571f3c79
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,297 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+HINT: Cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must evaluate to a JSON array
+DETAIL: Cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 65b0fd0790f..1c1d98157df 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,49 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3079,34 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
- * We must copy the array into stmt_mcontext, else it will disappear in
- * exec_eval_cleanup. This is annoying, but cleanup will certainly happen
- * while running the loop body, so we have little choice.
+ * inside iterator constroctor, the expr should be copied to
+ * current memory context (stmt_mcontext). Without it, it will be released
+ * by next exec_eval_cleanup. The iterator constructor should
+ * be called under stmt memory context.
*/
- arr = DatumGetArrayTypePCopy(value);
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
+ MemoryContextSwitchTo(tmp_cxt);
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
-
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
-
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3114,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3125,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5639,6 +5601,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.54.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-07-01 21:40 Tom Lane <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 2 replies; 58+ messages in thread
From: Tom Lane @ 2026-07-01 21:40 UTC (permalink / raw)
To: Pavel Stehule <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
I took a very quick look through the v20260616 patch.
I think you need to work harder on the separation of knowledge.
In particular I don't like that the type-specific setup routines
(create_foreach_a_array_iterator etc) contain so many assumptions that
they are being called from a PLpgsql FOREACH statement and nothing
else. IMO the point of putting this into the SubscriptRoutines
infrastructure is to make a general-purpose facility that could be
used by different things. So:
* it's not clear to me that these routines have any business knowing
about the "target type"; they certainly shouldn't contain comments
alluding to PLpgSQL's conversion abilities. I think probably you
just want them to pass back the data type they are producing and
let PLpgSQL decide whether it wants to convert or not.
* we need to think about how the error messages could be phrased more
generically, or else not have these functions throw those errors
themselves but instead pass back an error code that the caller could
use to select an error message. I suspect this will end up with
visible changes in the error messages produced by existing cases,
and that's okay IMO.
* memory management may need to be rethought a bit as well.
Certainly the comments referencing exec_eval_cleanup do not
belong here.
regards, tom lane
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-07-05 15:36 Pavel Stehule <[email protected]>
parent: Tom Lane <[email protected]>
1 sibling, 0 replies; 58+ messages in thread
From: Pavel Stehule @ 2026-07-05 15:36 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
st 1. 7. 2026 v 23:40 odesílatel Tom Lane <[email protected]> napsal:
> I took a very quick look through the v20260616 patch.
>
> I think you need to work harder on the separation of knowledge.
> In particular I don't like that the type-specific setup routines
> (create_foreach_a_array_iterator etc) contain so many assumptions that
> they are being called from a PLpgsql FOREACH statement and nothing
> else. IMO the point of putting this into the SubscriptRoutines
> infrastructure is to make a general-purpose facility that could be
> used by different things. So:
>
> * it's not clear to me that these routines have any business knowing
> about the "target type"; they certainly shouldn't contain comments
> alluding to PLpgSQL's conversion abilities. I think probably you
> just want them to pass back the data type they are producing and
> let PLpgSQL decide whether it wants to convert or not.
>
I changed the interface like you proposed. It reduces some code, but
introduces some new issues:
1. Because the iterator has no knowledge about target type, the json object
values cannot be assigned to a list of target values.
Our composites and JSON objects have not compatible IO format. With
knowledge of target type, I can force transformation from
jsonb to composite. There is not any generic API that can help with this,
and it can be implemented as part of the iterator. And in
this case IO cast can be a problem (if we support it) because jsonb doesn't
preserve an order of fields.
2. When I know the target is jsonb I don't need to immediately transform
jbvNull to NULL.
3. If I don't do any transformation inside the iterator and returns just an
iterated value, then I have a problem with often usage of IO cast - that is
more strict.
when I iterate over numeric array and target is int, then I got cast
int4(numeric) - "3.14 --> 3"
when I iterate over jsonb array and target is int, then I got IO cast -
there is int4(jsonb) cast, but this is explicit and then cast "3.14" to int
fails.
Maybe we can enhance plpgsql cast functions to see inside jsonb and then
can better to choose cast function.
This inconsistency is simply visible:
(2026-07-05 17:31:13) postgres=# do $$ declare t int; begin t :=
'3.14'::numeric; end $$;
DO
(2026-07-05 17:31:22) postgres=# do $$ declare t int; begin t :=
'3.14'::jsonb; end $$;
ERROR: invalid input syntax for type integer: "3.14"
CONTEXT: PL/pgSQL assignment "t := '3.14'::jsonb"
PL/pgSQL function inline_code_block line 1 at assignment
(2026-07-05 17:31:34) postgres=# do $$ declare t int; begin t :=
'3.14'::jsonb::int; end $$;
DO
>
> * we need to think about how the error messages could be phrased more
> generically, or else not have these functions throw those errors
> themselves but instead pass back an error code that the caller could
> use to select an error message. I suspect this will end up with
> visible changes in the error messages produced by existing cases,
> and that's okay IMO.
>
I think the error messages can be written more generically.
> * memory management may need to be rethought a bit as well.
> Certainly the comments referencing exec_eval_cleanup do not
> belong here.
>
I changed it,
Regards
Pavel
>
> regards, tom lane
>
Attachments:
[text/x-patch] v20260705-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (33.5K, ../../CAFj8pRA+tuLvb4kZVEeLjNOK7-oqKwdgTuBu3ofNGkVU4RO2RQ@mail.gmail.com/3-v20260705-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From fd4f76e8288287070e11883f648a3b68acea6d9d Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 69 ++++-
src/backend/utils/adt/jsonbsubs.c | 86 +++++-
src/include/nodes/subscripting.h | 27 ++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 289 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 186 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 883 insertions(+), 94 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..1785e63fdd7 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,68 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ArrayForeachAIterator;
+
+static bool
+array_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ArrayForeachAIterator *iter = (ArrayForeachAIterator *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * An array ForeachIterator constructor
+ */
+static ForeachAIterator *
+array_create_foreach_a_iterator(Datum value, Oid typid, int32 typmod, int slice)
+{
+ ArrayForeachAIterator *iter = palloc0(sizeof(ArrayForeachAIterator));
+ ArrayType *arr;
+
+ Assert(OidIsValid(get_element_type(typid)));
+
+ arr = DatumGetArrayTypeP(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = array_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +608,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = array_create_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +636,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = array_create_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..3a8fd86c00c 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,12 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+} JsonbForeachAIterator;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +401,82 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+
+static bool
+jsonb_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ JsonbForeachAIterator *iter = (JsonbForeachAIterator *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ if (jbv.type != jbvNull)
+ {
+ *value = PointerGetDatum(JsonbValueToJsonb(&jbv));
+ *isnull = false;
+ }
+ else
+ {
+ *value = (Datum) 0;
+ *isnull = true;
+ }
+
+ *typid = JSONBOID;
+ *typmod = -1;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+jsonb_create_foreach_a_iterator(Datum value, Oid typid, int32 typmod, int slice)
+{
+ JsonbForeachAIterator *iter = palloc0(sizeof(JsonbForeachAIterator));
+ Jsonb *jb;
+
+ Assert(typid == JSONBOID);
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb doesn't support slices")));
+
+ jb = DatumGetJsonbP(value);
+
+ /*
+ * Input value must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("Cannot iterate over a jsonb scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("Cannot iterate over an jsonb object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ iter->pub.iterate = jsonb_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +490,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = jsonb_create_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..2c54d50d8f0 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,30 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator is used by PLpgSQL FOREACH IN ARRAY statement.
+ * Input value should not be null, and inside CreateForeachAIterator
+ * routine must be copied to current (statement) context. "iterate"
+ * routine is called under short life memory context, that is resetted
+ * after any call.
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +187,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..96a4d4b26b9
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,289 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: Cannot iterate over a jsonb scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: Cannot iterate over an jsonb object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: invalid input syntax for type integer: ""10""
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+ERROR: cannot assign non-composite value to a row variable
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+ERROR: cannot assign non-composite value to a record variable
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+ERROR: cannot assign non-composite value to a row variable
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+ERROR: malformed array literal: "[1, 2, 3]"
+DETAIL: Missing "]" after array dimensions.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+ERROR: malformed array literal: "["Hi", "Hello"]"
+DETAIL: "[" must introduce explicitly-specified array dimensions.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+ERROR: malformed array literal: "["Hi", "Hello"]"
+DETAIL: "[" must introduce explicitly-specified array dimensions.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+ERROR: cannot assign non-composite value to a row variable
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+ERROR: cannot assign non-composite value to a record variable
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 65b0fd0790f..4cd88b0fa3b 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,51 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
+ int16 expr_typlen;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
+ bool expr_typbyval;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3081,35 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
* We must copy the array into stmt_mcontext, else it will disappear in
* exec_eval_cleanup. This is annoying, but cleanup will certainly happen
* while running the loop body, so we have little choice.
*/
- arr = DatumGetArrayTypePCopy(value);
+ get_typlenbyval(expr_typid, &expr_typlen, &expr_typbyval);
+ expr = datumCopy(expr, expr_typbyval, expr_typlen);
+
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
-
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
-
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
+ MemoryContextSwitchTo(tmp_cxt);
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3117,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3128,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5639,6 +5604,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.54.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-07-07 20:03 Pavel Stehule <[email protected]>
parent: Tom Lane <[email protected]>
1 sibling, 1 reply; 58+ messages in thread
From: Pavel Stehule @ 2026-07-07 20:03 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
st 1. 7. 2026 v 23:40 odesílatel Tom Lane <[email protected]> napsal:
> I took a very quick look through the v20260616 patch.
>
> I think you need to work harder on the separation of knowledge.
> In particular I don't like that the type-specific setup routines
> (create_foreach_a_array_iterator etc) contain so many assumptions that
> they are being called from a PLpgsql FOREACH statement and nothing
> else. IMO the point of putting this into the SubscriptRoutines
> infrastructure is to make a general-purpose facility that could be
> used by different things. So:
>
> * it's not clear to me that these routines have any business knowing
> about the "target type"; they certainly shouldn't contain comments
> alluding to PLpgSQL's conversion abilities. I think probably you
> just want them to pass back the data type they are producing and
> let PLpgSQL decide whether it wants to convert or not.
>
The iterator should know the target type for more reasons:
1. Only inside the iterator's implementation we can check things related to
slicing. PLpgSQL engine cannot have knowledge about slicing on some more
generic level.
2. Iterators can be implemented for types that have their own
implementation of composite values (jsonb objects). Iterators with
knowledge of the target type can do the correct transformation. Now, there
are not any generic casts between jsonb and composite types.
3. When iterator knows target type, then it can reduce some unwanted
transformations like JSONB->numeric->JSONB or can returns PostgreSQL scalar
types like numeric and can change cast from JSON->INT to NUMERIC->INT
(explicit casts has same result for numeric input, but implicit casts can
produce different results).
I dislike the fact, so target types (or expected types) are not enforced.
This makes the API dirty. But if I want to enforce cast to expected type
inside iterator implementation, then I need to move related code from
PL/pgSQL to core - but implemented casts rules are specific for PL/pgSQL
only.
Attached patch allows to not specify expected_type (use InvalidOid). In
this case the behaviour is exactly like you proposed, so maybe it can be a
way.
>
> * we need to think about how the error messages could be phrased more
> generically, or else not have these functions throw those errors
> themselves but instead pass back an error code that the caller could
> use to select an error message. I suspect this will end up with
> visible changes in the error messages produced by existing cases,
> and that's okay IMO.
>
I changed messages to be more generic
>
> * memory management may need to be rethought a bit as well.
> Certainly the comments referencing exec_eval_cleanup do not
> belong here.
>
changed
Best regards
Pavel
>
> regards, tom lane
>
Attachments:
[text/x-patch] v20260707-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (37.6K, ../../CAFj8pRC8uULe7Zk=j4DSUf0Xu2b=6_mEn=4PfKOYmP7rvES=1Q@mail.gmail.com/3-v20260707-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From 297873a5cc8aa6f750b26a06972b564621790917 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 92 +++++-
src/backend/utils/adt/jsonbsubs.c | 196 +++++++++++-
src/include/nodes/subscripting.h | 37 +++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 295 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 187 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
10 files changed, 1033 insertions(+), 94 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..844ffe92301 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,91 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ArrayForeachAIterator;
+
+static bool
+array_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ArrayForeachAIterator *iter = (ArrayForeachAIterator *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * An array ForeachAIterator constructor
+ */
+static ForeachAIterator *
+create_array_foreach_a_iterator(Datum value, Oid typid, int32 typmod, int slice,
+ Oid expected_typid, int32 expected_typmod)
+{
+ ArrayForeachAIterator *iter = palloc0(sizeof(ArrayForeachAIterator));
+ ArrayType *arr;
+
+ Assert(OidIsValid(get_element_type(typid)));
+
+ arr = DatumGetArrayTypeP(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ if (OidIsValid(expected_typid))
+ {
+ Oid target_elem_typid;
+
+ /*
+ * Sanity-check the expected type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(expected_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot to cast a value of array type to scalar type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot to cast a value of scalar type to array type")));
+ }
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = array_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +631,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_array_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +659,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_array_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..e4929b33cec 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid expected_typid;
+ int32 expected_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} JsonbForeachAIterator;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,187 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used by
+ * generic array iterator. When expected_type is unknown
+ * or it is json or jsonb, then there are minimal transformations.
+ * When JsonValue is of basic types (string, numeric, bool),
+ * then value is converted to most near Postgres native types.
+ * In other cases, the generic transformation json_populate_type
+ * is used.
+ *
+ * The reason why generic transformation is not used by default
+ * are different cast rules, because it uses only implicit or
+ * IO casts, that are usually more restrictive. The cast
+ * JSONB->INT is more restrictive than casts JSONB->NUMERIC->INT.
+ *
+ * The type of result is of expected_typid, expected_typmod only
+ * when expected_typid is of composite type. Theoretically it can
+ * be converted to this type in all cases, but it requires more
+ * significant change of plpgsql code (the cast routines should be
+ * moved to core), and because (in this moment) only one user of
+ * generic array iterator is plpgsql FOREACH statement, then the
+ * cast to expected_type is not enforced here (for all cases).
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+jsonb_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ JsonbForeachAIterator *iter = (JsonbForeachAIterator *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->expected_typid, iter->expected_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_jsonb_foreach_a_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid expected_typid, int32 expected_typmod)
+{
+ JsonbForeachAIterator *iter = palloc0(sizeof(JsonbForeachAIterator));
+ Jsonb *jb;
+
+ Assert(typid == JSONBOID);
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ jb = DatumGetJsonbP(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ if (OidIsValid(expected_typid))
+ {
+ iter->expected_typid = expected_typid;
+ iter->expected_typmod = expected_typmod;
+ }
+ else
+ {
+ iter->expected_typid = JSONBOID;
+ iter->expected_typmod = -1;
+ }
+
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = jsonb_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +600,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_jsonb_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..4dd223d1ef9 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,40 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator allows an iteration over a container object
+ * like an array of jsonb's array. Containers can holds a values of
+ * different types, so in any iteration, the returned value can be
+ * of any different type. Containers can holds composite types in own
+ * binary formats (jsonb object). We cannot to do safe conversion to
+ * Postgres's generic composite type without extra knowledge,
+ * so a user can specify the expected type (when it is known).
+ * Expected type can be unspecified (InvalidOid), but when
+ * it is specified, then it can be used for some other special cases
+ * like transformation of jsonb jbvNull to NULL or to string "null".
+ * Although the expected type is specified, the iterator doesn't enforce
+ * the conversion to this type (because conversion rules can be different
+ * in possible environments (SQL, PL/pgSQL).
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid expected_typid,
+ int32 expected_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +197,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..787d7698bd0
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,295 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 65b0fd0790f..16bb15c2207 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,51 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ int16 expr_typlen;
+ bool expr_typbyval;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3081,36 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
* We must copy the array into stmt_mcontext, else it will disappear in
* exec_eval_cleanup. This is annoying, but cleanup will certainly happen
* while running the loop body, so we have little choice.
*/
- arr = DatumGetArrayTypePCopy(value);
+ get_typlenbyval(expr_typid, &expr_typlen, &expr_typbyval);
+ expr = datumCopy(expr, expr_typbyval, expr_typlen);
+
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
-
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
-
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
+ MemoryContextSwitchTo(tmp_cxt);
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3118,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3129,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5639,6 +5605,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
--
2.54.0
^ permalink raw reply [nested|flat] 58+ messages in thread
* Re: POC: PLpgSQL FOREACH IN JSON ARRAY
@ 2026-07-08 12:44 Pavel Stehule <[email protected]>
parent: Pavel Stehule <[email protected]>
0 siblings, 0 replies; 58+ messages in thread
From: Pavel Stehule @ 2026-07-08 12:44 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi
fix regress tests
Regards
Pavel
Attachments:
[text/x-patch] v20260708-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch (38.4K, ../../CAFj8pRA9PAhFxkhd0PXGz2Nrq2VKtGczKoWN1EvYZ11gRJ0E3w@mail.gmail.com/3-v20260708-0001-FOREACH-scalar-IN-ARRAY-jsonb_expr.patch)
download | inline diff:
From 70cc5eaae3bbc602e2faadf70f0e684f2e310591 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 23 Feb 2026 12:53:44 +0100
Subject: [PATCH] FOREACH scalar IN ARRAY jsonb_expr
this patch introduce support FOREACH scalar_var IN ARRAY expr, when the
result of the expression can be Jsonb. The design is based
on behave of jsonb_array_elements functions. In this case, FOREACH enforce
casting to target type (because we know target type) and try to reduce
IO casting. Attention: IO casting can be more strict, then casting based
on cast functions.
DECLARE t int;
BEGIN
-- this can work because we use cast numeric -> int
FOREACH t IN ARRAY '[1,2,3.14]'::jsonb
LOOP
-- this fails, because IO cast is used, and integer input function
-- allows only digits
FOREAC t IN JSON ARRAY '[1,2,3,"3.14"]'::jsonb
LOOP
Conceptual question is if casting should be strict like "old" PostgreSQL
json function or lax as "new" SQL/JSON functions? I can imagine lax mode
as default with possibility to switch to strict mode (this is not implemented
now):
FOREACH t IN ARRAY '[1,2,3]' ERROR ON EMPTY ERROR ON ERROR
LOOP
...
Because we use "old" syntax - FOREACH IN ARRAY, I prefer "old" behaviour,
that is more similar to iteration over an array.
The performance (best case for iteration over 1000 fields array) is about
4x better than when FOR IN SELECT jsonb_array_elements is used.
---
doc/src/sgml/plpgsql.sgml | 62 +++-
src/backend/utils/adt/arraysubs.c | 92 +++++-
src/backend/utils/adt/jsonbsubs.c | 196 +++++++++++-
src/include/nodes/subscripting.h | 37 +++
src/pl/plpgsql/src/Makefile | 2 +-
.../plpgsql/src/expected/plpgsql_foreach.out | 295 ++++++++++++++++++
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpgsql/src/pl_exec.c | 187 +++++------
src/pl/plpgsql/src/plpgsql.h | 3 +-
src/pl/plpgsql/src/sql/plpgsql_foreach.sql | 252 +++++++++++++++
src/test/regress/expected/plpgsql.out | 4 +-
11 files changed, 1035 insertions(+), 96 deletions(-)
create mode 100644 src/pl/plpgsql/src/expected/plpgsql_foreach.out
create mode 100644 src/pl/plpgsql/src/sql/plpgsql_foreach.sql
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 561f6e50d63..6bc9fb02e1e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2697,12 +2697,12 @@ END LOOP <optional> <replaceable>label</replaceable> </optional>;
</sect2>
<sect2 id="plpgsql-foreach-array">
- <title>Looping through Arrays</title>
+ <title>Looping through Arrays or Jsonb arrays</title>
<para>
The <literal>FOREACH</literal> loop is much like a <literal>FOR</literal> loop,
but instead of iterating through the rows returned by an SQL query,
- it iterates through the elements of an array value.
+ it iterates through the elements of an array value or of jsonb array value.
(In general, <literal>FOREACH</literal> is meant for looping through
components of a composite-valued expression; variants for looping
through composites besides arrays may be added in future.)
@@ -2778,6 +2778,64 @@ NOTICE: row = {7,8,9}
NOTICE: row = {10,11,12}
</programlisting>
</para>
+
+ <para>
+ The <literal>SLICE</literal> higher than zero cannot be used when iterates
+ through jsonb arrays.
+ </para>
+
+ <para>
+ The <literal>FOREACH</literal> loop over jsonb arrays uses
+ same syntax like <literal>FOREACH</literal> loop over arrays,
+ but instead of iterating through elements of the array,
+ it iterates through the elements of a Jsonb array value.
+ </para>
+
+ <para>
+ The target can be a scalar variable, a composite variable, or a list
+ of scalar variables. When variable is not scalar, then assigned value
+ should be a JSON object and the JSON attributes are assigned by names.
+
+<programlisting>
+CREATE FUNCTION print_elements(jsonb) RETURNS void AS $$
+DECLARE
+ x int;
+BEGIN
+ FOREACH x IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'row = %', x;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_elements('[1,2,3]');
+NOTICE: row = 1
+NOTICE: row = 2
+NOTICE: row = 3
+
+CREATE FUNCTION print_fields(jsonb) RETURNS void AS $$
+DECLARE
+ x int; y varchar;
+BEGIN
+ FOREACH x, y IN ARRAY $1
+ LOOP
+ RAISE NOTICE 'x: %, y: %', x, y;
+ END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT print_fields('[{},{"x":10},{"y":"Hi"},{"y":"Hi", "x":1000}]');
+NOTICE: x: <NULL>, y: <NULL>
+NOTICE: x: 10, y: <NULL>
+NOTICE: x: <NULL>, y: Hi
+NOTICE: x: 1000, y: Hi
+</programlisting>
+ </para>
+
+ <para>
+ The target variable can be of type <literal>RECORD</literal>, but the real structure has to be
+ assigned before usage in the <literal>FOREACH</literal> statement.
+ </para>
</sect2>
<sect2 id="plpgsql-error-trapping">
diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c
index 2bf9e9509fb..844ffe92301 100644
--- a/src/backend/utils/adt/arraysubs.c
+++ b/src/backend/utils/adt/arraysubs.c
@@ -23,6 +23,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "utils/array.h"
+#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
@@ -46,6 +47,91 @@ typedef struct ArraySubWorkspace
int lowerindex[MAXDIM];
} ArraySubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ ArrayIterator it;
+ Oid result_typid;
+ int32 result_typmod;
+} ArrayForeachAIterator;
+
+static bool
+array_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ ArrayForeachAIterator *iter = (ArrayForeachAIterator *) self;
+
+ *typid = iter->result_typid;
+ *typmod = iter->result_typmod;
+
+ return array_iterate(iter->it, value, isnull);
+}
+
+/*
+ * An array ForeachAIterator constructor
+ */
+static ForeachAIterator *
+create_array_foreach_a_iterator(Datum value, Oid typid, int32 typmod, int slice,
+ Oid expected_typid, int32 expected_typmod)
+{
+ ArrayForeachAIterator *iter = palloc0(sizeof(ArrayForeachAIterator));
+ ArrayType *arr;
+
+ Assert(OidIsValid(get_element_type(typid)));
+
+ arr = DatumGetArrayTypeP(value);
+
+ /* Slice dimension must be less than or equal to array dimension */
+ if (slice < 0 || slice > ARR_NDIM(arr))
+ ereport(ERROR,
+ (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
+ errmsg("slice dimension (%d) is out of the valid range 0..%d",
+ slice, ARR_NDIM(arr))));
+
+ if (OidIsValid(expected_typid))
+ {
+ Oid target_elem_typid;
+
+ /*
+ * Sanity-check the expected type. We don't try very hard here, and
+ * should not be too picky since it's possible that exec_assign_value can
+ * coerce values of different types. But it seems worthwhile to complain
+ * if the array-ness of the loop variable is not right.
+ */
+ target_elem_typid = get_element_type(expected_typid);
+
+ if (slice > 0 && target_elem_typid == InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot to cast a value of array type to scalar type")));
+ if (slice == 0 && target_elem_typid != InvalidOid)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot to cast a value of scalar type to array type")));
+ }
+
+ /* Identify iterator result type */
+ if (slice > 0)
+ {
+ /* When slicing, nominal type of result is same as array type */
+ iter->result_typid = typid;
+ iter->result_typmod = typmod;
+ }
+ else
+ {
+ /* Without slicing, results are individual array elements */
+ iter->result_typid = ARR_ELEMTYPE(arr);
+ iter->result_typmod = typmod;
+ }
+
+ /* Create an iterator to step through the array */
+ iter->it = array_create_iterator(arr, slice, NULL);
+
+ iter->pub.iterate = array_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
/*
* Finish parse analysis of a SubscriptingRef expression for an array.
@@ -545,7 +631,8 @@ array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_array_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
@@ -572,7 +659,8 @@ raw_array_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = array_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_array_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c
index f2745b29a3f..e4929b33cec 100644
--- a/src/backend/utils/adt/jsonbsubs.c
+++ b/src/backend/utils/adt/jsonbsubs.c
@@ -22,6 +22,7 @@
#include "parser/parse_expr.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
+#include "utils/jsonfuncs.h"
/* SubscriptingRefState.workspace for jsonb subscripting execution */
@@ -33,6 +34,17 @@ typedef struct JsonbSubWorkspace
Datum *index; /* Subscript values in Datum format */
} JsonbSubWorkspace;
+typedef struct
+{
+ ForeachAIterator pub;
+ JsonbIterator *it;
+ bool skip_nested;
+ Oid expected_typid;
+ int32 expected_typmod;
+
+ MemoryContext cache_mcxt;
+ void *cache;
+} JsonbForeachAIterator;
/*
* Finish parse analysis of a SubscriptingRef expression for a jsonb.
@@ -394,6 +406,187 @@ jsonb_exec_setup(const SubscriptingRef *sbsref,
methods->sbs_fetch_old = jsonb_subscript_fetch_old;
}
+/*
+ * Convert JsonbValue to Datum. This function is used by
+ * generic array iterator. When expected_type is unknown
+ * or it is json or jsonb, then there are minimal transformations.
+ * When JsonValue is of basic types (string, numeric, bool),
+ * then value is converted to most near Postgres native types.
+ * In other cases, the generic transformation json_populate_type
+ * is used.
+ *
+ * The reason why generic transformation is not used by default
+ * are different cast rules, because it uses only implicit or
+ * IO casts, that are usually more restrictive. The cast
+ * JSONB->INT is more restrictive than casts JSONB->NUMERIC->INT.
+ *
+ * The type of result is of expected_typid, expected_typmod only
+ * when expected_typid is of composite type. Theoretically it can
+ * be converted to this type in all cases, but it requires more
+ * significant change of plpgsql code (the cast routines should be
+ * moved to core), and because (in this moment) only one user of
+ * generic array iterator is plpgsql FOREACH statement, then the
+ * cast to expected_type is not enforced here (for all cases).
+ */
+static Datum
+JsonbValueToDatum(JsonbValue *jbv,
+ Oid *typid, int32 *typmod, bool *isnull,
+ Oid expected_typid, int32 expected_typmod,
+ void **cache, MemoryContext mcxt)
+{
+ Datum result;
+
+ *isnull = false;
+ *typmod = -1;
+
+ /*
+ * These types can holds JSON null, so must be processed
+ * before processing jbvNull. We don't want to convert
+ * JSON null, to SQL null, when targer is of JSON.
+ */
+ if (expected_typid == JSONBOID || expected_typid == JSONOID)
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ if (expected_typid == JSONOID)
+ {
+ char *str;
+
+ str = JsonbToCString(NULL, &jb->root, VARSIZE(jb));
+ result = PointerGetDatum(cstring_to_text(str));
+ }
+ else
+ result = PointerGetDatum(jb);
+
+ *typid = expected_typid;
+ }
+
+ /*
+ * For special cases we can skip conversion to Jsonb
+ * and possibly IO cast.
+ */
+ else if (jbv->type == jbvNull)
+ {
+ result = (Datum) 0;
+ *isnull = true;
+ *typid = expected_typid;
+ }
+ else if (jbv->type == jbvString)
+ {
+ text *txt = cstring_to_text_with_len(jbv->val.string.val,
+ jbv->val.string.len);
+
+ result = PointerGetDatum(txt);
+ *typid = TEXTOID;
+ }
+ else if (jbv->type == jbvNumeric)
+ {
+ result = PointerGetDatum(jbv->val.numeric);
+ *typid = NUMERICOID;
+ }
+ else if (jbv->type == jbvBool)
+ {
+ result = BoolGetDatum(jbv->val.boolean);
+ *typid = BOOLOID;
+ }
+
+ /* generic conversion */
+ else
+ {
+ Jsonb *jb = JsonbValueToJsonb(jbv);
+
+ result = json_populate_type(PointerGetDatum(jb), JSONBOID,
+ expected_typid, expected_typmod,
+ cache, mcxt,
+ isnull, false, NULL);
+
+ *typid = expected_typid;
+ *typmod = expected_typmod;
+ }
+
+ return result;
+}
+
+static bool
+jsonb_foreach_a_iterate(ForeachAIterator *self,
+ Datum *value, bool *isnull,
+ Oid *typid, int32 *typmod)
+{
+ JsonbForeachAIterator *iter = (JsonbForeachAIterator *) self;
+ JsonbIteratorToken r;
+ JsonbValue jbv;
+
+ while ((r = JsonbIteratorNext(&iter->it, &jbv, iter->skip_nested)) != WJB_DONE)
+ {
+ iter->skip_nested = true;
+
+ if (r == WJB_ELEM)
+ {
+ *value = JsonbValueToDatum(&jbv, typid, typmod, isnull,
+ iter->expected_typid, iter->expected_typmod,
+ &iter->cache, iter->cache_mcxt);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+ * Create foreach array iterator for jsonb array
+ */
+static ForeachAIterator *
+create_jsonb_foreach_a_iterator(Datum value, Oid typid, int32 typmod,
+ int slice, Oid expected_typid, int32 expected_typmod)
+{
+ JsonbForeachAIterator *iter = palloc0(sizeof(JsonbForeachAIterator));
+ Jsonb *jb;
+
+ Assert(typid == JSONBOID);
+
+ if (slice > 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("jsonb array iterator doesn't support slicing")));
+
+ jb = DatumGetJsonbP(value);
+
+ /*
+ * Jsonb iterator is designed like jsonb_array_element. Input value
+ * must be json array.
+ */
+ if (JB_ROOT_IS_SCALAR(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot iterate over a scalar value.")));
+ else if (JB_ROOT_IS_OBJECT(jb))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("cannot iterate over an object value.")));
+
+ Assert(JB_ROOT_IS_ARRAY(jb));
+
+ iter->it = JsonbIteratorInit(&jb->root);
+
+ if (OidIsValid(expected_typid))
+ {
+ iter->expected_typid = expected_typid;
+ iter->expected_typmod = expected_typmod;
+ }
+ else
+ {
+ iter->expected_typid = JSONBOID;
+ iter->expected_typmod = -1;
+ }
+
+ iter->cache_mcxt = CurrentMemoryContext;
+
+ iter->pub.iterate = jsonb_foreach_a_iterate;
+
+ return (ForeachAIterator *) iter;
+}
+
/*
* jsonb_subscript_handler
* Subscripting handler for jsonb.
@@ -407,7 +600,8 @@ jsonb_subscript_handler(PG_FUNCTION_ARGS)
.exec_setup = jsonb_exec_setup,
.fetch_strict = true, /* fetch returns NULL for NULL inputs */
.fetch_leakproof = true, /* fetch returns NULL for bad subscript */
- .store_leakproof = false /* ... but assignment throws error */
+ .store_leakproof = false, /* ... but assignment throws error */
+ .create_foreach_a_iterator = create_jsonb_foreach_a_iterator
};
PG_RETURN_POINTER(&sbsroutines);
diff --git a/src/include/nodes/subscripting.h b/src/include/nodes/subscripting.h
index 301f21dac2f..4dd223d1ef9 100644
--- a/src/include/nodes/subscripting.h
+++ b/src/include/nodes/subscripting.h
@@ -154,6 +154,40 @@ typedef void (*SubscriptExecSetup) (const SubscriptingRef *sbsref,
SubscriptingRefState *sbsrefstate,
SubscriptExecSteps *methods);
+typedef struct _ForeachAIterator ForeachAIterator;
+
+/*
+ * ForeachAIiterator allows an iteration over a container object
+ * like an array of jsonb's array. Containers can holds a values of
+ * different types, so in any iteration, the returned value can be
+ * of any different type. Containers can holds composite types in own
+ * binary formats (jsonb object). We cannot to do safe conversion to
+ * Postgres's generic composite type without extra knowledge,
+ * so a user can specify the expected type (when it is known).
+ * Expected type can be unspecified (InvalidOid), but when
+ * it is specified, then it can be used for some other special cases
+ * like transformation of jsonb jbvNull to NULL or to string "null".
+ * Although the expected type is specified, the iterator doesn't enforce
+ * the conversion to this type (because conversion rules can be different
+ * in possible environments (SQL, PL/pgSQL).
+ */
+struct _ForeachAIterator
+{
+ bool (*iterate) (ForeachAIterator *self,
+ Datum *value,
+ bool *isnull,
+ Oid *typid,
+ int32 *typmod);
+ /* Private fields might appear beyond this point... */
+};
+
+typedef ForeachAIterator * (*CreateForeachAIterator) (Datum value,
+ Oid typid,
+ int32 typmod,
+ int slice,
+ Oid expected_typid,
+ int32 expected_typmod);
+
/* Struct returned by the SQL-visible subscript handler function */
typedef struct SubscriptRoutines
{
@@ -163,6 +197,9 @@ typedef struct SubscriptRoutines
bool fetch_leakproof; /* is fetch SubscriptingRef leakproof? */
bool store_leakproof; /* is assignment SubscriptingRef
* leakproof? */
+
+ /* returns iterator used by PL/pgSQL FOREACH statement */
+ CreateForeachAIterator create_foreach_a_iterator;
} SubscriptRoutines;
#endif /* SUBSCRIPTING_H */
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 63cb96fae3e..5bd0cf31dfc 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -35,7 +35,7 @@ REGRESS_OPTS = --dbname=$(PL_TESTDB)
REGRESS = plpgsql_array plpgsql_cache plpgsql_call plpgsql_control \
plpgsql_copy plpgsql_domain plpgsql_misc \
plpgsql_record plpgsql_simple plpgsql_transaction \
- plpgsql_trap plpgsql_trigger plpgsql_varprops
+ plpgsql_trap plpgsql_trigger plpgsql_varprops plpgsql_foreach
# where to find gen_keywordlist.pl and subsidiary files
TOOLSDIR = $(top_srcdir)/src/tools
diff --git a/src/pl/plpgsql/src/expected/plpgsql_foreach.out b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
new file mode 100644
index 00000000000..787d7698bd0
--- /dev/null
+++ b/src/pl/plpgsql/src/expected/plpgsql_foreach.out
@@ -0,0 +1,295 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: FOREACH expression must not be null
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: cannot iterate over a scalar value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+ERROR: cannot iterate over an object value.
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: <NULL>
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3
+NOTICE: <NULL>
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: 10
+NOTICE: FOUND: t
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+NOTICE: FOUND: f
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+ERROR: invalid input syntax for type integer: "3.14"
+CONTEXT: PL/pgSQL function inline_code_block line 4 at FOREACH over array
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+NOTICE: true
+NOTICE: false
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 10
+NOTICE: 20
+NOTICE: 30
+NOTICE: 3.14
+NOTICE: null
+NOTICE: "Hi"
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+create type t3 as (x int, y numeric, z varchar);
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+NOTICE: x: <NULL>, y: <NULL>, z: <NULL>
+NOTICE: x: <NULL>, y: <NULL>, z: Hi
+NOTICE: x: <NULL>, y: 3.14, z: <NULL>
+NOTICE: x: 10, y: 3.14, z: Hi
+drop type t3;
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3
+NOTICE: 4 5 6
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+NOTICE: Hi Hello
+NOTICE: Hello Hi
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+create type t2 as (x int[], y varchar);
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+NOTICE: 1 2 3, y: Hi
+NOTICE: 4 5 6, y: Hi
+drop type t2;
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 3
+NOTICE: 5
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+NOTICE: 1
+NOTICE: 2
+NOTICE: 3
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index 6ff27006cfc..609eed7a28d 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -88,6 +88,7 @@ tests += {
'plpgsql_trap',
'plpgsql_trigger',
'plpgsql_varprops',
+ 'plpgsql_foreach',
],
},
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 65b0fd0790f..16bb15c2207 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -29,6 +29,7 @@
#include "mb/stringinfo_mb.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
+#include "nodes/subscripting.h"
#include "nodes/supportnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
@@ -3026,40 +3027,51 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt)
return rc;
}
-
/* ----------
- * exec_stmt_foreach_a Loop over elements or slices of an array
- *
- * When looping over elements, the loop variable is the same type that the
- * array stores (eg: integer), when looping through slices, the loop variable
- * is an array of size and dimensions to match the size of the slice.
- * ----------
+ * exec_stmt_foreach_a Loop over elements in an array or jsonb array
+ * ----------
*/
static int
exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
{
- ArrayType *arr;
- Oid arrtype;
- int32 arrtypmod;
- PLpgSQL_datum *loop_var;
- Oid loop_var_elem_type;
- bool found = false;
+ Datum expr;
+ Oid expr_typid;
+ int32 expr_typmod;
+ int16 expr_typlen;
+ bool expr_typbyval;
+ bool isnull;
+ PLpgSQL_datum *target_var;
+ Oid target_typid;
+ int32 target_typmod;
+ Oid target_collation;
+ Datum value;
+ Oid typid;
+ int32 typmod;
int rc = PLPGSQL_RC_OK;
+ const struct SubscriptRoutines *sbroutines;
+ ForeachAIterator *iterator;
MemoryContext stmt_mcontext;
+ MemoryContext tmp_cxt;
MemoryContext oldcontext;
- ArrayIterator array_iterator;
- Oid iterator_result_type;
- int32 iterator_result_typmod;
- Datum value;
- bool isnull;
+ bool found = false;
- /* get the value of the array expression */
- value = exec_eval_expr(estate, stmt->expr, &isnull, &arrtype, &arrtypmod);
+ /* get the value of the expression */
+ expr = exec_eval_expr(estate, stmt->expr, &isnull,
+ &expr_typid, &expr_typmod);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("FOREACH expression must not be null")));
+ sbroutines = getSubscriptingRoutines(expr_typid, NULL);
+ if (!sbroutines)
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("cannot iterate over type %s because it does not support subscripting",
+ format_type_be(expr_typid))));
+
+ Assert(sbroutines->create_foreach_a_iterator);
+
/*
* Do as much as possible of the code below in stmt_mcontext, to avoid any
* leaks from called subroutines. We need a private stmt_mcontext since
@@ -3069,79 +3081,36 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
push_stmt_mcontext(estate);
oldcontext = MemoryContextSwitchTo(stmt_mcontext);
- /* check the type of the expression - must be an array */
- if (!OidIsValid(get_element_type(arrtype)))
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH expression must yield an array, not type %s",
- format_type_be(arrtype))));
+ /* Set up the target (loop) variable */
+ target_var = estate->datums[stmt->varno];
+
+ plpgsql_exec_get_datum_type_info(estate, target_var,
+ &target_typid, &target_typmod,
+ &target_collation);
/*
* We must copy the array into stmt_mcontext, else it will disappear in
* exec_eval_cleanup. This is annoying, but cleanup will certainly happen
* while running the loop body, so we have little choice.
*/
- arr = DatumGetArrayTypePCopy(value);
+ get_typlenbyval(expr_typid, &expr_typlen, &expr_typbyval);
+ expr = datumCopy(expr, expr_typbyval, expr_typlen);
+
+ iterator = sbroutines->create_foreach_a_iterator(expr,
+ expr_typid, expr_typmod,
+ stmt->slice, target_typid,
+ target_typmod);
/* Clean up any leftover temporary memory */
exec_eval_cleanup(estate);
- /* Slice dimension must be less than or equal to array dimension */
- if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr))
- ereport(ERROR,
- (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
- errmsg("slice dimension (%d) is out of the valid range 0..%d",
- stmt->slice, ARR_NDIM(arr))));
-
- /* Set up the loop variable and see if it is of an array type */
- loop_var = estate->datums[stmt->varno];
- if (loop_var->dtype == PLPGSQL_DTYPE_REC ||
- loop_var->dtype == PLPGSQL_DTYPE_ROW)
- {
- /*
- * Record/row variable is certainly not of array type, and might not
- * be initialized at all yet, so don't try to get its type
- */
- loop_var_elem_type = InvalidOid;
- }
- else
- loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate,
- loop_var));
-
- /*
- * Sanity-check the loop variable type. We don't try very hard here, and
- * should not be too picky since it's possible that exec_assign_value can
- * coerce values of different types. But it seems worthwhile to complain
- * if the array-ness of the loop variable is not right.
- */
- if (stmt->slice > 0 && loop_var_elem_type == InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH ... SLICE loop variable must be of an array type")));
- if (stmt->slice == 0 && loop_var_elem_type != InvalidOid)
- ereport(ERROR,
- (errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("FOREACH loop variable must not be of an array type")));
-
- /* Create an iterator to step through the array */
- array_iterator = array_create_iterator(arr, stmt->slice, NULL);
+ tmp_cxt = AllocSetContextCreate(stmt_mcontext,
+ "FOREACH IN ARRAY temporary cxt",
+ ALLOCSET_DEFAULT_SIZES);
- /* Identify iterator result type */
- if (stmt->slice > 0)
- {
- /* When slicing, nominal type of result is same as array type */
- iterator_result_type = arrtype;
- iterator_result_typmod = arrtypmod;
- }
- else
- {
- /* Without slicing, results are individual array elements */
- iterator_result_type = ARR_ELEMTYPE(arr);
- iterator_result_typmod = arrtypmod;
- }
+ MemoryContextSwitchTo(tmp_cxt);
- /* Iterate over the array elements or slices */
- while (array_iterate(array_iterator, &value, &isnull))
+ while (iterator->iterate(iterator, &value, &isnull, &typid, &typmod))
{
found = true; /* looped at least once */
@@ -3149,12 +3118,9 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
MemoryContextSwitchTo(oldcontext);
/* Assign current element/slice to the loop variable */
- exec_assign_value(estate, loop_var, value, isnull,
- iterator_result_type, iterator_result_typmod);
+ exec_assign_value(estate, target_var, value, isnull, typid, typmod);
- /* In slice case, value is temporary; must free it to avoid leakage */
- if (stmt->slice > 0)
- pfree(DatumGetPointer(value));
+ MemoryContextReset(tmp_cxt);
/*
* Execute the statements
@@ -3163,7 +3129,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt)
LOOP_RC_PROCESSING(stmt->label, break);
- MemoryContextSwitchTo(stmt_mcontext);
+ MemoryContextSwitchTo(tmp_cxt);
}
/* Restore memory context state */
@@ -5639,6 +5605,53 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate,
break;
}
+ case PLPGSQL_DTYPE_ROW:
+ {
+ PLpgSQL_row *row = (PLpgSQL_row *) datum;
+
+ if (!row->rowtupdesc)
+ {
+ int i;
+
+ row->rowtupdesc = CreateTemplateTupleDesc(row->nfields);
+
+ for (i = 0; i < row->nfields; i++)
+ {
+ PLpgSQL_datum *var = estate->datums[row->varnos[i]];
+ Oid vartypid;
+ int32 vartypmod;
+ Oid varcollation;
+
+ /*
+ * We cannot use fieldnames for tupdescentry, because
+ * these names can be suffixed by name of row variable.
+ * Unfortunately, the PLpgSQL_recfield is not casted to
+ * PLpgSQL_variable.
+ */
+ plpgsql_exec_get_datum_type_info(estate, var,
+ &vartypid, &vartypmod,
+ &varcollation);
+
+ TupleDescInitEntry(row->rowtupdesc, i + 1,
+ var->refname, vartypid, vartypmod,
+ 0);
+ TupleDescInitEntryCollation(row->rowtupdesc, i + 1,
+ varcollation);
+ }
+
+ TupleDescFinalize(row->rowtupdesc);
+
+ /* Make sure we have a valid type/typmod setting */
+ BlessTupleDesc(row->rowtupdesc);
+ }
+
+ *typeId = row->rowtupdesc->tdtypeid;
+ *typMod = row->rowtupdesc->tdtypmod;
+ /* composite types are never collatable */
+ *collation = InvalidOid;
+ break;
+ }
+
case PLPGSQL_DTYPE_REC:
{
PLpgSQL_rec *rec = (PLpgSQL_rec *) datum;
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index addb14a9959..5cbdb4ecd9d 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -299,6 +299,7 @@ typedef struct PLpgSQL_datum
{
PLpgSQL_datum_type dtype;
int dno;
+ char *refname;
} PLpgSQL_datum;
/*
@@ -444,9 +445,9 @@ typedef struct PLpgSQL_recfield
{
PLpgSQL_datum_type dtype;
int dno;
+ char *fieldname; /* name of field */
/* end of PLpgSQL_datum fields */
- char *fieldname; /* name of field */
int recparentno; /* dno of parent record */
int nextfield; /* dno of next child, or -1 if none */
uint64 rectupledescid; /* record's tupledesc ID as of last lookup */
diff --git a/src/pl/plpgsql/src/sql/plpgsql_foreach.sql b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
new file mode 100644
index 00000000000..a64004417af
--- /dev/null
+++ b/src/pl/plpgsql/src/sql/plpgsql_foreach.sql
@@ -0,0 +1,252 @@
+-- input must be a JSON array
+do $$
+declare x numeric;
+begin
+ foreach x in array NULL::jsonb -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '10' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '{}' -- fail
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to numeric
+do $$
+declare x numeric;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- numeric to int by cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[10]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- test of FOUND variable
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[]'
+ loop
+ raise notice '%', x;
+ end loop;
+ raise notice 'FOUND: %', found;
+end;
+$$;
+
+-- conversion "3.14" to int should to fail due IO cast
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '["10",20,30,"3.14"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x boolean;
+begin
+ foreach x in array jsonb '[true, false]'
+ loop
+ if x then
+ raise notice 'true';
+ else
+ raise notice 'false';
+ end if;
+ end loop;
+end;
+$$;
+
+-- jsonb to jsonb
+do $$
+declare x jsonb;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- jsonb to json
+do $$
+declare x json;
+begin
+ foreach x in array jsonb '[10,20,30,3.14, null, "Hi"]'
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- iteration over composites
+do $$
+declare x int; y numeric; z varchar;
+begin
+ foreach x, y, z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', x, y, z;
+ end loop;
+end;
+$$;
+
+create type t3 as (x int, y numeric, z varchar);
+
+do $$
+declare c t3;
+begin
+ foreach c in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+do $$
+declare c t3;
+begin
+ foreach c.x, c.y, c.z in array jsonb '[{}, {"z":"Hi"}, {"y": 3.14}, {"z":"Hi", "x":10, "y":3.14}]'
+ loop
+ raise notice 'x: %, y: %, z: %', c.x, c.y, c.z;
+ end loop;
+end;
+$$;
+
+drop type t3;
+
+-- target can be a array
+do $$
+declare x int[];
+begin
+ foreach x in array jsonb '[[1,2,3],[4,5,6]]'
+ loop
+ raise notice '% % %', x[1], x[2], x[3];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x varchar[];
+begin
+ foreach x in array jsonb '[["Hi","Hello"],["Hello","Hi"]]'
+ loop
+ raise notice '% %', x[1], x[2];
+ end loop;
+end;
+$$;
+
+do $$
+declare x int[]; y varchar;
+begin
+ foreach x, y in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', x[1], x[2], x[3], y;
+ end loop;
+end;
+$$;
+
+create type t2 as (x int[], y varchar);
+
+do $$
+declare c t2;
+begin
+ foreach c in array jsonb '[{"x":[1,2,3], "y":"Hi"}, {"x":[4,5,6], "y":"Hi"}]'
+ loop
+ raise notice '% % %, y: %', c.x[1], c.x[2], c.x[3], c.y;
+ end loop;
+end;
+$$;
+
+drop type t2;
+
+-- EXIT and CONTINUE can be triggered by LOOP_RC_PROCESSING
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ exit when x = 3;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+do $$
+declare x int;
+begin
+ foreach x in array jsonb '[1,2,3,4,5]'
+ loop
+ continue when x % 2 = 0;
+ raise notice '%', x;
+ end loop;
+end;
+$$;
+
+-- Variable instead of string
+DO $$
+declare
+ x int;
+ arr jsonb;
+begin
+ select jsonb_agg(i) into arr
+ from generate_series(1,3) g(i);
+
+ foreach x in array arr
+ loop
+ raise notice '%', x;
+ end loop;
+end;
+$$;
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index b37b2abaf80..4f0187f6714 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -4869,10 +4869,10 @@ begin
$$ language plpgsql;
-- should fail
select foreach_test(ARRAY[1,2,3,4]);
-ERROR: FOREACH ... SLICE loop variable must be of an array type
+ERROR: cannot to cast a value of array type to scalar type
CONTEXT: PL/pgSQL function foreach_test(anyarray) line 4 at FOREACH over array
select foreach_test(ARRAY[[1,2],[3,4]]);
-ERROR: FOREACH ... SLICE loop variable must be of an array type
+ERROR: cannot to cast a value of array type to scalar type
CONTEXT: PL/pgSQL function foreach_test(anyarray) line 4 at FOREACH over array
create or replace function foreach_test(anyarray)
returns void as $$
--
2.54.0
^ permalink raw reply [nested|flat] 58+ messages in thread
end of thread, other threads:[~2026-07-08 12:44 UTC | newest]
Thread overview: 58+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2020-04-12 03:57 [PATCH] remove deprecated v8.2 containment operators Justin Pryzby <[email protected]>
2026-02-28 07:10 POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-03-11 20:57 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Peter Eisentraut <[email protected]>
2026-03-12 07:00 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-03-17 06:58 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-03-21 18:40 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-05-26 06:51 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-06-16 07:52 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-07-01 21:40 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Tom Lane <[email protected]>
2026-07-05 15:36 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-07-07 20:03 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
2026-07-08 12:44 ` Re: POC: PLpgSQL FOREACH IN JSON ARRAY Pavel Stehule <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox