From fc43fc8a2ac1cb894309fc4ab5646fcefebda302 Mon Sep 17 00:00:00 2001 From: Ed Sabol Date: Fri, 15 Sep 2023 02:32:06 -0400 Subject: [PATCH 01/40] Minor correction to README.pg_sphere Oops! This PR corrects a copy/paste/edit error in the README installation update instructions. --- README.pg_sphere | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.pg_sphere b/README.pg_sphere index 95a2563a..be6b40fb 100644 --- a/README.pg_sphere +++ b/README.pg_sphere @@ -54,7 +54,7 @@ UPDATING AN EXISTING INSTALLATION: -- same make and make install steps as above, but, instead of the CREATE -- EXTENSION step, you need to do: - psql -c "ALTER EXTENSION q3c UPDATE TO 'A.B.C';" + psql -c "ALTER EXTENSION pg_sphere UPDATE TO 'A.B.C';" -- where A.B.C is a placeholder for the current version. -- You also may want to check what version of pgSphere is installed using From 3568f70f17dabab828abc2da528d83056b65a868 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 13 Sep 2023 14:54:02 +0300 Subject: [PATCH 02/40] Migrate doc generation to docbook/fop (postgresql approach) The document generation was redesigned to use the same approach as postgresql does. It uses fop for printable doc generation and xsltproc for html generation. Postgresql stylesheets are used (with some minor changes). Fixed version propagation when generating the doc. Now, the version is placed in Makefile.common.mk file that is used in doc generation process. The following make rules were implemented: - make pdf (generates printable doc in A4 and US Letter format) - make pg_sphere--A4.pdf (generate the printable doc in A4) - make pg_sphere--US.pdf (generate the printable doc in USLetter) - make html (generates single-page and multi-page html) - make html-singlepage (generate single-page html only) - make html-multipage (generate multi-page html only) --- Makefile | 5 +- Makefile.common.mk | 8 + doc/Makefile | 121 +++-- doc/constructors.sgm | 59 ++- doc/examples.sgm | 52 +-- doc/functions.sgm | 145 +++--- doc/indices.sgm | 21 +- doc/install.sgm | 47 +- doc/jadetex.cfg-dist | 14 - doc/operators.sgm | 67 ++- doc/pg_sphere.css | 182 -------- doc/pg_sphere.dsl-dist | 330 ------------- doc/pg_sphere.xml | 69 +-- doc/stylesheets/stylesheet-common.xsl | 126 +++++ doc/stylesheets/stylesheet-fo.xsl | 147 ++++++ doc/stylesheets/stylesheet-html-common.xsl | 439 ++++++++++++++++++ doc/stylesheets/stylesheet-html-nochunk.xsl | 24 + doc/stylesheets/stylesheet-man.xsl | 226 +++++++++ doc/stylesheets/stylesheet-speedup-common.xsl | 100 ++++ doc/stylesheets/stylesheet-speedup-xhtml.xsl | 345 ++++++++++++++ doc/stylesheets/stylesheet-text.xsl | 97 ++++ doc/stylesheets/stylesheet.css | 182 ++++++++ doc/stylesheets/stylesheet.css.xml | 8 + doc/stylesheets/stylesheet.xsl | 328 +++++++++++++ doc/types.sgm | 100 ++-- doc/whatis.sgm | 21 +- 26 files changed, 2376 insertions(+), 887 deletions(-) create mode 100644 Makefile.common.mk delete mode 100644 doc/jadetex.cfg-dist delete mode 100644 doc/pg_sphere.css delete mode 100644 doc/pg_sphere.dsl-dist create mode 100644 doc/stylesheets/stylesheet-common.xsl create mode 100644 doc/stylesheets/stylesheet-fo.xsl create mode 100644 doc/stylesheets/stylesheet-html-common.xsl create mode 100644 doc/stylesheets/stylesheet-html-nochunk.xsl create mode 100644 doc/stylesheets/stylesheet-man.xsl create mode 100644 doc/stylesheets/stylesheet-speedup-common.xsl create mode 100644 doc/stylesheets/stylesheet-speedup-xhtml.xsl create mode 100644 doc/stylesheets/stylesheet-text.xsl create mode 100644 doc/stylesheets/stylesheet.css create mode 100644 doc/stylesheets/stylesheet.css.xml create mode 100644 doc/stylesheets/stylesheet.xsl diff --git a/Makefile b/Makefile index c8287aed..5dbdac29 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ -PGSPHERE_VERSION = 1.3.1 -EXTENSION = pg_sphere + +include Makefile.common.mk + RELEASE_SQL = $(EXTENSION)--$(PGSPHERE_VERSION).sql USE_PGXS = 1 USE_HEALPIX =? 1 diff --git a/Makefile.common.mk b/Makefile.common.mk new file mode 100644 index 00000000..f3893a9d --- /dev/null +++ b/Makefile.common.mk @@ -0,0 +1,8 @@ +#---------------------------------------------------------------------------- +# +# pgSphere common definitions +# +#---------------------------------------------------------------------------- + +EXTENSION := pg_sphere +PGSPHERE_VERSION := 1.3.1 diff --git a/doc/Makefile b/doc/Makefile index a607103a..47a13961 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,9 +1,16 @@ #---------------------------------------------------------------------------- # -# pgSphere documentation makefile +# pgSphere documentation generation # #---------------------------------------------------------------------------- +ifndef PGSPHERE_VERSION +include ../Makefile.common.mk +ifndef PGSPHERE_VERSION +$(error PGSPHERE_VERSION is not set) +endif +endif + USE_PGXS = 1 ifdef USE_PGXS PG_CONFIG = pg_config @@ -16,75 +23,89 @@ include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif -.SECONDARY: -.NOTPARALLEL: +ifndef FOP +FOP = fop +endif -ifndef COLLATEINDEX -COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl +ifdef XMLLINT +XMLLINT := $(XMLLINT) --nonet +else +XMLLINT = $(missing) xmllint endif -ifndef JADE -JADE = openjade +ifdef XSLTPROC +XSLTPROC := $(XSLTPROC) --nonet +else +XSLTPROC = $(missing) xsltproc endif -SGMLINCLUDE = -D $(srcdir) -ALLSGML := $(wildcard $(srcdir)/*.sgm) +override XSLTPROCFLAGS += \ + --path stylesheets --path img --path . \ + --stringparam pg_sphere.version '$(PGSPHERE_VERSION)' \ + --stringparam pg.version '$(PGSPHERE_VERSION)' -ifdef DOCBOOKSTYLE -CATALOG = -c $(DOCBOOKSTYLE)/catalog -endif +XMLINCLUDE = --path . +ALLSGML := $(wildcard *.sgm) +ALLIMAGES := $(wildcard img/*.jpg) -COLLATEINDEX := $(PERL) $(COLLATEINDEX) -f -g +.PHONY: all html pdf +all: version.ent html pdf -all : html +version.xml: + @echo $(PGSPHERE_VERSION) > version.xml -.PHONY: html pdf ps +pg_sphere-full.xml: version.xml +pg_sphere-full.xml: pg_sphere.xml $(ALLSGML) + $(XMLLINT) $(XMLINCLUDE) --output $@ --noent --valid $< -XMLDCL = declaration/xml.dcl +#------------------------------------------------------------------------------ +# HTML +#------------------------------------------------------------------------------ -html : pg_sphere.xml $(ALLSGML) pg_sphere.dsl - @rm -f *.html - @rm -rf html - mkdir html - mkdir html/img - cp img/*.jpg img/*.png html/img - cp pg_sphere.css html - $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -b UTF-8 -d pg_sphere.dsl -i html -t sgml $(XMLDCL) $< - mv *.html html +XSLTPROC_HTML_MULTIPAGE_FLAGS := --stringparam img.src.path '' +XSLTPROC_HTML_SINGLEPAGE_FLAGS := --stringparam img.src.path '' -pg_sphere.tex : pg_sphere.xml $(ALLSGML) pg_sphere.dsl - $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d pg_sphere.dsl -i print -t tex -o $@ $(XMLDCL) $< +html: html-singlepage html-multipage -pdf : jadetex.cfg pg_sphere.pdf +html-multipage: stylesheets/stylesheet.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_MULTIPAGE_FLAGS) $(wordlist 1,2,$^) + mkdir -p html/img + cp $(ALLIMAGES) html/img -pg_sphere.pdf: pg_sphere.tex - @rm -f $*.aux $*.log $*.out - pdfjadetex $< - pdfjadetex $< - pdfjadetex $< +html-singlepage: pg_sphere-$(PGSPHERE_VERSION).html -ps : pg_sphere.ps +pg_sphere-$(PGSPHERE_VERSION).html: stylesheets/stylesheet-html-nochunk.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_SINGLEPAGE_FLAGS) -o $@ $(wordlist 1,2,$^) -pg_sphere.ps: pg_sphere.pdf - pdftops $< $@ +#------------------------------------------------------------------------------ +# PDF +#------------------------------------------------------------------------------ -pg_sphere.dsl : pg_sphere.dsl-dist - cp $< $@ +pdf: pg_sphere-${PGSPHERE_VERSION}-A4.pdf pg_sphere-${PGSPHERE_VERSION}-US.pdf -jadetex.cfg : jadetex.cfg-dist - cp $< $@ +pg_sphere-$(PGSPHERE_VERSION)-A4.pdf: pg_sphere.A4.fo + $(FOP) -v -fo $< -pdf $@ +pg_sphere-$(PGSPHERE_VERSION)-US.pdf: pg_sphere.US.fo + $(FOP) -v -fo $< -pdf $@ +pg_sphere.A4.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml -## -## Clean -## +pg_sphere.US.fo: stylesheets/stylesheet-fo.xsl pg_sphere-full.xml version.xml $(ALLIMAGES) + $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USLetter -o $@ stylesheets/stylesheet-fo.xsl pg_sphere-full.xml -clean distclean maintainer-clean: -# HTML - rm -rf html pg_sphere.dsl -# print - rm -f *.rtf *.tex *.dvi *.aux *.log *.ps *.pdf *.out *.fot jadetex.cfg -# img - make clean -C img +#------------------------------------------------------------------------------ +# Cleanup +#------------------------------------------------------------------------------ + +clean distclean: + rm -rf ./html + rm -f version.xml + rm -f pg_sphere-full.xml + rm -f pg_sphere.A4.fo + rm -f pg_sphere.US.fo + rm -f pg_sphere-$(PGSPHERE_VERSION).html + rm -f pg_sphere-$(PGSPHERE_VERSION)-A4.pdf + rm -f pg_sphere-$(PGSPHERE_VERSION)-US.pdf diff --git a/doc/constructors.sgm b/doc/constructors.sgm index 5fefff7b..e14dd3f5 100644 --- a/doc/constructors.sgm +++ b/doc/constructors.sgm @@ -1,7 +1,6 @@ - - Codestin Search App + + Codestin Search App + Constructors within pgSphere are functions needed to create spherical data types from other data @@ -14,7 +13,7 @@ mentioned here. - + Codestin Search App @@ -44,9 +43,9 @@ - + - + Codestin Search App @@ -90,9 +89,9 @@ - + - + Codestin Search App @@ -110,7 +109,7 @@ returns a spherical circle with center at center and a radius radius in radians. The circle radius has - to be larger than or equal to zero but less or equal to 90°. + to be larger than or equal to zero but less or equal to 90°. Otherwise, this function returns an error. @@ -134,18 +133,18 @@ - + - + Codestin Search App The input of spherical lines using Euler transformation and - length is quite circumstantial (see ). + length is quite circumstantial (see ). For short lines it is easier to input a line specifying the beginning and the end of the line. - + sline @@ -155,13 +154,13 @@ If the distance between begin and - end is 180° (&pgr;), this function - returns an error because the location of the line is undefined. + end is 180° (&pg_pgr;), this function + returns an error because the location of the line is undefined. However, if longitudes of begin and end are equal, pgSphere assumes a meridian and returns the corresponding spherical line. - + Codestin Search App @@ -212,9 +211,9 @@ - + - + Codestin Search App @@ -238,7 +237,7 @@ radii of the ellipse in radians. If the major radius is smaller than minor radius, pgSphere swaps the values automatically. The last parameter - incl is the inclination angle in radians. + incl is the inclination angle in radians. For more informations about ellipses, see . @@ -263,9 +262,9 @@ - + - + Codestin Search App @@ -318,9 +317,9 @@ - + - + Codestin Search App @@ -371,9 +370,9 @@ - + - + Codestin Search App @@ -403,9 +402,9 @@ SELECT sbox ( spoint '(0d,0d),(10d,10d)' );]]> - + - + Codestin Search App @@ -449,6 +448,6 @@ creates an smoc of the given order covering the spoly - + - + diff --git a/doc/examples.sgm b/doc/examples.sgm index 08866919..1590b43c 100644 --- a/doc/examples.sgm +++ b/doc/examples.sgm @@ -1,37 +1,18 @@ - - Codestin Search App - - Codestin Search App - - tbw - - - - - Codestin Search App - - tbw - - - - + + Codestin Search App + + Codestin Search App - + Codestin Search App A commonly used task is a coordinate transformation. With the parameters of a new coordinate system (plane) relative to an old one, - + @@ -39,7 +20,7 @@ - &OHgr; + &pg_OHgr; longitude of the ascending node @@ -51,7 +32,7 @@ - &ohgr; + &pg_ohgr; argument of pericenter @@ -79,22 +60,22 @@ object from an old into a new coordinate system using: - object - strans '&ohgr;, i, &OHgr;' + object - strans '&pg_ohgr;, i, &pg_OHgr;' or - object - strans (&ohgr;, i, &OHgr;) + object - strans (&pg_ohgr;, i, &pg_OHgr;) Otherwise, for a transformation of an object object from the new into the old coordinate system, use the operator +: - object + strans '&ohgr;, i, &OHgr;' + object + strans '&pg_ohgr;, i, &pg_OHgr;' or - object + strans (&ohgr;, i, &OHgr;) + object + strans (&pg_ohgr;, i, &pg_OHgr;) Codestin Search App We are assuming the orbital elements of a comet are - &OHgr;=30°, i=60° and &ohgr;=90°. We get the + &pg_OHgr;=30°, i=60° and &pg_ohgr;=90°. We get the spherical position of perihelion and aphelion with: @@ -117,6 +98,7 @@ - - - + + + + diff --git a/doc/functions.sgm b/doc/functions.sgm index d5bb457d..6093c339 100644 --- a/doc/functions.sgm +++ b/doc/functions.sgm @@ -1,13 +1,13 @@ - - Codestin Search App + + Codestin Search App + The functions described below are implemented without having an operator. If you are missing some functions, see and use the operators. - + + Codestin Search App @@ -18,7 +18,7 @@ is convex), sbox, and smoc. - Codestin Search App + Codestin Search App SELECT area( scircle '<(0d,90d),60d>' ) / pi() AS area;]]> @@ -32,14 +32,14 @@ - + - + Codestin Search App - + Codestin Search App @@ -76,9 +76,9 @@ - + - + Codestin Search App @@ -140,16 +140,16 @@ - + - - - + + + Codestin Search App - + Codestin Search App @@ -169,9 +169,9 @@ SELECT strans_zxz ( strans '20d, -270d, 70.5d, XZY' );]]> - + - + Codestin Search App @@ -249,12 +249,12 @@ - + - + - + Codestin Search App @@ -275,9 +275,9 @@ - + - + Codestin Search App @@ -338,10 +338,10 @@ - To get the ellipse center, you can use the + To get the ellipse center, you can use the operator @@ () instead of using the function - center(sellipse). + center(sellipse). Codestin Search App @@ -355,14 +355,14 @@ - - - + + + Codestin Search App - + Codestin Search App @@ -386,9 +386,9 @@ SELECT sl_beg( sline '(10d, 90d, 270d, ZXZ ), 20d';]]> - + - + Codestin Search App @@ -423,14 +423,14 @@ - - - - + + + + Codestin Search App - + Codestin Search App @@ -455,10 +455,10 @@ - - - - + + + + Codestin Search App @@ -532,19 +532,19 @@ - - - - + + + + Codestin Search App - + Codestin Search App - Similar to an spath (), + Similar to an spath (), you can get the count of edges of a spherical polygon using the function: @@ -565,8 +565,8 @@ - - + + Codestin Search App @@ -617,9 +617,9 @@ - + - + Codestin Search App @@ -643,11 +643,11 @@ - + - + - + Codestin Search App @@ -683,9 +683,9 @@ SELECT sw ( sbox '( (0d,0d), (90d,0d) )' ) ;]]> - + - + Codestin Search App @@ -778,14 +778,14 @@ - + - + Codestin Search App - + Codestin Search App @@ -804,15 +804,15 @@ applies proper motion to positions) - Following both pg_sphere and, where missing, astronomical + Following both pg_sphere and, where missing, astronomical conventions makes units somewhat eclectic here; pm_long and pm_lat - need to be in rad/yr, whereas parallax is in mas, and - radial_velocity in km/s. The time difference must be in + need to be in rad/yr, whereas parallax is in mas, and + radial_velocity in km/s. The time difference must be in (Julian) years. - This function returns a 6-array of [long, lat, parallax, + This function returns a 6-array of [long, lat, parallax, pm_long, pm_lat, radial_velocity] of the corresponding values delta_t years after the reference epoch for the original position. As in the function arguments, long and lat are in rad, pm_lon and @@ -839,7 +839,7 @@ Codestin Search App - - + + Codestin Search App @@ -890,7 +890,7 @@ FROM ( - As with epoch_prop itself, missing values (except for pos and + As with epoch_prop itself, missing values (except for pos and delta_t) are substituted by 0 (or a very small value in the case of parallax). @@ -898,14 +898,15 @@ FROM ( Codestin Search App - - - + + + + diff --git a/doc/indices.sgm b/doc/indices.sgm index 11940c2f..0ef179f6 100644 --- a/doc/indices.sgm +++ b/doc/indices.sgm @@ -1,8 +1,7 @@ - - Codestin Search App - + + Codestin Search App + + Codestin Search App @@ -27,7 +26,7 @@ linkend="op.over">&&, #, =, and !=. + linkend="op.equal">!=. You can create a GiST index with the following spherical data types: @@ -84,7 +83,7 @@ - BRIN index can be created through the following syntax: + BRIN index can be created through the following syntax: @@ -102,9 +101,9 @@ - + - + Codestin Search App @@ -143,6 +142,6 @@ - + - + diff --git a/doc/install.sgm b/doc/install.sgm index 39ebaf93..f1c4b545 100644 --- a/doc/install.sgm +++ b/doc/install.sgm @@ -1,19 +1,18 @@ - - Codestin Search App - + + Codestin Search App + + Codestin Search App - - pgSphere is not part of the PostgreSQL software. + + pgSphere is not part of the PostgreSQL software. You can download it from the pgSphere homepage - https://github.com/akorotkov/pgsphere + https://github.com/postgrespro/pgsphere - + - + Codestin Search App @@ -27,9 +26,9 @@ There are two ways to compile pgSphere. The first is to copy the sources into the contribution directory of - PostgreSQL's source tree + PostgreSQL's source tree (POSTGRESQL_SRC/src/contrib). - Then, change into POSTGRESQL_SRC/src/contrib. + Then, change into POSTGRESQL_SRC/src/contrib. If the sources are not yet installed and the directory pg_sphere does not exist, take the gzipped pgSphere sources ( e. g., @@ -82,43 +81,43 @@ make installcheck]]> - The check status will be displayed. Please note, the check gives different results with + The check status will be displayed. Please note, the check gives different results with different PostgreSQL-versions. Currently, the check should run without errors with PostgreSQL-version 8.4. Otherwise check the file regression.diff. - - - - + + + + Codestin Search App We assume you have already created a database datab, where datab - is the name of any database. + is the name of any database. Presupposing the name of your PostgreSQL's superuser is postgres, type: - psql -U postgres -c 'CREATE EXTENSION pg_sphere;' datab]]> + psql -U postgres -c 'CREATE EXTENSION pg_sphere' datab]]> Depending on your system, it may be necessary to give more - psql options like port or host name. + psql options like port or host name. Please have a look at the PostgreSQL documentation for more details. - To get the version of installed pgSphere software, simply + To get the version of installed pgSphere software, simply call: SELECT pg_sphere_version();]]> - - - + + + diff --git a/doc/jadetex.cfg-dist b/doc/jadetex.cfg-dist deleted file mode 100644 index d7917b9f..00000000 --- a/doc/jadetex.cfg-dist +++ /dev/null @@ -1,14 +0,0 @@ -\hypersetup{ - pdftitle={pgSphere}, - pdfsubject={user guide}, - pdfauthor={pgSphere developer team}, - pdfkeywords={spherical PostgreSQL SQL}, - bookmarksopen=true, - bookmarksopenlevel=2, - colorlinks=true, - linkcolor=blue, - pdfpagemode=UseOutlines, - pdfstartview=FitH -} -\usepackage{url} -\tolerance=2000 diff --git a/doc/operators.sgm b/doc/operators.sgm index 73ebb835..c2d89026 100644 --- a/doc/operators.sgm +++ b/doc/operators.sgm @@ -1,8 +1,7 @@ - - Codestin Search App - + + Codestin Search App + + Codestin Search App @@ -120,9 +119,9 @@ - - - + + + Codestin Search App @@ -144,9 +143,9 @@ - - - + + + Codestin Search App @@ -156,7 +155,7 @@ a contained by object b? or Does object a overlap object - b? + b? pgSphere supports such queries using binary operators returning true or false: @@ -298,9 +297,9 @@ - + - + Codestin Search App @@ -320,9 +319,9 @@ - - - + + + Codestin Search App @@ -358,9 +357,9 @@ - - - + + + Codestin Search App @@ -395,9 +394,9 @@ - + - + Codestin Search App @@ -415,9 +414,9 @@ SELECT @@ scircle '<(0d,20d),30d>';]]> - + - + Codestin Search App @@ -433,15 +432,15 @@ SELECT - sline (spoint '(0d,0d)', spoint '(10d,0d)');]]> - + - + Codestin Search App The unary operator ! turns the - path of sline objects, but preserves + path of sline objects, but preserves begin and end of the spherical line. The length of returned line will be 360° minus the line length of operator's argument. @@ -450,7 +449,7 @@ The operator ! returns NULL, if the length of sline argument is 0, because the path of returned sline - is undefined. + is undefined. Codestin Search App @@ -490,9 +489,9 @@ - + - + Codestin Search App @@ -561,9 +560,9 @@ - + - + Codestin Search App @@ -590,6 +589,6 @@ - + - + diff --git a/doc/pg_sphere.css b/doc/pg_sphere.css deleted file mode 100644 index 2b7c85d8..00000000 --- a/doc/pg_sphere.css +++ /dev/null @@ -1,182 +0,0 @@ -/* similar to PostgreSQL.org Documentation Style */ - -body { - margin: 1em; - padding: 1em; - font-size: 85%; - font-family: verdana, sans-serif; - color: #000; - background-color: #fff; -} - -h1 { - font-size: 1.4em; - font-weight: bold; - margin-top: 0em; - margin-bottom: 0em; -} - -h2 { - font-size: 1.2em; - margin: 1.2em 0em 1.2em 0em; - font-weight: bold; -} - -h3 { - font-size: 1.0em; - margin: 1.2em 0em 1.2em 0em; - font-weight: bold; -} - -h4 { - font-size: 0.95em; - margin: 1.2em 0em 1.2em 0em; - font-weight: normal; -} - -h5 { - font-size: 0.9em; - margin: 1.2em 0em 1.2em 0em; - font-weight: normal; -} - -h6 { - font-size: 0.85em; - margin: 1.2em 0em 1.2em 0em; - font-weight: normal; -} - -img { - border: 0; -} - -ol, ul, li { - font-size: 1.0em; - line-height: 1.2em; - margin-top: 0.2em; - margin-bottom: 0.1em; -} - -p { - font-size: 1.0em; - line-height: 1.2em; - margin: 1.2em 0em 1.2em 0em; -} - -li > p { - margin-top: 0.2em; -} - -pre { - font-family: monospace; - font-size: 1.2em; - margin: 0em; -} - -strong, b { - font-weight: bold; -} - -h1 { - font-weight: bold; - color: #EC5800; - font-size: 1.4em; -} - -h2 { - font-weight: bold; - color: #666; - font-size: 1.2em; -} - -h3 { - font-weight: bold; - color: #666; - font-size: 1.1em; -} - -h4 { - color: #666; -} - -/* Text Styles */ - -.txtCurrentLocation { - font-weight: bold; -} - -p, ol, ul, li { - line-height: 1.5em; -} - -table.CALSTABLE { - width: 50%; -} - -table.CALSTABLE td { - vertical-align : top; -} - -/* Link Styles */ - -a:link { color:#0066A2; text-decoration: underline; } -a:visited { color:#004E66; text-decoration: underline; } -a:active { color:#0066A2; text-decoration: underline; } -a:hover { color:#000000; text-decoration: underline; } - - -pre.programlisting, -blockquote.note, -blockquote.tip -{ - -moz-border-radius: 8px 8px 8px 8px; - -moz-box-shadow: 3px 3px 5px #DFDFDF; - color: black; - margin: 1ex 0ex 1ex 1ex; - padding: 1ex; - border-style: solid; - border-width: 1px; -} - - -/* Programlisting */ -pre.programlisting { - background-color: #F7F7F7; - border-color: #CFCFCF; - font-family: monospace; - text-align: left; -} - -div.note { - margin-top: 4ex; -} - -blockquote.note, -blockquote.tip -{ - padding-top: 0ex; - background-color: #FDFDEE; - border-color: #DBDBCC; -} - - -.literal, -.parameter, -.funcsynopsis, -.function -{ - font-size: 130%; -} - -div.table table tr td { - padding: 0.5ex; -} - -div.example p b { - font-size : 70%; - font-style: italic; -} - -div.NAVFOOTER { - margin-top: 5ex; -} \ No newline at end of file diff --git a/doc/pg_sphere.dsl-dist b/doc/pg_sphere.dsl-dist deleted file mode 100644 index a658c789..00000000 --- a/doc/pg_sphere.dsl-dist +++ /dev/null @@ -1,330 +0,0 @@ - - - - - -]]> - - -]]> - -]> - - - - - - -;; PAPER - - - - -string (time) #t))) - '("META" ("HTTP-EQUIV" "Content-Type") ("CONTENT" "text/html; charset=utf-8")) - ) -) - -(define %stylesheet% "pg_sphere.css") - -(define %generate-article-titlepage% - ;; produce a title page for articles - #t) - -(define (chunk-skip-first-element-list) - ;; forces the Table of Contents on separate page - '()) - -(define (list-element-list) - ;; fixes bug in Table of Contents generation - '()) - -(define %root-filename% - ;; The filename of the root HTML document (e.g, "index"). - "index") - -(define ($shade-verbatim-attr$) - ;; REFENTRY shade-verbatim-attr - ;; PURP Attributes used to create a shaded verbatim environment. - ;; DESC - ;; See '%shade-verbatim%' - ;; /DESC - ;; AUTHOR N/A - ;; /REFENTRY - (list - (list "BORDER" "0") - (list "BGCOLOR" "#F7F7F7") - (list "WIDTH" ($table-width$)))) - -;; ...but we need to do some extra work to make the above apply to PRE -;; as well. (mostly pasted from dbverb.dsl) -(define ($verbatim-display$ indent line-numbers?) - (let ((content (make element gi: "PRE" - attributes: (list - (list "CLASS" (gi))) - (if (or indent line-numbers?) - ($verbatim-line-by-line$ indent line-numbers?) - (process-children))))) - (if %shade-verbatim% - (make element gi: "TABLE" - attributes: ($shade-verbatim-attr$) - (make element gi: "TR" - (make element gi: "TD" - content))) - (make sequence - (para-check) - content - (para-check 'restart))))) - -(define %shade-verbatim% - ;; verbatim sections will be shaded if t(rue) - #f) - -(define %use-id-as-filename% - ;; Use ID attributes as name for component HTML files? - #t) - -(define %graphic-extensions% - ;; graphic extensions allowed - '("jpg" "jpeg" "png")) - -(define %graphic-default-extension% - "jpg") - -(define %section-autolabel% - ;; For enumerated sections (1.1, 1.1.1, 1.2, etc.) - #t) - -(define (toc-depth nd) - ;; more depth (3 levels) to toc; instead of flat hierarchy - 2) - -(element emphasis - ;; make role=strong equate to bold for emphasis tag - (if (equal? (attribute-string "role") "strong") - (make element gi: "STRONG" (process-children)) - (make element gi: "EM" (process-children)))) - -(define (article-titlepage-recto-elements) - ;; elements on an article's titlepage - (list (normalize "title") - (normalize "subtitle") - (normalize "authorgroup") - (normalize "author") - (normalize "othercredit") - (normalize "releaseinfo") - (normalize "copyright") - (normalize "pubdate") - (normalize "revhistory") - (normalize "abstract") - (normalize "legalnotice"))) - -(define (article-title nd) - (let* ((artchild (children nd)) - (artheader (select-elements artchild (normalize "artheader"))) - (artinfo (select-elements artchild (normalize "articleinfo"))) - (ahdr (if (node-list-empty? artheader) - artinfo - artheader)) - (ahtitles (select-elements (children ahdr) - (normalize "title"))) - (artitles (select-elements artchild (normalize "title"))) - (titles (if (node-list-empty? artitles) - ahtitles - artitles))) - (if (node-list-empty? titles) - "" - (node-list-first titles)))) - -(mode subtitle-mode - ;; do not print subtitle on subsequent pages - (element subtitle (empty-sosofo))) - -;; notes. -(element note - (make sequence - (para-check) - ($admonition$) - (para-check 'restart))) - -]]> - - - - - - - diff --git a/doc/pg_sphere.xml b/doc/pg_sphere.xml index 950a5309..1ca32a74 100644 --- a/doc/pg_sphere.xml +++ b/doc/pg_sphere.xml @@ -1,7 +1,7 @@ - @@ -25,50 +25,29 @@ +&ohgr;"> +&OHgr;"> +&pgr;"> + + ]> + + + + Codestin Search App + pgSphere Development Team + pgSphere + &pg_sphere_version; + -
- - Codestin Search App - - pgSphere development team - - - - - - - - - - - pgSphere provides spherical data - types, functions, and operators for - PostgreSQL. - - - The project is hosted at - https://github.com/postgrespro/pgsphere - - - - This document - describes installation and usage of this module. - - - - &capWhatis; - &capInstall; - &capTypes; - &capConstr; - &capOperators; - &capFunctions; - &capIndices; - &capExamples; - &capFaq; - &capAppendixes; + &capWhatis; + &capInstall; + &capTypes; + &capConstr; + &capOperators; + &capFunctions; + &capIndices; + &capExamples; -
+
diff --git a/doc/stylesheets/stylesheet-common.xsl b/doc/stylesheets/stylesheet-common.xsl new file mode 100644 index 00000000..c739f038 --- /dev/null +++ b/doc/stylesheets/stylesheet-common.xsl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + 1 + 0 + + + + +yes +2 + + + + + + + + + +1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ? + + ? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stylesheets/stylesheet-fo.xsl b/doc/stylesheets/stylesheet-fo.xsl new file mode 100644 index 00000000..19f368fa --- /dev/null +++ b/doc/stylesheets/stylesheet-fo.xsl @@ -0,0 +1,147 @@ + + + + + + + + +3 + + + +1.5em + + + wrap + + + + solid + 1pt + black + 12pt + 12pt + 6pt + 6pt + + + + center + + + + + left + + + + + 1em + 0.8em + 1.2em + + + + + + + + + + + + , + + + + + + + + ISBN + + + + + + + + + + + + + + + + -3.5em + + + + + + + + + + -3.5em + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stylesheets/stylesheet-html-common.xsl b/doc/stylesheets/stylesheet-html-common.xsl new file mode 100644 index 00000000..a368e0e1 --- /dev/null +++ b/doc/stylesheets/stylesheet-html-common.xsl @@ -0,0 +1,439 @@ + + +%common.entities; +]> + + + + + + + + +pgsql-docs@lists.postgresql.org +2 + + + stylesheet.css.xml + + + https://www.postgresql.org/media/css/docs-complete.css + + + + + + docContent + container-fluid col-10 + + + + + + + + + + + + + + , + + + + + + + + + + ISBN + + + + + + + + + +appendix toc,title +article/appendix nop +article toc,title +book toc,title +chapter toc,title +part toc,title +preface toc,title +qandadiv toc +qandaset toc +reference toc,title +sect1 toc +sect2 toc +sect3 toc +sect4 toc +sect5 toc +section toc +set toc,title + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+

+ + + +

+
+ + + + + + + +
+
+
+ + + + + +
+

+ + + +

+
+ + + + + + + +
+
+
+
+
+ + + + + + + + +
+
+ + + + + + + + + +
+ + + + + + +

+ +

+
+
+ + + + + + + +
+
+
+
+ + + + + + + + + + + + | + + + + + + + + + + + + + + + + + + + + + + + + + + id- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + + + + + + + + + + clear: both + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + + + + + + id_link + + # + + + + + + + ERROR: id attribute missing on < + + > element under + + / + + + [@ + + = ' + + '] + + + + + + + + +
diff --git a/doc/stylesheets/stylesheet-html-nochunk.xsl b/doc/stylesheets/stylesheet-html-nochunk.xsl new file mode 100644 index 00000000..5a0bb4ea --- /dev/null +++ b/doc/stylesheets/stylesheet-html-nochunk.xsl @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stylesheets/stylesheet-man.xsl b/doc/stylesheets/stylesheet-man.xsl new file mode 100644 index 00000000..fcb485c2 --- /dev/null +++ b/doc/stylesheets/stylesheet-man.xsl @@ -0,0 +1,226 @@ + + + + + + + + + +0 +0 +0 + + + +32 +40 + + + + + + + + + + + + + + < + + > + + + + + + ^ + + + + + + + + + + + + + + + + ( + + + + + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + Note: + + + + + + + + + + + + + + + + + + + + + + + + + Note: + (soelim stub) + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stylesheets/stylesheet-speedup-common.xsl b/doc/stylesheets/stylesheet-speedup-common.xsl new file mode 100644 index 00000000..e3fb582a --- /dev/null +++ b/doc/stylesheets/stylesheet-speedup-common.xsl @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +en + + diff --git a/doc/stylesheets/stylesheet-speedup-xhtml.xsl b/doc/stylesheets/stylesheet-speedup-xhtml.xsl new file mode 100644 index 00000000..da0f2b5a --- /dev/null +++ b/doc/stylesheets/stylesheet-speedup-xhtml.xsl @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: If you change $chunk.section.depth, then you must update the performance-optimized chunk-all-sections-template. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/stylesheets/stylesheet-text.xsl b/doc/stylesheets/stylesheet-text.xsl new file mode 100644 index 00000000..529cc9ec --- /dev/null +++ b/doc/stylesheets/stylesheet-text.xsl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + +
  • + + + + +
  • +
    + + + + + * + + * + + + + + + + + + + + + + + +
    + + + + + + +

    + + + : + +

    +
    + + +
    +
    + + + + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    diff --git a/doc/stylesheets/stylesheet.css b/doc/stylesheets/stylesheet.css new file mode 100644 index 00000000..86a8edb9 --- /dev/null +++ b/doc/stylesheets/stylesheet.css @@ -0,0 +1,182 @@ +/* doc/src/sgml/stylesheet.css */ + +/* color scheme similar to www.postgresql.org */ + +body { + color: #000000; + background: #FFFFFF; + font-family: verdana, sans-serif; +} + +a:link { color:#0066A2; } +a:visited { color:#004E66; } +a:active { color:#0066A2; } +a:hover { color:#000000; } + +h1 { + font-size: 1.4em; + font-weight: bold; + margin-top: 0em; + margin-bottom: 0em; + color: #EC5800; +} + +h2 { + font-size: 1.2em; + margin: 1.2em 0em 1.2em 0em; + font-weight: bold; + color: #666; +} + +.titlepage h2.title, +.refnamediv h2 { + color: #EC5800; +} + +h3 { + font-size: 1.1em; + margin: 1.2em 0em 1.2em 0em; + font-weight: bold; + color: #666; +} + +h4 { + font-size: 0.95em; + margin: 1.2em 0em 1.2em 0em; + font-weight: normal; + color: #666; +} + +h5 { + font-size: 0.9em; + margin: 1.2em 0em 1.2em 0em; + font-weight: normal; +} + +h6 { + font-size: 0.85em; + margin: 1.2em 0em 1.2em 0em; + font-weight: normal; +} + +/* center some titles */ + +.book .title, .book .corpauthor, .book .copyright { + text-align: center; +} + +/* decoration for formal examples */ + +div.example { + padding-left: 15px; + border-style: solid; + border-width: 0px; + border-left-width: 2px; + border-color: black; + margin: 0.5ex; +} + +/* Additional formatting for "simplelist" structures */ +table.simplelist td { + padding-left: 2em; + padding-right: 2em; +} + +/* formatting for entries in tables of functions: indent all but first line */ + +th.func_table_entry p, +td.func_table_entry p { + margin-top: 0.1em; + margin-bottom: 0.1em; + padding-left: 4em; + text-align: left; +} + +p.func_signature { + text-indent: -3.5em; +} + +td.func_table_entry pre.programlisting { + margin-top: 0.1em; + margin-bottom: 0.1em; + padding-left: 4em; +} + +/* formatting for entries in tables of catalog/view columns */ + +th.catalog_table_entry p, +td.catalog_table_entry p { + margin-top: 0.1em; + margin-bottom: 0.1em; + padding-left: 4em; + text-align: left; +} + +th.catalog_table_entry p.column_definition { + text-indent: -3.5em; + word-spacing: 0.25em; +} + +td.catalog_table_entry p.column_definition { + text-indent: -3.5em; +} + +p.column_definition code.type { + padding-left: 0.25em; + padding-right: 0.25em; +} + +td.catalog_table_entry pre.programlisting { + margin-top: 0.1em; + margin-bottom: 0.1em; + padding-left: 4em; +} + +/* Put these here instead of inside the HTML (see unsetting of + admon.style in XSL) so that the web site stylesheet can set its own + style. */ + +.tip, +.note, +.important, +.caution, +.warning { + margin-left: 0.5in; + margin-right: 0.5in; +} + +/* miscellaneous */ + +pre.literallayout, .screen, .synopsis, .programlisting { + margin-left: 4ex; +} + +ul.itemizedlist { + margin-left: 2.5rem; +} + +.comment { color: red; } + +var { font-family: monospace; font-style: italic; } +/* Konqueror's standard style for ACRONYM is italic. */ +acronym { font-style: inherit; } + +.option { white-space: nowrap; } + +/* make images not too wide on larger screens */ +@media (min-width: 800px) { + .mediaobject { + width: 75%; + } +} + +/* links to ids of headers and definition terms */ + +a.id_link { + color: inherit; + visibility: hidden; +} + +*:hover > a.id_link { + visibility: visible; +} diff --git a/doc/stylesheets/stylesheet.css.xml b/doc/stylesheets/stylesheet.css.xml new file mode 100644 index 00000000..a21fcca5 --- /dev/null +++ b/doc/stylesheets/stylesheet.css.xml @@ -0,0 +1,8 @@ + + +]> + diff --git a/doc/stylesheets/stylesheet.xsl b/doc/stylesheets/stylesheet.xsl new file mode 100644 index 00000000..6b39d918 --- /dev/null +++ b/doc/stylesheets/stylesheet.xsl @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/types.sgm b/doc/types.sgm index 557c1441..acb3c549 100644 --- a/doc/types.sgm +++ b/doc/types.sgm @@ -1,8 +1,7 @@ - - Codestin Search App - + + Codestin Search App + + Codestin Search App @@ -100,9 +99,9 @@ - - - + + + Codestin Search App @@ -118,28 +117,28 @@ - sites on earth + sites on earth - star positions on the sky sphere + star positions on the sky sphere - spherical positions on planets + spherical positions on planets - + A spherical point (or position) is given by two values: longitude and latitude. Longitude is a floating point value between 0 and - 2&pgr;. Latitude is a floating point - value, too, but between -&pgr;/2 and - &pgr;/2. It is possible to give a + 2&pg_pgr;. Latitude is a floating point + value, too, but between -&pg_pgr;/2 and + &pg_pgr;/2. It is possible to give a spherical position in degrees (DEG) or with a triple value of degrees, minutes and seconds (DMS). Degrees and minutes are integer @@ -189,10 +188,10 @@ longitude and latitude. The value pairs are always enclosed within braces. Spaces are optional. - - - + + + Codestin Search App @@ -210,12 +209,12 @@ - spherical object transformations + spherical object transformations - spherical coordinates transformations + spherical coordinates transformations @@ -226,7 +225,7 @@ where axes is an optional 3 letter code with letters : X, Y, or - Z. Default is ZXZ. + Z. Default is ZXZ. angleN is any valid angle with the input format RAD, DEG, or DMS. @@ -263,9 +262,9 @@ SELECT strans '2d 20m, 10d, 0';]]> - - - + + + Codestin Search App @@ -289,12 +288,12 @@ - round cluster or nebula on sky sphere + round cluster or nebula on sky sphere - a position with an undirected position error + a position with an undirected position error @@ -318,9 +317,9 @@ SELECT scircle '< (0d, 90d), 5d >';]]> - + - + Codestin Search App @@ -336,12 +335,12 @@ - direct connection of two points + direct connection of two points - meteors on the sky sphere + meteors on the sky sphere @@ -395,9 +394,9 @@ i syntax is a somewhat complex. SELECT sline '( -90d, -20d, 200d, XYZ ), 30d ';]]> - - - + + + Codestin Search App @@ -432,7 +431,7 @@ i syntax is a somewhat complex. - to describe a position error + to describe a position error @@ -442,12 +441,12 @@ i syntax is a somewhat complex. - a major radius rad_1 + a major radius rad_1 - a minor radius rad_2 + a minor radius rad_2 @@ -505,9 +504,9 @@ i syntax is a somewhat complex. SELECT sellipse '< { 10d, 5d } , ( 20d, 0d ), 90d >';]]> - + - + Codestin Search App @@ -523,7 +522,7 @@ i syntax is a somewhat complex. - rivers on earth + rivers on earth @@ -548,7 +547,7 @@ i syntax is a somewhat complex. - At least 2 positions are required. + At least 2 positions are required. @@ -565,9 +564,9 @@ i syntax is a somewhat complex. SELECT spath '{ (10d,0d),(45d,15d),(80d,30d) } ';]]> - + - + Codestin Search App @@ -582,7 +581,7 @@ i syntax is a somewhat complex. A spherical polygon is a closed spherical path where line segments cannot be crossed. One main use case are areas on the earth and sky sphere. - Polygons within pgSphere + Polygons within pgSphere have the same input syntax as paths: {pos1,pos2,pos3[,pos4[,... ]]} @@ -598,7 +597,7 @@ i syntax is a somewhat complex. - The line segments can not be crossed. + The line segments can not be crossed. @@ -621,9 +620,9 @@ i syntax is a somewhat complex. SELECT spoly '{ (270d,-10d), (270d,30d), (290d,10d) } ';]]> - + - + Codestin Search App @@ -689,9 +688,9 @@ i syntax is a somewhat complex. SELECT sbox '( (350d,-10d), (10d,+10d) )';]]> - + - + Codestin Search App @@ -750,5 +749,6 @@ i syntax is a somewhat complex. SELECT smoc '0/4 1/0 2 12-13 34-35 45 47 2/4 6 12 14 56-57 60-61 88 90-91 116-117 119 130-131 134-135 177 179 185 187';]]> - - + + + diff --git a/doc/whatis.sgm b/doc/whatis.sgm index 6af690bb..fc52d0e0 100644 --- a/doc/whatis.sgm +++ b/doc/whatis.sgm @@ -1,4 +1,7 @@ - + + Codestin Search App + + Codestin Search App @@ -15,7 +18,7 @@ - containing, overlapping, and other operators + containing, overlapping, and other operators @@ -30,17 +33,17 @@ - spherical transformation + spherical transformation - indexing of spherical data types + indexing of spherical data types - several input and output formats + several input and output formats @@ -48,17 +51,19 @@ Hence, you can do a fast search and analysis for objects with spherical attributes as used in geographical, astronomical, or - other applications using PostgreSQL. + other applications using PostgreSQL. For instance, you can manage data of geographical objects around the world and astronomical data like star and other catalogs conveniently using an SQL interface. - The aim of pgSphere is to provide + The aim of pgSphere is to provide uniform access to spherical data. Because PostgreSQL itself supports a lot of software interfaces, you can now use the same database with different utilities and applications. - + + + \ No newline at end of file From 46c805c585eff977b77f860a341bb0be2b128e5c Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 13 Sep 2023 15:52:39 +0300 Subject: [PATCH 03/40] Fix doc generation with default target --- doc/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 47a13961..280bbe06 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -12,6 +12,7 @@ endif endif USE_PGXS = 1 + ifdef USE_PGXS PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) @@ -23,8 +24,10 @@ include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif +.SECONDARY: + ifndef FOP -FOP = fop +FOP = $(missing) fop endif ifdef XMLLINT @@ -48,9 +51,13 @@ XMLINCLUDE = --path . ALLSGML := $(wildcard *.sgm) ALLIMAGES := $(wildcard img/*.jpg) -.PHONY: all html pdf +all: html pdf + +.PHONY: all html pdf clean -all: version.ent html pdf +# This line fixes the error like: +# No rule to make target 'pg_sphere.control' +.PHONY: pg_sphere.control version.xml: @echo $(PGSPHERE_VERSION) > version.xml From 5cd821194bdcd5ed976aaf8406803070402adf15 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 13 Sep 2023 16:34:27 +0300 Subject: [PATCH 04/40] Update travis.ci to support docbook/fop doc generation --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4df87d58..691080fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ dist: focal before_install: # extra apt.pg.o.sh options added in version 204, travis currently has 199 (2019-11-27) - sudo apt-get -qq update - - sudo apt-get -y install postgresql-common libhealpix-cxx-dev docbook-dsssl docbook-xml openjade + - sudo apt-get -y install postgresql-common libhealpix-cxx-dev docbook-xml docbook-xsl libxml2-utils xsltproc fop install: - sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -p -v $PG_SUPPORTED_VERSIONS -i From c5731c9386f3317e31d29066e325220921572386 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 13 Sep 2023 16:39:39 +0300 Subject: [PATCH 05/40] Set FOP variable default value --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 280bbe06..754d7752 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -27,7 +27,7 @@ endif .SECONDARY: ifndef FOP -FOP = $(missing) fop +FOP = fop endif ifdef XMLLINT From d59496c75fad1d9de6405f1ae955ef186084f136 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Thu, 14 Sep 2023 11:41:08 +0300 Subject: [PATCH 06/40] Disable install/installcheck targets in doc/Makefile Remove inclusion of 'pg_config --pgxs' makefile because it is not required to create the documentation. This makefile was designed to be included in top-level extension makefile. Inclusion in the doc/Makefile results into some unexpected behaviour when using 'install' or 'all' rules. Remove gmake -C doc install in .travis.yml because this target didn't do anything. I guess that the installation of the manual should be implemented in the top-level extension Makefile file, not in the doc/Makefile. --- .travis.yml | 1 - doc/Makefile | 19 ++----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 691080fe..0d199cf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,4 +40,3 @@ script: - pg_virtualenv make USE_HEALPIX=0 crushtest - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - make -C doc - - sudo make -C doc install diff --git a/doc/Makefile b/doc/Makefile index 754d7752..11894ff5 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -11,21 +11,6 @@ $(error PGSPHERE_VERSION is not set) endif endif -USE_PGXS = 1 - -ifdef USE_PGXS -PG_CONFIG = pg_config -PGXS := $(shell $(PG_CONFIG) --pgxs) -include $(PGXS) -else -subdir = contrib/pg_sphere/doc -top_builddir = ../../.. -include $(top_builddir)/src/Makefile.global -include $(top_srcdir)/contrib/contrib-global.mk -endif - -.SECONDARY: - ifndef FOP FOP = fop endif @@ -33,13 +18,13 @@ endif ifdef XMLLINT XMLLINT := $(XMLLINT) --nonet else -XMLLINT = $(missing) xmllint +XMLLINT = xmllint --nonet endif ifdef XSLTPROC XSLTPROC := $(XSLTPROC) --nonet else -XSLTPROC = $(missing) xsltproc +XSLTPROC = xsltproc --nonet endif override XSLTPROCFLAGS += \ From 48c3d5e45bdde670c78ae448b6212f9c9f870abb Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Fri, 15 Sep 2023 12:34:13 +0300 Subject: [PATCH 07/40] Add final linefeed, remove some trailing whitespaces --- doc/appendixes.sgm | 4 ++-- doc/whatis.sgm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/appendixes.sgm b/doc/appendixes.sgm index 46b87cc2..5bd221ea 100644 --- a/doc/appendixes.sgm +++ b/doc/appendixes.sgm @@ -19,7 +19,7 @@ - This version is compatible to PostgreSQL 8.4 + This version is compatible to PostgreSQL 8.4 @@ -66,5 +66,5 @@ - + diff --git a/doc/whatis.sgm b/doc/whatis.sgm index fc52d0e0..eb12bf1d 100644 --- a/doc/whatis.sgm +++ b/doc/whatis.sgm @@ -66,4 +66,4 @@ - \ No newline at end of file + From f3823cf27886c418120ee9fef3267018c4d6af58 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Tue, 19 Sep 2023 17:20:42 +0200 Subject: [PATCH 08/40] Remove test_top_build_dir Remove special code for testing on pre-9.5 servers --- Makefile | 14 +------------- test_top_build_dir/Makefile | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 test_top_build_dir/Makefile diff --git a/Makefile b/Makefile index 5dbdac29..db9cf597 100644 --- a/Makefile +++ b/Makefile @@ -132,18 +132,12 @@ ifeq ($(has_explain_summary),y) endif endif -ifeq ($(pg_version_9_5_plus),y) - PGS_TMP_DIR = --temp-instance=tmp_check -else - PGS_TMP_DIR = --temp-install=tmp_check --top-builddir=test_top_build_dir -endif - test: pg_sphere.test.sql sql/init_test.sql cp expected/init_test.out.in expected/init_test.out ifneq ($(USE_HEALPIX),0) cat expected/init_test_healpix.out.in >> expected/init_test.out endif - $(pg_regress_installcheck) $(PGS_TMP_DIR) $(REGRESS_OPTS) $(TESTS) + $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS) pg_sphere.test.sql: $(RELEASE_SQL) $(shlib) tail -n+3 $< | sed 's,MODULE_PATHNAME,$(realpath $(shlib)),g' >$@ @@ -188,12 +182,6 @@ UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \ # create "alter extension" files - -ifeq ($(pg_version_9_5_plus),y) -# 1.1.1.5 -> 1.1.5.1 for Postgres 9.5+ features -else -endif - # local stuff follows here AUGMENT_GAVO_111 = $(AUGMENT_UNP_111) # for vanilla 1.1.1 users ifneq ($(USE_HEALPIX),0) diff --git a/test_top_build_dir/Makefile b/test_top_build_dir/Makefile deleted file mode 100644 index 80919a1a..00000000 --- a/test_top_build_dir/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -install: - ln -s / ../tmp_check/install From f696b8a9c974a2eac161b0ce5e2c5cb13075680b Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Tue, 26 Sep 2023 14:56:48 +0300 Subject: [PATCH 09/40] Fix compilation error (-Wstringop-overflow) GCC may produce false warnings in some cases when working with strings (char*) when -Wstringop-overflow is enabled. The patch fixes the compilation warning that origins in some tricky pointers casts. --- src/process_moc.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/process_moc.cpp b/src/process_moc.cpp index 4a9e3423..76883e13 100644 --- a/src/process_moc.cpp +++ b/src/process_moc.cpp @@ -122,7 +122,7 @@ char* data_as_char(Smoc* moc, size_t offset = 0) static char* detoasted_offset(Smoc* moc, size_t offset = 0) { - return offset + reinterpret_cast(&(moc->version)); + return offset + reinterpret_cast(moc) + offsetof(Smoc, version); } template @@ -240,7 +240,7 @@ struct moc_tree_layout { rest_level = entries - rest_entries; this_page = page_rest; - } + } else // there is only a single page fragment at this level { rest_level = 0; @@ -526,13 +526,13 @@ get_moc_size(void* moc_in_context, pgs_error_handler error_out) } if (check == b_tree_inf) throw std::logic_error("infinite loop for MOC B-tree depth"); - + // layout: start with the section of the ends of each B+-tree level size_t depth = m.layout.size() - 1; moc_size += depth * MOC_INDEX_ALIGN; // layout: B+-tree layout, starting at root node for (unsigned k = depth; k >= 1; --k) -{ +{ m.layout[k].layout_level(moc_size, MOC_TREE_ENTRY_SIZE); } if (m.layout[depth].level_end > static_cast( @@ -568,7 +568,7 @@ create_moc_release_context(void* moc_in_context, Smoc* moc, hpint64 area = 0; - // this guards against + // this guards against char* moc_data = detoasted_offset(moc, 0); // All levels will be filled out from end to beginning such that @@ -726,7 +726,7 @@ order_break(output_map & outputs, const moc_interval & x, int max_order) void ascii_out(std::string & m_s, char* s, Smoc* moc, int32 begin, int32 end, int32 entry_size) -{ +{ // moc output fiddling: int order = moc->order; m_s.reserve(end); // rough guess @@ -817,7 +817,7 @@ create_moc_out_context(Smoc* moc, int32 end, pgs_error_handler error_out) return ret; } -void +void release_moc_out_context(moc_out_data out_context, pgs_error_handler error_out) { release_context(out_context.context, error_out); From bdfaeabd54673bbdcce88569da7cbf27f8d4260d Mon Sep 17 00:00:00 2001 From: Artem Borodin <54876237+borodun@users.noreply.github.com> Date: Thu, 14 Sep 2023 16:47:59 +0700 Subject: [PATCH 10/40] Add GitHub Actions pipeline for pgSphere --- .github/workflows/build-and-check.yml | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/build-and-check.yml diff --git a/.github/workflows/build-and-check.yml b/.github/workflows/build-and-check.yml new file mode 100644 index 00000000..a113c101 --- /dev/null +++ b/.github/workflows/build-and-check.yml @@ -0,0 +1,67 @@ +name: Build and Check + +on: + push: + pull_request: + +jobs: + build_and_test: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + pg_version: [10, 11, 12, 13, 14, 15, 16] + use_healpix: [0, 1] + + name: PostgreSQL ${{ matrix.pg_version }} - USE_HEALPIX=${{ matrix.use_healpix }} + + steps: + - name: Install dependencies + run: | + sudo apt update && sudo apt install -y \ + postgresql-common \ + libhealpix-cxx-dev \ + docbook-xml \ + docbook-xsl \ + libxml2-utils \ + xsltproc \ + fop + + - name: Install Postgres + run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -p -v ${{ matrix.pg_version }} -i + + - name: Clone pgSphere + uses: actions/checkout@v4 + + - name: Set MAKE_CMD variable + run: echo "MAKE_CMD=make --keep-going -j$(nproc) -l$(nproc) -O" >> $GITHUB_ENV + + - name: Build pgSphere + run: ${MAKE_CMD} PROFILE="-Werror -Wall" USE_HEALPIX=${{ matrix.use_healpix }} + + - name: make test + run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} test + + - name: Install pgSphere + run: sudo ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} install + + - name: make installcheck + run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} installcheck + + - name: make crushtest + run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} crushtest + + - name: Build docs + run: ${MAKE_CMD} -C doc + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: ${{ github.ref_name }}-pg${{ matrix.pg_version }}-use-healpix-${{ matrix.use_healpix }}-${{ github.run_id }} + if-no-files-found: ignore + path: | + ./**/*.log + ./**/*.diffs From 349c7889b6e56fd35d59c0d10a6f9fbf0bc69254 Mon Sep 17 00:00:00 2001 From: borodun Date: Thu, 28 Sep 2023 15:02:05 +0700 Subject: [PATCH 11/40] Use slugified variables for artifact names --- .github/workflows/build-and-check.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-check.yml b/.github/workflows/build-and-check.yml index a113c101..6b2adab3 100644 --- a/.github/workflows/build-and-check.yml +++ b/.github/workflows/build-and-check.yml @@ -56,11 +56,14 @@ jobs: - name: Build docs run: ${MAKE_CMD} -C doc + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - name: Upload artifacts uses: actions/upload-artifact@v3 if: success() || failure() with: - name: ${{ github.ref_name }}-pg${{ matrix.pg_version }}-use-healpix-${{ matrix.use_healpix }}-${{ github.run_id }} + name: ${{ env.GITHUB_REF_SLUG_URL }}-pg${{ matrix.pg_version }}-use-healpix-${{ matrix.use_healpix }}-${{ github.run_id }} if-no-files-found: ignore path: | ./**/*.log From 764642b94d467c8dd93d4c12df07ed70965ae5be Mon Sep 17 00:00:00 2001 From: Vitaly Date: Fri, 29 Sep 2023 09:37:10 +0300 Subject: [PATCH 12/40] Remove the obsolete text from the doc (#65) Remove the obsolete text from the doc --- doc/functions.sgm | 11 ++- doc/install.sgm | 201 ++++++++++++++++++++-------------------------- doc/pg_sphere.xml | 7 +- 3 files changed, 103 insertions(+), 116 deletions(-) diff --git a/doc/functions.sgm b/doc/functions.sgm index 6093c339..b65f8c03 100644 --- a/doc/functions.sgm +++ b/doc/functions.sgm @@ -14,8 +14,9 @@ The area function returns the area of a spherical object in square radians. Supported data types are: - scircle, spolygon (if the polygon - is convex), sbox, and smoc. + scircle, spolygon, sbox, + smoc. The polygon should be convex, otherwise the + behaviour is undefined. Codestin Search App @@ -25,6 +26,12 @@ + + + + + Codestin Search App + SELECT area(smoc '0/1-3');]]> diff --git a/doc/install.sgm b/doc/install.sgm index f1c4b545..ded78fa9 100644 --- a/doc/install.sgm +++ b/doc/install.sgm @@ -1,123 +1,100 @@ Codestin Search App - - Codestin Search App - - pgSphere is not part of the PostgreSQL software. - You can download it from the pgSphere homepage - https://github.com/postgrespro/pgsphere - - + + Codestin Search App - - Codestin Search App - - You will need PostgreSQL - 9.1 or above. We assume that you have - PostgreSQL already compiled and - installed. Please note: Depending on your system configuration mostly you have to be logged in as the system - superuser. - - - There are two ways to compile pgSphere. - The first is to copy the sources into the contribution directory of - PostgreSQL's source tree - (POSTGRESQL_SRC/src/contrib). - Then, change into POSTGRESQL_SRC/src/contrib. - If the sources are not yet installed and the directory - pg_sphere does not exist, take the - gzipped pgSphere sources ( e. g., - pg_sphere_xxx.tgz ) and run: - - - tar -xzf path/to/pg_sphere_xxx.tgz]]> - - - Now, change into the pg_sphere - directory and run : - - + + &pgsphere; is not the part of the &postgresql; software. You can download + the latest release from the + &pgsphere; Releases page. + The source code can also be downloaded by cloning the repository with the + appropriate release tag. The master branch is intended for development + use and may contain the code in a transitional state. It is not recommended + for use in production. + + + + + Codestin Search App + + It is assumed that &postgresql; is already installed. Depending on the + system configuration, superuser (root) access rights may be required to + complete the installation. + + + + The installation script uses &pg_config; utility. Make sure that the + environment variable PATH includes path to &pg_config; utility. The path + to &pg_config; can be also specified in make command: + + make PG_CONFIG=/path/to/pgconfig ...]]> + + + + Unpack the downloaded archive and enter the directory: + + tar -xzf path/to/pgsphere-X.X.X.tgz]]> + cd pgsphere-X.X.X]]> + + + + Compile the code. By default, &pgsphere; is compiled with &healpix; support. + + make]]> - - - and to install pgSphere : - - + + or compile without &healpix; support: + + make USE_HEALPIX=0]]> + + + + Run regression tests optionally. If &pgsphere; was compiled without &healpix; + support, USE_HEALPIX=0 should be specified in make command line. + + + make test]]> + + + + Install &pgsphere; files to the installation directories. The installation + directories are defined by &pg_config; utility. Superuser (root) access + rights may be required. If &pgsphere; was compiled without &healpix; support, + USE_HEALPIX=0 should be added after make. + + make install]]> - - - The second way does not require the PostgreSQL sources but - the configuration tool pg_config. - - - First unpack the pgSphere sources: - - - tar -xzf path_to_pg_sphere_xxx.tgz]]> - - - Now, change into the pg_sphere - directory and run: - - - make USE_PGXS=1 PG_CONFIG=/path/to/pg_config]]> - - - To install pgSphere you have to run : - - - make USE_PGXS=1 PG_CONFIG=/path/to/pg_config install]]> - - - To check the installation change into the pg_sphere source - directory again and run: - - - make installcheck]]> - - - The check status will be displayed. Please note, the check gives different results with - different PostgreSQL-versions. Currently, the check should - run without errors with PostgreSQL-version 8.4. Otherwise check - the file regression.diff. - + + + + + + Codestin Search App + + + We assume you have already created a database userdb, + where userdb is the name of any database. Assume that + the name of &postgresql;'s superuser is postgres. + + + psql -U postgres -c 'CREATE EXTENSION pg_sphere' userdb]]> + - + + It may be necessary to give more psql options, like port + or host name, depending on your system configuration. Please, take a look at + the psql user manual for details. The psql user manual for the latest + &postgresql; version can be found at + + &postgresql; site + . + - - Codestin Search App - - We assume you have already created a database - datab, where datab - is the name of any database. - Presupposing the name of your - PostgreSQL's superuser is - postgres, type: - - - psql -U postgres -c 'CREATE EXTENSION pg_sphere' datab]]> - - - Depending on your system, it may be necessary to give more - psql options like port or host name. - Please have a look at the - PostgreSQL documentation for more - details. - - - To get the version of installed pgSphere software, simply - call: - - + To get the version of installed &pgsphere; software: + SELECT pg_sphere_version();]]> - - + + diff --git a/doc/pg_sphere.xml b/doc/pg_sphere.xml index 1ca32a74..62cd79df 100644 --- a/doc/pg_sphere.xml +++ b/doc/pg_sphere.xml @@ -11,8 +11,6 @@ - - @@ -28,6 +26,11 @@ &ohgr;"> &OHgr;"> &pgr;"> +HEALPix"> +pgSphere"> +PostgreSQL"> +pg_config"> + ]> From 739ecbcf0cae7e0203c0a5bea74a5e65ab9aa344 Mon Sep 17 00:00:00 2001 From: borodun Date: Wed, 27 Sep 2023 16:08:55 +0700 Subject: [PATCH 13/40] Add pipeline for docs using GitHub Pages --- .github/workflows/deploy-docs.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/deploy-docs.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..2047a36c --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,51 @@ +name: Build and Deploy Docs + +# Deploy docs only for master +on: + push: + branches: + - "master" + +# Allow deployment to GitHub Pages +permissions: + pages: write + id-token: write + +jobs: + deploy-docs: + + name: Deploy Docs + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + steps: + - name: Install dependencies + run: | + sudo apt update && sudo apt install -y \ + docbook-xml \ + docbook-xsl \ + libxml2-utils \ + xsltproc \ + fop + + - name: Clone pgSphere + uses: actions/checkout@v4 + + - name: Build docs + run: make -C doc + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: 'doc/html' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 2a2f70ec9de38812fa67889e00a5e29f3e46c02f Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 2 Oct 2023 17:16:11 +0200 Subject: [PATCH 14/40] Bump version to 1.3.2 --- Makefile | 6 +++++- Makefile.common.mk | 2 +- expected/init.out | 2 +- pg_sphere--1.3.1.sql.in => pg_sphere--1.3.2.sql.in | 0 pg_sphere.control | 2 +- upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in | 1 + 6 files changed, 9 insertions(+), 4 deletions(-) rename pg_sphere--1.3.1.sql.in => pg_sphere--1.3.2.sql.in (100%) create mode 100644 upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in diff --git a/Makefile b/Makefile index db9cf597..2d33da46 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ DATA_built = $(RELEASE_SQL) \ pg_sphere--1.2.1--1.2.2.sql \ pg_sphere--1.2.2--1.2.3.sql \ pg_sphere--1.2.3--1.3.0.sql \ - pg_sphere--1.3.0--1.3.1.sql + pg_sphere--1.3.0--1.3.1.sql \ + pg_sphere--1.3.1--1.3.2.sql DOCS = README.pg_sphere COPYRIGHT.pg_sphere REGRESS = init tables points euler circle line ellipse poly path box index \ @@ -258,6 +259,9 @@ pg_sphere--1.2.3--1.3.0.sql: pgs_brin.sql.in pg_sphere--1.3.0--1.3.1.sql: cat upgrade_scripts/$@.in > $@ +pg_sphere--1.3.1--1.3.2.sql: + cat upgrade_scripts/$@.in > $@ + # end of local stuff src/sscan.o : src/sparse.c diff --git a/Makefile.common.mk b/Makefile.common.mk index f3893a9d..6387bea9 100644 --- a/Makefile.common.mk +++ b/Makefile.common.mk @@ -5,4 +5,4 @@ #---------------------------------------------------------------------------- EXTENSION := pg_sphere -PGSPHERE_VERSION := 1.3.1 +PGSPHERE_VERSION := 1.3.2 diff --git a/expected/init.out b/expected/init.out index fb864883..f5e092bf 100644 --- a/expected/init.out +++ b/expected/init.out @@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere; select pg_sphere_version(); pg_sphere_version ------------------- - 1.3.1 + 1.3.2 (1 row) diff --git a/pg_sphere--1.3.1.sql.in b/pg_sphere--1.3.2.sql.in similarity index 100% rename from pg_sphere--1.3.1.sql.in rename to pg_sphere--1.3.2.sql.in diff --git a/pg_sphere.control b/pg_sphere.control index e2b8ad3f..d9f2ccc9 100644 --- a/pg_sphere.control +++ b/pg_sphere.control @@ -1,5 +1,5 @@ # pg_sphere extension comment = 'spherical objects with useful functions, operators and index support' -default_version = '1.3.1' +default_version = '1.3.2' module_pathname = '$libdir/pg_sphere' relocatable = true diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in new file mode 100644 index 00000000..8ea3baa0 --- /dev/null +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -0,0 +1 @@ +-- Nothing to upgrade in the schema From c2a235160db76f9ae050a5eb1f1a7a9135787f58 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 2 Oct 2023 17:24:45 +0200 Subject: [PATCH 15/40] Merge index fetch support for spoint3 into main files So far, the function backing index only fetches on spoint3 gist indexes was already always compiled, but only added to the operator class for PG9.5+, and only when special code in the Makefile was uncommented. We are well past 9.5, and the feature works just fine, so load it unconditionally (assuming no one used it in production yet, ADD FUNCTION will fail when executed twice). Version bumped since we add a new function to the opclass. --- Makefile | 13 ---- expected/index.out | 61 ++++++++++++++++++ expected/index_9.5.out | 62 ------------------- expected/init_test_healpix.out.in | 4 +- index_9.5 | 0 pgs_9.5.sql.in | 7 --- pgs_gist_spoint3.sql.in | 1 + sql/index.sql | 17 +++++ sql/index_9.5.sql | 18 ------ .../pg_sphere--1.3.1--1.3.2.sql.in | 5 +- 10 files changed, 85 insertions(+), 103 deletions(-) delete mode 100644 expected/index_9.5.out delete mode 100644 index_9.5 delete mode 100644 pgs_9.5.sql.in delete mode 100644 sql/index_9.5.sql diff --git a/Makefile b/Makefile index 2d33da46..a016313e 100644 --- a/Makefile +++ b/Makefile @@ -42,8 +42,6 @@ ifneq ($(USE_HEALPIX),0) REGRESS += healpix moc mocautocast endif -REGRESS_9_5 = index_9.5 # experimental for spoint3 - TESTS = init_test tables points euler circle line ellipse poly path box \ index contains_ops contains_ops_compat bounding_box_gist gnomo \ epochprop contains overlaps spoint_brin sbox_brin @@ -84,8 +82,6 @@ endif PGS_SQL += pgs_epochprop.sql -PGS_SQL_9_5 = pgs_9.5.sql # experimental for spoint3 - ifdef USE_PGXS ifndef PG_CONFIG PG_CONFIG = pg_config @@ -112,18 +108,9 @@ endif healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c $(COMPILE.c) -Wno-declaration-after-statement -o $@ $^ -# experimental for spoint3 pg_version := $(word 2,$(shell $(PG_CONFIG) --version)) -pg_version_9_5_plus = $(if $(filter-out 9.1% 9.2% 9.3% 9.4%,$(pg_version)),y,n) has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n) -## the use of spoint 3 is too experimental and preliminary: -#ifeq ($(pg_version_9_5_plus),y) -# REGRESS += $(REGRESS_9_5) -# TESTS += $(REGRESS_9_5) -# PGS_SQL += $(PGS_SQL_9_5) -#endif - crushtest: REGRESS += $(CRUSH_TESTS) crushtest: installcheck diff --git a/expected/index.out b/expected/index.out index a639dabf..8c671556 100644 --- a/expected/index.out +++ b/expected/index.out @@ -134,3 +134,64 @@ SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>' ; 40 (1 row) +-- test spoint3 operator class with and without index-only scan +SET enable_bitmapscan = OFF; +SET enable_indexonlyscan = ON; +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + QUERY PLAN +-------------------------------------------------------- + Aggregate + -> Index Only Scan using spoint3_idx on spheretmp1b + Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle) +(3 rows) + + SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + count +------- + 32 +(1 row) + +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + QUERY PLAN +-------------------------------------------------------- + Aggregate + -> Index Only Scan using spoint3_idx on spheretmp1b + Index Cond: (p = '(3.09 , 1.25)'::spoint) +(3 rows) + + SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + count +------- + 4 +(1 row) + +SET enable_bitmapscan = ON; +SET enable_indexonlyscan = OFF; +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + QUERY PLAN +------------------------------------------------------- + Aggregate + -> Index Scan using spoint3_idx on spheretmp1b + Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle) +(3 rows) + + SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + count +------- + 32 +(1 row) + +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + QUERY PLAN +--------------------------------------------------- + Aggregate + -> Index Scan using spoint3_idx on spheretmp1b + Index Cond: (p = '(3.09 , 1.25)'::spoint) +(3 rows) + + SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + count +------- + 4 +(1 row) + diff --git a/expected/index_9.5.out b/expected/index_9.5.out deleted file mode 100644 index 99995f08..00000000 --- a/expected/index_9.5.out +++ /dev/null @@ -1,62 +0,0 @@ --- test spoint3 operator class with and without index-only scan -SET enable_seqscan = OFF; -SET enable_bitmapscan = OFF; -SET enable_indexonlyscan = ON; -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - QUERY PLAN --------------------------------------------------------- - Aggregate - -> Index Only Scan using spoint3_idx on spheretmp1b - Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle) -(3 rows) - - SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - count -------- - 32 -(1 row) - -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - QUERY PLAN --------------------------------------------------------- - Aggregate - -> Index Only Scan using spoint3_idx on spheretmp1b - Index Cond: (p = '(3.09 , 1.25)'::spoint) -(3 rows) - - SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - count -------- - 4 -(1 row) - -SET enable_bitmapscan = ON; -SET enable_indexonlyscan = OFF; -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - QUERY PLAN -------------------------------------------------------- - Aggregate - -> Index Scan using spoint3_idx on spheretmp1b - Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle) -(3 rows) - - SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - count -------- - 32 -(1 row) - -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - QUERY PLAN ---------------------------------------------------- - Aggregate - -> Index Scan using spoint3_idx on spheretmp1b - Index Cond: (p = '(3.09 , 1.25)'::spoint) -(3 rows) - - SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - count -------- - 4 -(1 row) - diff --git a/expected/init_test_healpix.out.in b/expected/init_test_healpix.out.in index b87a70df..95de0db7 100644 --- a/expected/init_test_healpix.out.in +++ b/expected/init_test_healpix.out.in @@ -1,2 +1,2 @@ -psql:pg_sphere.test.sql:9684: NOTICE: return type smoc is only a shell -psql:pg_sphere.test.sql:9690: NOTICE: argument type smoc is only a shell +psql:pg_sphere.test.sql:9685: NOTICE: return type smoc is only a shell +psql:pg_sphere.test.sql:9691: NOTICE: argument type smoc is only a shell diff --git a/index_9.5 b/index_9.5 deleted file mode 100644 index e69de29b..00000000 diff --git a/pgs_9.5.sql.in b/pgs_9.5.sql.in deleted file mode 100644 index e3b806df..00000000 --- a/pgs_9.5.sql.in +++ /dev/null @@ -1,7 +0,0 @@ --- add functionality that is only available for PostgreSQL 9.5+ - - --- add "fetch" support function to enable index-only scans for spoint3 - -ALTER OPERATOR FAMILY spoint3 USING gist ADD - FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal); diff --git a/pgs_gist_spoint3.sql.in b/pgs_gist_spoint3.sql.in index 0382dade..580a12f7 100644 --- a/pgs_gist_spoint3.sql.in +++ b/pgs_gist_spoint3.sql.in @@ -66,4 +66,5 @@ CREATE OPERATOR CLASS spoint3 FUNCTION 6 g_spoint3_picksplit (internal, internal), FUNCTION 7 g_spoint3_same (bytea, bytea, internal), FUNCTION 8 g_spoint3_distance (internal, internal, int4, oid), + FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal), STORAGE pointkey; diff --git a/sql/index.sql b/sql/index.sql index 7273728e..fb3730a8 100644 --- a/sql/index.sql +++ b/sql/index.sql @@ -59,3 +59,20 @@ SELECT count(*) FROM spheretmp4 WHERE l @ scircle '<(1,1),0.3>' ; SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>' ; +-- test spoint3 operator class with and without index-only scan + +SET enable_bitmapscan = OFF; +SET enable_indexonlyscan = ON; + +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + +SET enable_bitmapscan = ON; +SET enable_indexonlyscan = OFF; + +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; + SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; +EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; diff --git a/sql/index_9.5.sql b/sql/index_9.5.sql deleted file mode 100644 index fe00bcce..00000000 --- a/sql/index_9.5.sql +++ /dev/null @@ -1,18 +0,0 @@ --- test spoint3 operator class with and without index-only scan - -SET enable_seqscan = OFF; -SET enable_bitmapscan = OFF; -SET enable_indexonlyscan = ON; - -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - -SET enable_bitmapscan = ON; -SET enable_indexonlyscan = OFF; - -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; - SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; -EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; - SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in index 8ea3baa0..4077cd6e 100644 --- a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -1 +1,4 @@ --- Nothing to upgrade in the schema +-- add "fetch" support function to enable index-only scans for spoint3 + +ALTER OPERATOR FAMILY spoint3 USING gist ADD + FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal); From cc4d614af64e65fefaa8bb2da21c9c257cc6befe Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 5 Oct 2023 15:03:53 +0200 Subject: [PATCH 16/40] .github: Show regression.diffs on failures --- .github/workflows/build-and-check.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build-and-check.yml b/.github/workflows/build-and-check.yml index 6b2adab3..a4247b8a 100644 --- a/.github/workflows/build-and-check.yml +++ b/.github/workflows/build-and-check.yml @@ -44,15 +44,27 @@ jobs: - name: make test run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} test + - name: Show test regression.diffs + if: ${{ failure() }} + run: cat regression.diffs + - name: Install pgSphere run: sudo ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} install - name: make installcheck run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} installcheck + - name: Show installcheck regression.diffs + if: ${{ failure() }} + run: cat regression.diffs + - name: make crushtest run: pg_virtualenv ${MAKE_CMD} USE_HEALPIX=${{ matrix.use_healpix }} crushtest + - name: Show crushtest regression.diffs + if: ${{ failure() }} + run: cat regression.diffs + - name: Build docs run: ${MAKE_CMD} -C doc From 01143682cad6ae52367143cc8759148e0cc9003f Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 5 Oct 2023 14:23:36 +0200 Subject: [PATCH 17/40] Use a static filename for the header of RELEASE_SQL One place less to update when bumping the version number. --- Makefile | 3 +-- pg_sphere--1.3.2.sql.in => pg_sphere_head.sql.in | 0 2 files changed, 1 insertion(+), 2 deletions(-) rename pg_sphere--1.3.2.sql.in => pg_sphere_head.sql.in (100%) diff --git a/Makefile b/Makefile index a016313e..4051f5d6 100644 --- a/Makefile +++ b/Makefile @@ -130,8 +130,7 @@ endif pg_sphere.test.sql: $(RELEASE_SQL) $(shlib) tail -n+3 $< | sed 's,MODULE_PATHNAME,$(realpath $(shlib)),g' >$@ - -$(RELEASE_SQL): $(addsuffix .in, $(RELEASE_SQL) $(PGS_SQL)) +$(RELEASE_SQL): pg_sphere_head.sql.in $(addsuffix .in, $(PGS_SQL)) cat $^ > $@ # for "create extension from unpacked*": diff --git a/pg_sphere--1.3.2.sql.in b/pg_sphere_head.sql.in similarity index 100% rename from pg_sphere--1.3.2.sql.in rename to pg_sphere_head.sql.in From 8138fc11fed5985252dc37ba567bc7d2076220b7 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 5 Oct 2023 16:08:44 +0200 Subject: [PATCH 18/40] make test: Don't track NOTICEs There's little value in tracking the noise of NOTICEs emitted during loading pg_sphere.test.sql, so just mute them. The gain from this change is that future patches will not have to update the changed line numbers in the output tracked. (Cf. c2a235160) --- Makefile | 6 +----- expected/init_test.out | 2 ++ expected/init_test.out.in | 35 ------------------------------- expected/init_test_healpix.out.in | 2 -- sql/init_test.sql | 3 +-- 5 files changed, 4 insertions(+), 44 deletions(-) create mode 100644 expected/init_test.out delete mode 100644 expected/init_test.out.in delete mode 100644 expected/init_test_healpix.out.in diff --git a/Makefile b/Makefile index 4051f5d6..a79d7209 100644 --- a/Makefile +++ b/Makefile @@ -120,11 +120,7 @@ ifeq ($(has_explain_summary),y) endif endif -test: pg_sphere.test.sql sql/init_test.sql - cp expected/init_test.out.in expected/init_test.out -ifneq ($(USE_HEALPIX),0) - cat expected/init_test_healpix.out.in >> expected/init_test.out -endif +test: pg_sphere.test.sql $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS) pg_sphere.test.sql: $(RELEASE_SQL) $(shlib) diff --git a/expected/init_test.out b/expected/init_test.out new file mode 100644 index 00000000..da0e94be --- /dev/null +++ b/expected/init_test.out @@ -0,0 +1,2 @@ +SET client_min_messages TO WARNING; +\set ECHO none diff --git a/expected/init_test.out.in b/expected/init_test.out.in deleted file mode 100644 index 6fbd06bd..00000000 --- a/expected/init_test.out.in +++ /dev/null @@ -1,35 +0,0 @@ -SET client_min_messages TO NOTICE; -\set ECHO none -psql:pg_sphere.test.sql:9: NOTICE: type "spoint" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:16: NOTICE: argument type spoint is only a shell -psql:pg_sphere.test.sql:32: NOTICE: type "strans" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:39: NOTICE: argument type strans is only a shell -psql:pg_sphere.test.sql:55: NOTICE: type "scircle" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:62: NOTICE: argument type scircle is only a shell -psql:pg_sphere.test.sql:78: NOTICE: type "sline" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:85: NOTICE: argument type sline is only a shell -psql:pg_sphere.test.sql:101: NOTICE: type "sellipse" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:108: NOTICE: argument type sellipse is only a shell -psql:pg_sphere.test.sql:126: NOTICE: type "spoly" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:133: NOTICE: argument type spoly is only a shell -psql:pg_sphere.test.sql:151: NOTICE: type "spath" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:158: NOTICE: argument type spath is only a shell -psql:pg_sphere.test.sql:177: NOTICE: type "sbox" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:184: NOTICE: argument type sbox is only a shell -psql:pg_sphere.test.sql:8658: NOTICE: type "spherekey" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:8665: NOTICE: argument type spherekey is only a shell -psql:pg_sphere.test.sql:8679: NOTICE: type "pointkey" is not yet defined -DETAIL: Creating a shell type definition. -psql:pg_sphere.test.sql:8686: NOTICE: argument type pointkey is only a shell -psql:pg_sphere.test.sql:8692: NOTICE: argument type pointkey is only a shell -psql:pg_sphere.test.sql:8698: NOTICE: argument type pointkey is only a shell -psql:pg_sphere.test.sql:8704: NOTICE: argument type pointkey is only a shell diff --git a/expected/init_test_healpix.out.in b/expected/init_test_healpix.out.in deleted file mode 100644 index 95de0db7..00000000 --- a/expected/init_test_healpix.out.in +++ /dev/null @@ -1,2 +0,0 @@ -psql:pg_sphere.test.sql:9685: NOTICE: return type smoc is only a shell -psql:pg_sphere.test.sql:9691: NOTICE: argument type smoc is only a shell diff --git a/sql/init_test.sql b/sql/init_test.sql index b2793be5..6ef6e89d 100644 --- a/sql/init_test.sql +++ b/sql/init_test.sql @@ -1,4 +1,3 @@ -SET client_min_messages TO NOTICE; +SET client_min_messages TO WARNING; \set ECHO none \i pg_sphere.test.sql -\set ECHO all From 17c2d286a8af13abe651a483b979b476b34aca7b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 4 Oct 2023 17:11:53 +0200 Subject: [PATCH 19/40] Simplify moc test handling in Makefile Remove has_explain_summary since it's only relevant with PG 9.x; move all the if(USE_HEALPIX) sections into one. --- Makefile | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a79d7209..f08a552a 100644 --- a/Makefile +++ b/Makefile @@ -38,18 +38,10 @@ REGRESS = init tables points euler circle line ellipse poly path box index \ contains_ops contains_ops_compat bounding_box_gist gnomo epochprop \ contains overlaps spoint_brin sbox_brin -ifneq ($(USE_HEALPIX),0) -REGRESS += healpix moc mocautocast -endif - TESTS = init_test tables points euler circle line ellipse poly path box \ index contains_ops contains_ops_compat bounding_box_gist gnomo \ epochprop contains overlaps spoint_brin sbox_brin -ifneq ($(USE_HEALPIX),0) -TESTS += healpix moc mocautocast -endif - PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) @@ -70,6 +62,8 @@ PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \ pgs_gist.sql gnomo.sql pgs_brin.sql ifneq ($(USE_HEALPIX),0) +REGRESS += healpix moc moc1 moc100 mocautocast +TESTS += healpix moc moc1 moc100 mocautocast PGS_SQL += healpix.sql endif @@ -109,17 +103,10 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c $(COMPILE.c) -Wno-declaration-after-statement -o $@ $^ pg_version := $(word 2,$(shell $(PG_CONFIG) --version)) -has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n) crushtest: REGRESS += $(CRUSH_TESTS) crushtest: installcheck -ifneq ($(USE_HEALPIX),0) -ifeq ($(has_explain_summary),y) - REGRESS += moc1 moc100 -endif -endif - test: pg_sphere.test.sql $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS) From b367b8c95fcedb751e0e2406d51bc0cfadbdfdd7 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 4 Oct 2023 17:33:13 +0200 Subject: [PATCH 20/40] Drop support for "create extension from unpackaged" PG 13 drops support for "create extension from old_version". Remove support for "from unpackaged". Existing users will likely have converted to an extension-style install years ago. --- Makefile | 48 ------------------- .../pg_sphere--unpackaged--1.1.5.sql.in | 2 - ..._sphere--unpackaged--1.1.5beta0gavo.sql.in | 2 - upgrade_scripts/pgs_pre111.sql.in | 7 --- 4 files changed, 59 deletions(-) delete mode 100644 upgrade_scripts/pg_sphere--unpackaged--1.1.5.sql.in delete mode 100644 upgrade_scripts/pg_sphere--unpackaged--1.1.5beta0gavo.sql.in delete mode 100644 upgrade_scripts/pgs_pre111.sql.in diff --git a/Makefile b/Makefile index f08a552a..5f428ea9 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,6 @@ OBJS += src/healpix.o src/moc.o src/process_moc.o \ endif DATA_built = $(RELEASE_SQL) \ - pg_sphere--unpackaged--1.1.5beta0gavo.sql \ pg_sphere--1.0--1.0_gavo.sql \ pg_sphere--1.0_gavo--1.1.5beta0gavo.sql \ pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql \ @@ -116,28 +115,6 @@ pg_sphere.test.sql: $(RELEASE_SQL) $(shlib) $(RELEASE_SQL): pg_sphere_head.sql.in $(addsuffix .in, $(PGS_SQL)) cat $^ > $@ -# for "create extension from unpacked*": - -UPGRADE_UNP_COMMON = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \ - pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \ - pgs_box.sql pgs_contains_ops_compat.sql pgs_gist.sql \ - pgs_gist_contains_ops.sql contains-ops-fixes-1.sql - -AUGMENT_UNP_COMMON = upgrade_scripts/pgs_pre111.sql pgs_contains_ops.sql \ - gnomo.sql -# for vanilla 1.1.1 users: -AUGMENT_UNP_111 = $(AUGMENT_UNP_COMMON) pgs_gist_pointkey.sql - -# for 1.1.2+ users: 'from unpacked_1.1.2plus' -AUGMENT_UNP_FOR_112plus = $(AUGMENT_UNP_COMMON) -UPGRADE_UNP_FOR_112plus = pgs_gist_pointkey.sql pgs_gist_drop_spoint2.sql.in - -# for "alter extension": - -# TODO: add dynamic pl/pgsql to do perform an additional -# "ALTER EXTENSION pg_sphere UPDATE TO '1.1.5_from_before_2016-02-07';" -# if required. -# # default 1.0 (after 2016-02-07) -> 1.1.5 UPGRADE_1_0_PRE_xxxxxx = contains-ops-fixes-2.sql # '1.1.5_from_2015-08-31' @@ -145,40 +122,15 @@ AUGMENT_1_0_PRE_AAF2D5 = pgs_contains_ops.sql gnomo.sql UPGRADE_1_0_PRE_AAF2D5 = contains-ops-fixes-1.sql pgs_gist_drop_spoint2.sql.in \ pgs_gist_contains_ops.sql -# vanilla 'create from unpackaged' must assume 1.1.1 -# ... - -# create "create extension from unpacked*" files - -# create "alter extension" files - -# local stuff follows here -AUGMENT_GAVO_111 = $(AUGMENT_UNP_111) # for vanilla 1.1.1 users -ifneq ($(USE_HEALPIX),0) -AUGMENT_GAVO_111 += healpix.sql -endif -UPGRADE_GAVO_111 = $(UPGRADE_UNP_COMMON) - # add new HEALPix functions and experimental spoint3 ifneq ($(USE_HEALPIX),0) AUGMENT_FROM_GAVO = healpix.sql endif AUGMENT_FROM_GAVO += pgs_gist_spoint3.sql -AUGMENT_UNP_115B0G = $(AUGMENT_UNP_111) $(AUGMENT_FROM_GAVO) -UPGRADE_UNP_115B0G = $(UPGRADE_UNP_COMMON) - AUGMENT_1_0_115B0G = $(AUGMENT_FROM_GAVO) UPGRADE_1_0_115B0G = contains-ops-fixes-2.sql pgs_gist_drop_spoint2.sql -# test installation 0 -pg_sphere--unpackaged--1.1.5beta0gavo.sql: $(addsuffix .in, \ - $(AUGMENT_GAVO_111) \ - $(addprefix upgrade_scripts/, $(UPGRADE_GAVO_111))) - cat upgrade_scripts/$@.in $^ > $@ - -# (The upgrade of test installation A has been completed.) - # test installation B (generic) pg_sphere--1.0--1.0_gavo.sql: # dummy upgrade to allow for descriptive names cat upgrade_scripts/$@.in > $@ diff --git a/upgrade_scripts/pg_sphere--unpackaged--1.1.5.sql.in b/upgrade_scripts/pg_sphere--unpackaged--1.1.5.sql.in deleted file mode 100644 index 450e6b7d..00000000 --- a/upgrade_scripts/pg_sphere--unpackaged--1.1.5.sql.in +++ /dev/null @@ -1,2 +0,0 @@ --- complain if this upgrade script is run via psql -\echo Use "CREATE EXTENSION pg_sphere FROM unpackaged" to load this file. \quit diff --git a/upgrade_scripts/pg_sphere--unpackaged--1.1.5beta0gavo.sql.in b/upgrade_scripts/pg_sphere--unpackaged--1.1.5beta0gavo.sql.in deleted file mode 100644 index 450e6b7d..00000000 --- a/upgrade_scripts/pg_sphere--unpackaged--1.1.5beta0gavo.sql.in +++ /dev/null @@ -1,2 +0,0 @@ --- complain if this upgrade script is run via psql -\echo Use "CREATE EXTENSION pg_sphere FROM unpackaged" to load this file. \quit diff --git a/upgrade_scripts/pgs_pre111.sql.in b/upgrade_scripts/pgs_pre111.sql.in deleted file mode 100644 index 33a98ae8..00000000 --- a/upgrade_scripts/pgs_pre111.sql.in +++ /dev/null @@ -1,7 +0,0 @@ --- versions before 2009-11-01 (i.e., release 1.1.1.) lack pg_sphere_version(), --- see https://postgrespro.ru/list/id/20091101150558.9B87B1073FEE@pgfoundry.org - -CREATE OR REPLACE FUNCTION pg_sphere_version() - RETURNS CSTRING - AS 'MODULE_PATHNAME', 'pg_sphere_version' - LANGUAGE 'c'; From bcfbd46a3d675f9196ddbf061fb6aa1d0913c7f6 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 4 Oct 2023 16:03:54 +0000 Subject: [PATCH 21/40] Remove ancient "alter extension add" files --- upgrade_scripts/pgs_box.sql.in | 95 -------------- upgrade_scripts/pgs_circle.sql.in | 31 ----- .../pgs_contains_ops_compat.sql.in | 120 ------------------ upgrade_scripts/pgs_ellipse.sql.in | 55 -------- upgrade_scripts/pgs_euler.sql.in | 23 ---- upgrade_scripts/pgs_gist.sql.in | 27 ---- upgrade_scripts/pgs_line.sql.in | 41 ------ upgrade_scripts/pgs_path.sql.in | 67 ---------- upgrade_scripts/pgs_point.sql.in | 14 -- upgrade_scripts/pgs_polygon.sql.in | 68 ---------- upgrade_scripts/pgs_types.sql.in | 24 ---- 11 files changed, 565 deletions(-) delete mode 100644 upgrade_scripts/pgs_box.sql.in delete mode 100644 upgrade_scripts/pgs_circle.sql.in delete mode 100644 upgrade_scripts/pgs_contains_ops_compat.sql.in delete mode 100644 upgrade_scripts/pgs_ellipse.sql.in delete mode 100644 upgrade_scripts/pgs_euler.sql.in delete mode 100644 upgrade_scripts/pgs_gist.sql.in delete mode 100644 upgrade_scripts/pgs_line.sql.in delete mode 100644 upgrade_scripts/pgs_path.sql.in delete mode 100644 upgrade_scripts/pgs_point.sql.in delete mode 100644 upgrade_scripts/pgs_polygon.sql.in delete mode 100644 upgrade_scripts/pgs_types.sql.in diff --git a/upgrade_scripts/pgs_box.sql.in b/upgrade_scripts/pgs_box.sql.in deleted file mode 100644 index 3c259c50..00000000 --- a/upgrade_scripts/pgs_box.sql.in +++ /dev/null @@ -1,95 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION sbox(spoint, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sw(sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION se(sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION nw(sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION ne(sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION area(sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION circum(sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @-@(NONE, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_equal(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR =(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_box(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_box_com(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_box_neg(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_box_com_neg(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_box(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_box_neg(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_cont_point_com(spoint, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_cont_point_com_neg(spoint, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_cont_point(sbox, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_cont_point_neg(sbox, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_circle(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_circle_com(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_circle_neg(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_circle_com_neg(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_box(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_box_com(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_box_neg(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_box_com_neg(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_circle(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_circle_com(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_circle_neg(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_circle_com_neg(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_line(sbox, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_line_com(sline, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_line_neg(sbox, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_line_com_neg(sline, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_line(sbox, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_line_com(sline, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_line_neg(sbox, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_line_com_neg(sline, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_ellipse(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_ellipse_com(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_ellipse_neg(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_ellipse_com_neg(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_box(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_box_com(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_box_neg(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_box_com_neg(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_ellipse(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_ellipse_com(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_ellipse_neg(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_ellipse_com_neg(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_poly(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_poly_com(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_poly_neg(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_poly_com_neg(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_box(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_box_com(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_box_neg(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_box_com_neg(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_poly(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_poly_com(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_poly_neg(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_poly_com_neg(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_path(sbox, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_path_com(spath, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_path_neg(sbox, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_contains_path_com_neg(spath, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_path(sbox, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sbox, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_path_com(spath, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, sbox); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_path_neg(sbox, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sbox, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_overlap_path_com_neg(spath, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, sbox); diff --git a/upgrade_scripts/pgs_circle.sql.in b/upgrade_scripts/pgs_circle.sql.in deleted file mode 100644 index ddd2ab85..00000000 --- a/upgrade_scripts/pgs_circle.sql.in +++ /dev/null @@ -1,31 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION area(scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION radius(scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle(spoint, float8); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_equal(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR =(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_equal_neg(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap_neg(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION center(scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @@(NONE, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION circum(scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @-@(NONE, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contained_by_circle(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_contained_by_circle(spoint, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_contained_by_circle_neg(spoint, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_contained_by_circle_com(scircle, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_contained_by_circle_com_neg(scircle, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION dist(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR <->(scircle, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION dist(scircle, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR <->(scircle, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION dist(spoint, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR <->(spoint, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_circle(scircle, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(scircle, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_circle_inverse(scircle, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(scircle, strans); diff --git a/upgrade_scripts/pgs_contains_ops_compat.sql.in b/upgrade_scripts/pgs_contains_ops_compat.sql.in deleted file mode 100644 index d0e9c229..00000000 --- a/upgrade_scripts/pgs_contains_ops_compat.sql.in +++ /dev/null @@ -1,120 +0,0 @@ -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(scircle, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sbox, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(scircle, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoly, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sline, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sline, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sline, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sline, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sline, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sline, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sbox, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR @(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sline, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sline, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spath, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spoint, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spath, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spoint, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spath, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spath, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(scircle, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spath, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(scircle, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spath, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sellipse, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spath, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sellipse, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spath, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(spoly, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR @(spath, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(spoly, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(spath, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR ~(sbox, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR @(sline, sbox); -ALTER EXTENSION pg_sphere ADD OPERATOR !~(sbox, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !@(sline, sbox); diff --git a/upgrade_scripts/pgs_ellipse.sql.in b/upgrade_scripts/pgs_ellipse.sql.in deleted file mode 100644 index 77e2d777..00000000 --- a/upgrade_scripts/pgs_ellipse.sql.in +++ /dev/null @@ -1,55 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse(spoint, float8, float8, float8); -ALTER EXTENSION pg_sphere ADD FUNCTION inc(sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION lrad(sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION srad(sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle(sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse(scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION strans(sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION center(sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR @@(NONE, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_equal(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR =(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_equal_neg(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_ellipse(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_ellipse_com(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_ellipse_neg(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_ellipse_com_neg(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_ellipse(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_ellipse_neg(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_point(sellipse, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_point_com(spoint, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_point_neg(sellipse, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_point_com_neg(spoint, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_ellipse(sellipse, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(sellipse, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(sellipse, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_circle(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_circle_com(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_circle_neg(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_circle_com_neg(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_ellipse(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_ellipse_com(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_ellipse_neg(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_ellipse_com_neg(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_circle(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_circle_com(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_circle_neg(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_circle_com_neg(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_line_com(sline, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_line_com_neg(sline, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_line(sellipse, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_line_com(sline, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_line_neg(sellipse, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_line_com_neg(sline, sellipse); diff --git a/upgrade_scripts/pgs_euler.sql.in b/upgrade_scripts/pgs_euler.sql.in deleted file mode 100644 index 8ed4ca4c..00000000 --- a/upgrade_scripts/pgs_euler.sql.in +++ /dev/null @@ -1,23 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION strans_zxz(strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans(FLOAT8, FLOAT8, FLOAT8); -ALTER EXTENSION pg_sphere ADD FUNCTION strans(FLOAT8, FLOAT8, FLOAT8, CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION phi(strans); -ALTER EXTENSION pg_sphere ADD FUNCTION theta(strans); -ALTER EXTENSION pg_sphere ADD FUNCTION psi(strans); -ALTER EXTENSION pg_sphere ADD FUNCTION axes(strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_equal(strans, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR =(strans, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_not_equal(strans, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(strans, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans(strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(NONE, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_invert(strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(NONE, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_point(spoint, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(spoint, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_point_inverse(spoint, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(spoint, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_trans(strans, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(strans, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_trans_inv(strans, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(strans, strans); diff --git a/upgrade_scripts/pgs_gist.sql.in b/upgrade_scripts/pgs_gist.sql.in deleted file mode 100644 index aaa0e4eb..00000000 --- a/upgrade_scripts/pgs_gist.sql.in +++ /dev/null @@ -1,27 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION spherekey_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION spherekey_out(spherekey); -ALTER EXTENSION pg_sphere ADD TYPE spherekey; -ALTER EXTENSION pg_sphere ADD FUNCTION g_spherekey_decompress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spherekey_union(bytea, internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spherekey_picksplit(internal, internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spoint_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spoint_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS spoint USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_scircle_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_scircle_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS scircle USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_sline_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_sline_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS sline USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_sellipse_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_sellipse_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS sellipse USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_spoly_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spoly_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS spoly USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_spath_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_spath_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS spath USING gist; -ALTER EXTENSION pg_sphere ADD FUNCTION g_sbox_compress(internal); -ALTER EXTENSION pg_sphere ADD FUNCTION g_sbox_consistent(internal, internal, int4, oid, internal); -ALTER EXTENSION pg_sphere ADD OPERATOR CLASS sbox USING gist; diff --git a/upgrade_scripts/pgs_line.sql.in b/upgrade_scripts/pgs_line.sql.in deleted file mode 100644 index 3e9c6cee..00000000 --- a/upgrade_scripts/pgs_line.sql.in +++ /dev/null @@ -1,41 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION sline(spoint, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sline(strans, float8); -ALTER EXTENSION pg_sphere ADD FUNCTION meridian(float8); -ALTER EXTENSION pg_sphere ADD FUNCTION sl_beg(sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sl_end(sline); -ALTER EXTENSION pg_sphere ADD FUNCTION strans(sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_equal(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR =(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_equal_neg(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION length(sline); -ALTER EXTENSION pg_sphere ADD OPERATOR @-@(NONE, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION swap(sline); -ALTER EXTENSION pg_sphere ADD OPERATOR -(NONE, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION turn(sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !(NONE, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_crosses(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR #(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_crosses_neg(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !#(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap_neg(sline, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_line(sline, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(sline, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_line_inverse(sline, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(sline, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap_circle(sline, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap_circle_com(scircle, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap_circle_neg(sline, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_overlap_circle_com_neg(scircle, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_line(scircle, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_line_com(sline, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_line_neg(scircle, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_line_com_neg(sline, scircle); diff --git a/upgrade_scripts/pgs_path.sql.in b/upgrade_scripts/pgs_path.sql.in deleted file mode 100644 index e40b4457..00000000 --- a/upgrade_scripts/pgs_path.sql.in +++ /dev/null @@ -1,67 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION npoints(spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint(spath, int4); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint(spath, float8); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_equal(spath, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR =(spath, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_equal_neg(spath, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(spath, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION length(spath); -ALTER EXTENSION pg_sphere ADD OPERATOR @-@(NONE, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION swap(spath); -ALTER EXTENSION pg_sphere ADD OPERATOR -(NONE, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_path(spath, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_path_neg(spath, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_contains_point(spath, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_contains_point_com(spoint, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_contains_point_neg(spath, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_contains_point_com_neg(spoint, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_path(spath, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(spath, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_path_inverse(spath, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(spath, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_path(scircle, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_path_com(spath, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_path_neg(scircle, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_path_com_neg(spath, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap_path(scircle, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap_path_com(spath, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap_path_neg(scircle, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_overlap_path_com_neg(spath, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_line(spath, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_line_com(sline, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_line_neg(spath, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_overlap_line_com_neg(sline, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_path(sellipse, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_path_com(spath, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_path_neg(sellipse, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_path_com_neg(spath, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_path(sellipse, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_path_com(spath, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_path_neg(sellipse, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_overlap_path_com_neg(spath, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_path(spoly, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_path_com(spath, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_path_neg(spoly, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_path_com_neg(spath, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_path(spoly, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_path_com(spath, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spath, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_path_neg(spoly, spath); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, spath); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_path_com_neg(spath, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spath, spoly); diff --git a/upgrade_scripts/pgs_point.sql.in b/upgrade_scripts/pgs_point.sql.in deleted file mode 100644 index 754128f6..00000000 --- a/upgrade_scripts/pgs_point.sql.in +++ /dev/null @@ -1,14 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION spoint(FLOAT8, FLOAT8); -ALTER EXTENSION pg_sphere ADD FUNCTION set_sphere_output_precision(INT4); -ALTER EXTENSION pg_sphere ADD FUNCTION set_sphere_output(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION long(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION lat(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION x(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION y(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION xyz(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION z(spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_equal(spoint, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR =(spoint, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(spoint, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION dist(spoint, spoint); -ALTER EXTENSION pg_sphere ADD OPERATOR <->(spoint, spoint); diff --git a/upgrade_scripts/pgs_polygon.sql.in b/upgrade_scripts/pgs_polygon.sql.in deleted file mode 100644 index 6a76b2fa..00000000 --- a/upgrade_scripts/pgs_polygon.sql.in +++ /dev/null @@ -1,68 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION npoints(spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION area(spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_equal(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR =(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_not_equal(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR <>(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION circum(spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR @-@(NONE, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_polygon(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_polygon_com(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_polygon_neg(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_polygon_com_neg(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_polygon(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_polygon_neg(spoly, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_point(spoly, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_point_com(spoint, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_point_neg(spoly, spoint); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_point_com_neg(spoint, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_poly(spoly, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR +(spoly, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_poly_inverse(spoly, strans); -ALTER EXTENSION pg_sphere ADD OPERATOR -(spoly, strans); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_circle(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_circle_com(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_circle_neg(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_circle_com_neg(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_polygon(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_polygon_com(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_polygon_neg(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_contains_polygon_com_neg(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_circle(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_circle_com(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_circle_neg(spoly, scircle); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, scircle); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_circle_com_neg(scircle, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(scircle, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_line(spoly, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_line_com(sline, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_line_neg(spoly, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_line_com_neg(sline, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_line(spoly, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_line_com(sline, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sline, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_line_neg(spoly, sline); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, sline); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_line_com_neg(sline, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sline, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_ellipse(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_ellipse_com(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_ellipse_neg(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_contains_ellipse_com_neg(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_polygon(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_polygon_com(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_polygon_neg(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_contains_polygon_com_neg(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_ellipse(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_ellipse_com(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR &&(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_ellipse_neg(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(spoly, sellipse); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_overlap_ellipse_com_neg(sellipse, spoly); -ALTER EXTENSION pg_sphere ADD OPERATOR !&&(sellipse, spoly); diff --git a/upgrade_scripts/pgs_types.sql.in b/upgrade_scripts/pgs_types.sql.in deleted file mode 100644 index 95378a0f..00000000 --- a/upgrade_scripts/pgs_types.sql.in +++ /dev/null @@ -1,24 +0,0 @@ -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION spoint_out(spoint); -ALTER EXTENSION pg_sphere ADD TYPE spoint; -ALTER EXTENSION pg_sphere ADD FUNCTION strans_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION strans_out(strans); -ALTER EXTENSION pg_sphere ADD TYPE strans; -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION scircle_out(scircle); -ALTER EXTENSION pg_sphere ADD TYPE scircle; -ALTER EXTENSION pg_sphere ADD FUNCTION sline_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION sline_out(sline); -ALTER EXTENSION pg_sphere ADD TYPE sline; -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION sellipse_out(sellipse); -ALTER EXTENSION pg_sphere ADD TYPE sellipse; -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION spoly_out(spoly); -ALTER EXTENSION pg_sphere ADD TYPE spoly; -ALTER EXTENSION pg_sphere ADD FUNCTION spath_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION spath_out(spath); -ALTER EXTENSION pg_sphere ADD TYPE spath; -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_in(CSTRING); -ALTER EXTENSION pg_sphere ADD FUNCTION sbox_out(sbox); -ALTER EXTENSION pg_sphere ADD TYPE sbox; From afde97d8e0f903aa886a00b48d95568fdc6a0d3a Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 16 Oct 2023 15:06:30 +0200 Subject: [PATCH 22/40] g_spoint3_fetch was already part of the spoint3 opclass in older versions Allow upgrading of older installations (made pre 1.1.5) that already have g_spoint3_fetch in the spoint3 opclass. Close #82. --- upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in index 4077cd6e..1ada0662 100644 --- a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -1,4 +1,14 @@ -- add "fetch" support function to enable index-only scans for spoint3 -ALTER OPERATOR FAMILY spoint3 USING gist ADD - FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal); +-- g_spoint3_fetch was already part of the spoint3 opclass in older versions +-- around 1.0, but later made optional (see bdc37d1) + +DO $$ +BEGIN + ALTER OPERATOR FAMILY spoint3 USING gist ADD + FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal); +EXCEPTION + WHEN duplicate_object THEN NULL; + WHEN OTHERS THEN RAISE; +END; +$$; From ab701182d4dd75b167df557f4f80869fd45242fa Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 16 Oct 2023 13:12:53 +0200 Subject: [PATCH 23/40] Remove two unused expected output files They where part of the initial commit, but not changed since then. --- expected/pg_sphere.out | 2484 ---------------------------------------- expected/point.out | 240 ---- 2 files changed, 2724 deletions(-) delete mode 100644 expected/pg_sphere.out delete mode 100644 expected/point.out diff --git a/expected/pg_sphere.out b/expected/pg_sphere.out deleted file mode 100644 index 1a1b3340..00000000 --- a/expected/pg_sphere.out +++ /dev/null @@ -1,2484 +0,0 @@ --- --- first, define the datatype. Turn off echoing so that expected file --- does not depend on contents of pg_sphere.sql. --- -\set ECHO none -psql:pgs_types.sql:23: NOTICE: TypeCreate: changing argument type of function spoint_out from OPAQUE to spoint -psql:pgs_types.sql:23: NOTICE: TypeCreate: changing return type of function spoint_in from OPAQUE to spoint -psql:pgs_types.sql:46: NOTICE: TypeCreate: changing argument type of function scircle_out from OPAQUE to scircle -psql:pgs_types.sql:46: NOTICE: TypeCreate: changing return type of function scircle_in from OPAQUE to scircle -psql:pgs_types.sql:69: NOTICE: TypeCreate: changing argument type of function sellipse_out from OPAQUE to sellipse -psql:pgs_types.sql:69: NOTICE: TypeCreate: changing return type of function sellipse_in from OPAQUE to sellipse -psql:pgs_types.sql:93: NOTICE: TypeCreate: changing argument type of function sline_out from OPAQUE to sline -psql:pgs_types.sql:93: NOTICE: TypeCreate: changing return type of function sline_in from OPAQUE to sline -psql:pgs_types.sql:118: NOTICE: TypeCreate: changing argument type of function spath_out from OPAQUE to spath -psql:pgs_types.sql:118: NOTICE: TypeCreate: changing return type of function spath_in from OPAQUE to spath -psql:pgs_types.sql:142: NOTICE: TypeCreate: changing argument type of function spoly_out from OPAQUE to spoly -psql:pgs_types.sql:142: NOTICE: TypeCreate: changing return type of function spoly_in from OPAQUE to spoly -psql:pgs_types.sql:166: NOTICE: TypeCreate: changing argument type of function strans_out from OPAQUE to strans -psql:pgs_types.sql:166: NOTICE: TypeCreate: changing return type of function strans_in from OPAQUE to strans -psql:pgs_gist.sql:22: NOTICE: TypeCreate: changing argument type of function spherekey_out from OPAQUE to spherekey -psql:pgs_gist.sql:22: NOTICE: TypeCreate: changing return type of function spherekey_in from OPAQUE to spherekey --- check spherical point operators -SELECT spoint '(0, 90d)' = spoint '(0, 90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0, 90d)' = spoint '(0,-90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0,-90d)' = spoint '(0,-90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0, 90d)' != spoint '(0, 90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0, 90d)' != spoint '(0,-90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0,-90d)' != spoint '(0,-90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0d, 0)' = spoint '(360d,0)'; - ?column? ----------- - t -(1 row) - --- checking spherical circle operators -SELECT scircle '<(0, 90d),1>' = '<(0, 90d),1>' ; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0,-90d),1>' <> '<(0, 90d),1>' ; - ?column? ----------- - t -(1 row) - --- checking spherical line operators -SELECT sline ( spoint '(0, 90d)', spoint '(0, -89d)' ) = - sline ( spoint '(0, 90d)', spoint '(0, -89d)' ) ; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0, 90d)', spoint '(0, -89d)' ) <> - sline ( spoint '(0, -89d)', spoint '(0, 90d)' ) ; - ?column? ----------- - t -(1 row) - --- checking Euler transformation operators -SELECT strans '-10d,0d,10d,ZZZ' = '-10d,0d,10d,XXX' ; - ?column? ----------- - t -(1 row) - -SELECT strans '-40d,0d,40d,ZZZ' <> '-40d,0d,40d,XXX' ; - ?column? ----------- - f -(1 row) - --- checking polygon operators -\set poly 'spoly \'{(0.1,0),(0.2,0),(0.2,0.1),(0.3,0.1),(0.3,-0.1),(0.4,-0.1),(0.5,0.1),(0.4,0.2),(0.1,0.2)}\'' -SELECT spoint '(0.15,0.10)' @ :poly; -- point inside polygon - ?column? ----------- - t -(1 row) - -SELECT spoint '(0.20,0.00)' @ :poly; -- point contained polygon - ?column? ----------- - t -(1 row) - -SELECT spoint '(0.10,0.10)' @ :poly; -- point contained polygon - ?column? ----------- - t -(1 row) - -SELECT spoint '(0.25,0.50)' @ :poly; -- point outside polygon - ?column? ----------- - f -(1 row) - -SELECT spoint '(0.25,0.00)' @ :poly; -- point outside polygon - ?column? ----------- - f -(1 row) - -SELECT scircle '<(0.15,0.10),0.03>' @ :poly; -- circle inside polygon - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0.20,0.00),0.00>' @ :poly; -- circle contained polygon - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0.20,0.30),0.05>' @ :poly; -- circle outside polygon - ?column? ----------- - f -(1 row) - -SELECT scircle '<(0.25,0.00),0.05>' @ :poly; -- circle overlaps polygon - ?column? ----------- - f -(1 row) - -SELECT scircle '<(0.25,0.00),0.10>' @ :poly; -- circle overlaps polygon - ?column? ----------- - f -(1 row) - -SELECT scircle '<(0.15,0.10),0.03>' && :poly; -- circle inside polygon - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0.20,0.00),0.00>' && :poly; -- circle contained polygon - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0.20,0.30),0.05>' && :poly; -- circle outside polygon - ?column? ----------- - f -(1 row) - -SELECT scircle '<(0.25,0.00),0.05>' && :poly; -- circle overlaps polygon - ?column? ----------- - t -(1 row) - -SELECT scircle '<(0.25,0.00),0.10>' && :poly; -- circle overlaps polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) @ :poly; -- line touches polygon - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) @ :poly; -- line touches polygon - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) @ :poly; -- line touches polygon - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) @ :poly; -- line touches and inside polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.45,-0.20)', spoint '(0.45,0.20)' ) @ :poly; -- line overlaps polygon - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(0.45, 0.10)', spoint '(0.45,0.20)' ) @ :poly; -- line overlaps polygon - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(0.24, 0.17)', spoint '(0.25,0.14)' ) @ :poly; -- line inside polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) && :poly; -- line touches polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) && :poly; -- line touches polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) && :poly; -- line touches polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) && :poly; -- line touches and inside polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.45,-0.20)', spoint '(0.45,0.20)' ) && :poly; -- line overlaps polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.45, 0.10)', spoint '(0.45,0.20)' ) && :poly; -- line overlaps polygon - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(0.24, 0.17)', spoint '(0.25,0.14)' ) && :poly; -- line inside polygon - ?column? ----------- - t -(1 row) - -\unset poly -\set poly1 'spoly \'{(0,0),(1,0),(0,1)}\'' -\set poly2 'spoly \'{(1,0),(0,0),(0,1)}\'' -\set poly3 'spoly \'{(0,1),(0,0),(1,0)}\'' -\set poly4 'spoly \'{(0.1,0.9),(0.1,0.1),(0.9,0.1)}\'' -\set poly5 'spoly \'{(0.2,0.0),(1.2,0.0),(0.2,1)}\'' -SELECT :poly1 = :poly2; - ?column? ----------- - f -(1 row) - -SELECT :poly2 = :poly3; - ?column? ----------- - f -(1 row) - -SELECT :poly3 = :poly1; - ?column? ----------- - t -(1 row) - -SELECT :poly1 && :poly2; - ?column? ----------- - t -(1 row) - -SELECT :poly2 && :poly3; - ?column? ----------- - t -(1 row) - -SELECT :poly3 && :poly1; - ?column? ----------- - t -(1 row) - -SELECT :poly1 @ :poly2; - ?column? ----------- - t -(1 row) - -SELECT :poly2 @ :poly3; - ?column? ----------- - t -(1 row) - -SELECT :poly3 @ :poly1; - ?column? ----------- - t -(1 row) - -SELECT :poly1 @ :poly4; - ?column? ----------- - f -(1 row) - -SELECT :poly4 @ :poly1; - ?column? ----------- - t -(1 row) - -SELECT :poly1 && :poly4; - ?column? ----------- - t -(1 row) - -SELECT :poly4 && :poly1; - ?column? ----------- - t -(1 row) - -SELECT :poly1 @ :poly5; - ?column? ----------- - f -(1 row) - -SELECT :poly5 @ :poly1; - ?column? ----------- - f -(1 row) - -SELECT :poly1 && :poly5; - ?column? ----------- - t -(1 row) - -SELECT :poly5 && :poly1; - ?column? ----------- - t -(1 row) - -\unset poly1 -\unset poly2 -\unset poly3 -\unset poly4 -\unset poly5 --- checking path operators -\set poly 'spoly \'{(0.1,0),(0.2,0),(0.2,0.1),(0.3,0.1),(0.3,-0.1),(0.4,-0.1),(0.5,0.1),(0.4,0.2),(0.1,0.2)}\'' -\set path1 'spath \'{(0.1,0),(0.2,0),(0.2,0.1),(0.3,0.1),(0.3,-0.1),(0.4,-0.1),(0.5,0.1),(0.4,0.2),(0.1,0.2)}\'' -\set path2 'spath \'{(0,0),(1,0),(2,0),(3,0)}\'' -\set path3 'spath \'{(0,0),(0,1),(0,1.5)}\'' -SELECT @-@ spath '{(0,0),(1,0),(2,0),(3,0)}'; - ?column? ----------- - 3 -(1 row) - -SELECT :path1 = :path2; - ?column? ----------- - f -(1 row) - -SELECT :path1 = :path1; - ?column? ----------- - t -(1 row) - -SELECT :path1 <> :path2; - ?column? ----------- - t -(1 row) - -SELECT :path1 <> :path1; - ?column? ----------- - f -(1 row) - -SELECT :poly && :path1; - ?column? ----------- - t -(1 row) - -SELECT :path1 && :poly ; - ?column? ----------- - t -(1 row) - -SELECT :path1 @ :poly ; - ?column? ----------- - t -(1 row) - -SELECT :path2 @ :poly ; - ?column? ----------- - f -(1 row) - -SELECT :path1 && :path1; - ?column? ----------- - t -(1 row) - -SELECT :path1 && :path1; - ?column? ----------- - t -(1 row) - -SELECT :poly && :path2; - ?column? ----------- - t -(1 row) - -SELECT :path2 && :poly ; - ?column? ----------- - t -(1 row) - -SELECT :path2 && :path1; - ?column? ----------- - t -(1 row) - -SELECT :poly && :path3; - ?column? ----------- - f -(1 row) - -SELECT :path3 && :poly ; - ?column? ----------- - f -(1 row) - -SELECT :path3 && :path1; - ?column? ----------- - f -(1 row) - -SELECT :path3 && :path2; - ?column? ----------- - t -(1 row) - -SELECT :path1 @ scircle '<(0,1),1>'; - ?column? ----------- - f -(1 row) - -SELECT :path3 @ scircle '<(0,1),1>'; - ?column? ----------- - t -(1 row) - -SELECT :path3 @ scircle '<(0,1),0.7>'; - ?column? ----------- - f -(1 row) - -SELECT :path1 && scircle '<(0,1),1>'; - ?column? ----------- - t -(1 row) - -SELECT :path3 && scircle '<(0,1),1>'; - ?column? ----------- - t -(1 row) - -SELECT :path3 && scircle '<(0,1),0.7>'; - ?column? ----------- - t -(1 row) - -SELECT :path3 && scircle '<(0,-1),0.7>'; - ?column? ----------- - f -(1 row) - -SELECT :path3 @ scircle '<(0,-1),0.7>'; - ?column? ----------- - f -(1 row) - -SELECT :path3 && sline ( spoint '(0,-1)', spoint '(0,1)' ); - ?column? ----------- - t -(1 row) - -SELECT :path3 && sline ( spoint '(-1,0)', spoint '(1,0)' ); - ?column? ----------- - t -(1 row) - -SELECT :path3 && sline ( spoint '(-1,0)', spoint '(-0.3,0)' ); - ?column? ----------- - f -(1 row) - -SELECT spath '{(0.11,0.15),(0.12,0.15),(0.13,0.15)}' @ :poly; - ?column? ----------- - t -(1 row) - --- ellipse tests ---equal operator -SELECT sellipse '<{0d,0d},(170d,-12d),0d>' = sellipse '<{0d,0d},(170d,-12d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{0d,0d},(170d,-12d),0d>' = sellipse '<{0d,0d},(170d,-12d),-2d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,5d},(170d,-12d),0d>' = sellipse '<{5d,5d},(170d,-12d),-2d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,2d},(170d,-12d),0d>' = sellipse '<{5d,2d},(170d,-12d),-2d>'; - ?column? ----------- - f -(1 row) - --- not equal -SELECT sellipse '<{5d,2d},(170d,-12d),0d>' != sellipse '<{5d,2d},(170d,-12d),-2d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,2d},(170d,-12d),0d>' != sellipse '<{5d,2d},(170d,-12d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},(300d,0d), 0d>' = sellipse '<{10d,5d},(300d,0d), 180d>' ; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},(300d,0d), 90d>' = sellipse '<{10d,5d},(300d,0d), 270d>' ; - ?column? ----------- - t -(1 row) - --- ellipse and point -SELECT spoint '(280d,-20d)' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(280d,-10d)' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(280d,-9.9d)' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spoint '(280d,-10d)' ; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spoint '(280d, -9d)' ; - ?column? ----------- - f -(1 row) - -SELECT spoint '(280d,-10d)' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(280d,-9.9d)' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spoint '(280d,-10d)' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spoint '(280d, -9d)' ; - ?column? ----------- - t -(1 row) - --- ---ellipse and circle (@,&&) --- --- negators and commutators -SELECT scircle '<(280d,-10d),0d>' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d, -9d),0d>' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-10d),0d>' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d, -9d),0d>' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ scircle '<(280d,-10d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ scircle '<(280d, -9d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ scircle '<(280d,-10d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ scircle '<(280d, -9d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-10d),2d>' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d, 0d),2d>' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-10d),2d>' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d, 0d),2d>' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && scircle '<(280d,-10d),2d>' ; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && scircle '<(280d, 0d),2d>' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& scircle '<(280d,-10d),2d>' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& scircle '<(280d, 0d),2d>' ; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-10d),0d>' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - - --- ellipse is circle -SELECT scircle '<(280d,-10d),2d>' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),2d>' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-16d),2d>' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),15d>' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' @ scircle '<(280d,-10d),2d>' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' @ scircle '<(280d,-18d),2d>' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' @ scircle '<(280d,-16d),2d>' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' @ scircle '<(280d,-18d),15d>' ; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-10d),2d>' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),2d>' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-16d),2d>' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - --- ellipse is line -SELECT scircle '<(280d,-10d),0d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),0d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-16d),0d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-18d),15d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-10d),0d>' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),0d>' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT scircle '<(280d,-10d),2d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),2d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-16d),2d>' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-10d),2d>' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT scircle '<(280d,-18d),2d>' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,0d},(280d,-20d),90d>' @ scircle '<(280d,-18d),15d>' ; - ?column? ----------- - t -(1 row) - --- ---ellipse and line (@,&&) --- --- negators and commutators -SELECT sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ) @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ) @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ) @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ) && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ) && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ) && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ) !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ) !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ) !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ) !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ) !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ) !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ); - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ); - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ); - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ); - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& sline ( spoint '(280d, -9d)', spoint '(280d, -8d)' ); - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& sline ( spoint '(280d, -9d)', spoint '(280d,-12d)' ); - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& sline ( spoint '(280d,-11d)', spoint '(280d,-12d)' ); - ?column? ----------- - f -(1 row) - --- line is point , ellipse is point -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is point , ellipse is circle -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is point , ellipse is a real ellipse -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) @ sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -8d)' ) && sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is a real line , ellipse is point -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is a real line , ellipse is circle -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is a real line , ellipse is line -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{5d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{5d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- line is a real line , ellipse is a real ellipse -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) @ sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sline ( spoint '(280d, -8d)', spoint '(280d, -9d)' ) && sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- --- ellipse and path --- --- negators , commutator @,&& -SELECT spath '{(280d, -9d),(280d, -8d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -9d),(280d,-12d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d,-11d),(280d,-12d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -9d),(280d, -8d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -9d),(280d,-12d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d,-11d),(280d,-12d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -9d),(280d, -8d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -9d),(280d,-12d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d,-11d),(280d,-12d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -9d),(280d, -8d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -9d),(280d,-12d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d,-11d),(280d,-12d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spath '{(280d, -9d),(280d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spath '{(280d, -9d),(280d,-12d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spath '{(280d,-11d),(280d,-12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spath '{(280d, -9d),(280d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spath '{(280d, -9d),(280d,-12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spath '{(280d,-11d),(280d,-12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spath '{(280d, -9d),(280d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spath '{(280d, -9d),(280d,-12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spath '{(280d,-11d),(280d,-12d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spath '{(280d, -9d),(280d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spath '{(280d, -9d),(280d,-12d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spath '{(280d,-11d),(280d,-12d)}'; - ?column? ----------- - f -(1 row) - --- path is a line , ellipse is point -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{0d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- path is a line , ellipse is circle -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{5d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- path is a line , ellipse is path -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{5d,0d},(280d, -8d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{5d,0d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- path is a line , ellipse is a real ellipse -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' @ sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spath '{(280d, -8d),(280d, -9d)}' && sellipse '<{10d,5d},(280d, -8d),90d>'; - ?column? ----------- - t -(1 row) - --- --- ellipse and polygon --- --- negators , commutator @,&& -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}' && sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}' !@ sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}' !&& sellipse '<{10d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' ~ spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !~ spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d, -9d),(280d,-12d),(279d, -8d)}'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}'; - ?column? ----------- - f -(1 row) - --- ellipse is point -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - --- ellipse is circle -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}' @ sellipse '<{2d,2d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{5d,5d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{2d,2d},(280d,-20d),90d>' @ spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,5d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-18d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - --- ellipse is line -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}' @ sellipse '<{2d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{5d,0d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{2d,0d},(280d,-20d),90d>' @ spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-18d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - --- ellipse is a real ellipse -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{5d,2d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}' @ sellipse '<{2d,1d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{5d,2d},(280d,-20d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{5d,2d},(280d,-20d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,2d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{2d,1d},(280d,-20d),90d>' @ spoly '{(280d,-10d),(290d,-30d),(270d, -30d)}'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{5d,2d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{5d,2d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-18d),(279d, -12d)}'; - ?column? ----------- - t -(1 row) - --- --- ellipse and ellipse --- --- check @ -SELECT sellipse '<{10d, 5d},(300d,0d), 0d>' @ sellipse '<{10d,5d},(300d,0d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},(300d,0d), 90d>' @ sellipse '<{10d,5d},(300d,0d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},(300d,0d),180d>' @ sellipse '<{10d,5d},(300d,0d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},(300d,0d),270d>' @ sellipse '<{10d,5d},(300d,0d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 2d, 1d},( 52d,6d), 0d>' @ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - --- negators , commutator @,&& -SELECT sellipse '<{ 2d, 1d},( 52d,6d), 0d>' @ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},( 52d,6d), 0d>' @ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},( 90d,9d), 0d>' @ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 2d, 1d},( 52d,6d), 0d>' && sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},( 52d,6d), 0d>' && sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},( 90d,9d), 0d>' && sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 2d, 1d},( 52d,6d), 0d>' !@ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},( 52d,6d), 0d>' !@ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d, 5d},( 90d,9d), 0d>' !@ sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 2d, 1d},( 52d,6d), 0d>' !&& sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},( 52d,6d), 0d>' !&& sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d, 5d},( 90d,9d), 0d>' !&& sellipse '<{10d,5d},(50d,5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' ~ sellipse '<{ 2d, 1d},( 52d,6d), 0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' ~ sellipse '<{10d, 5d},( 52d,6d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' ~ sellipse '<{10d, 5d},( 90d,9d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' && sellipse '<{ 2d, 1d},( 52d,6d), 0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' && sellipse '<{10d, 5d},( 52d,6d), 0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' && sellipse '<{10d, 5d},( 90d,9d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !~ sellipse '<{ 2d, 1d},( 52d,6d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !~ sellipse '<{10d, 5d},( 52d,6d), 0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !~ sellipse '<{10d, 5d},( 90d,9d), 0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !&& sellipse '<{ 2d, 1d},( 52d,6d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !&& sellipse '<{10d, 5d},( 52d,6d), 0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{10d,5d},(50d,5d),45d>' !&& sellipse '<{10d, 5d},( 90d,9d), 0d>'; - ?column? ----------- - t -(1 row) - --- left ellipse is point right ellipse is point -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' @ sellipse '<{0d,0d},(50d,-5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' @ sellipse '<{0d,0d},(50d,-5d),45d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' && sellipse '<{0d,0d},(50d,-5d),45d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' && sellipse '<{0d,0d},(50d,-5d),45d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is line right ellipse is point -SELECT sellipse '<{ 5d, 0d},( 50d, -2d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d,-12d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d, -2d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d,-12d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is circle right ellipse is point -SELECT sellipse '<{ 5d, 5d},( 50d, -2d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-12d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d, -2d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-12d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is real ellipse right ellipse is point -SELECT sellipse '<{ 5d, 3d},( 50d, -2d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 3d},( 50d,-12d), 90d>' @ sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 3d},( 50d, -2d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 3d},( 50d,-12d), 90d>' && sellipse '<{0d,0d},(50d,-5d),0d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is point right ellipse is line -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d, 6d), 0d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d, 6d), 0d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is line right ellipse is line -SELECT sellipse '<{ 3d, 0d},( 50d,-5d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d,-8d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d,-6d), 0d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d, 6d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d,-5d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d,-8d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d,-6d), 0d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 0d},( 50d, 6d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is circle right ellipse is line -SELECT sellipse '<{ 3d, 3d},( 50d,-5d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-8d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-6d), 0d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d, 6d), 90d>' @ sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-5d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-8d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-6d), 0d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d, 6d), 90d>' && sellipse '<{5d,0d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is point right ellipse is circle -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d, 6d), 0d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-5d), 0d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d,-6d), 0d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 0d, 0d},( 50d, 6d), 0d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is line right ellipse is circle -SELECT sellipse '<{ 5d, 0d},( 50d,-5d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d,-6d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d, 6d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d,-5d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d,-6d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 0d},( 50d, 6d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- left ellipse is circle right ellipse is circle -SELECT sellipse '<{ 3d, 3d},( 50d,-4d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-5d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-6d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d, 6d), 90d>' @ sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - -SELECT sellipse '<{ 3d, 3d},( 50d,-4d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-5d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d,-6d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - t -(1 row) - -SELECT sellipse '<{ 5d, 5d},( 50d, 6d), 90d>' && sellipse '<{5d,5d},(50d,-5d),90d>'; - ?column? ----------- - f -(1 row) - --- index tests -CREATE TABLE spheretmp1 (p spoint); -\copy spheretmp1 from 'data/test_spherepoint.data' -\copy spheretmp1 from 'data/test_spherepoint.data' -\copy spheretmp1 from 'data/test_spherepoint.data' -\copy spheretmp1 from 'data/test_spherepoint.data' -CREATE TABLE spheretmp2 (c scircle); -\copy spheretmp2 from 'data/test_spherecircle.data' -\copy spheretmp2 from 'data/test_spherecircle.data' -\copy spheretmp2 from 'data/test_spherecircle.data' -\copy spheretmp2 from 'data/test_spherecircle.data' -CREATE TABLE spheretmp4 AS - SELECT sline ( p , p - strans '-15d,-15d,-15d,ZXZ' ) AS l - FROM spheretmp1; --- checking input -SELECT count(*) FROM spheretmp1 WHERE p @ scircle '< ( 180d 1m 10s , -2d 23m 59s ) , 10d >'; - count -------- - 32 -(1 row) - --- without idx -SELECT count(*) FROM spheretmp1 WHERE p @ scircle '<(1,1),0.3>'; - count -------- - 32 -(1 row) - -SELECT count(*) FROM spheretmp2 WHERE c @ scircle '<(1,1),0.3>'; - count -------- - 12 -(1 row) - -SELECT count(*) FROM spheretmp2 WHERE c && scircle '<(1,1),0.3>'; - count -------- - 48 -(1 row) - -SELECT count(*) FROM spheretmp4 WHERE l @ scircle '<(1,1),0.3>'; - count -------- - 8 -(1 row) - -SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>'; - count -------- - 40 -(1 row) - -SELECT count(*) FROM spheretmp1 WHERE p = spoint '(3.09 , 1.25)' ; - count -------- - 4 -(1 row) - --- create idx -CREATE INDEX aaaidx ON spheretmp1 USING gist ( p ); -CREATE INDEX bbbidx ON spheretmp2 USING gist ( c ); -CREATE INDEX cccidx ON spheretmp4 USING gist ( l ); ---with idx -SET enable_seqscan = OFF ; -SELECT count(*) FROM spheretmp1 WHERE p @ scircle '<(1,1),0.3>' ; - count -------- - 32 -(1 row) - -SELECT count(*) FROM spheretmp2 WHERE c @ scircle '<(1,1),0.3>' ; - count -------- - 12 -(1 row) - -SELECT count(*) FROM spheretmp2 WHERE c && scircle '<(1,1),0.3>' ; - count -------- - 48 -(1 row) - -SELECT count(*) FROM spheretmp4 WHERE l @ scircle '<(1,1),0.3>' ; - count -------- - 8 -(1 row) - -SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>' ; - count -------- - 40 -(1 row) - -SELECT count(*) FROM spheretmp1 WHERE p = spoint '(3.09 , 1.25)' ; - count -------- - 4 -(1 row) - diff --git a/expected/point.out b/expected/point.out deleted file mode 100644 index d6aa4c25..00000000 --- a/expected/point.out +++ /dev/null @@ -1,240 +0,0 @@ --- radian input -SELECT spoint (-3*pi(), 0); - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint ( 3*pi(), 0); - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint ( 0, pi()); - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint ( 0, -pi()); - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint ( 2*pi(), 2*pi()); - spoint ---------- - (0 , 0) -(1 row) - -SELECT spoint ( pi(), 2*pi()); - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint ( 0, pi()/2); - spoint ------------------------ - (0 , 1.5707963267949) -(1 row) - -SELECT spoint ( 0, -pi()/2); - spoint ------------------------- - (0 , -1.5707963267949) -(1 row) - --- degree input -SELECT spoint '(-540d, 0d)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 540d, 0d)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0d, 180d)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0d, -180d)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 360d, 360d)'; - spoint ---------- - (0 , 0) -(1 row) - -SELECT spoint '( 180d, 360d)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0d, 90d)'; - spoint ------------------------ - (0 , 1.5707963267949) -(1 row) - -SELECT spoint '( 0d, -90d)'; - spoint ------------------------- - (0 , -1.5707963267949) -(1 row) - --- dms input -SELECT spoint '( 0.0d 0m 0s, 0d 0m 0s)'; -ERROR: parsing: syntax error -SELECT spoint '( 0d 60m 0s, 0d 0m 0s)'; -ERROR: parsing: minutes or seconds invalid (min:60.000000 sec:0.000000) -SELECT spoint '( 0d 0m 60s, 0d 0m 0s)'; -ERROR: parsing: minutes or seconds invalid (min:0.000000 sec:60.000000) -SELECT spoint '( 539d 59m 59.9999s, 0d 0m 0s)'; - spoint ------------------------- - (3.14159265310498 , 0) -(1 row) - -SELECT spoint '( 0d 0m 0s, 180d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0d 0m 0s, -180d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 360d 0m 0s, 360d 0m 0s)'; - spoint ---------- - (0 , 0) -(1 row) - -SELECT spoint '( 180d 0m 0s, 360d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0d 0m 0s, 90d 0m 0s)'; - spoint ------------------------ - (0 , 1.5707963267949) -(1 row) - -SELECT spoint '( 0d 0m 0s, -90d 0m 0s)'; - spoint ------------------------- - (0 , -1.5707963267949) -(1 row) - --- hms input for latitude -SELECT spoint '( 0.0h 0m 0s, 0)'; -ERROR: parsing: syntax error -SELECT spoint '( 0h 60m 0s, 0)'; -ERROR: parsing: minutes or seconds invalid (min:60.000000 sec:0.000000) -SELECT spoint '( 0h 0m 60s, 0)'; -ERROR: parsing: minutes or seconds invalid (min:0.000000 sec:60.000000) -SELECT spoint '( 35h 59m 59.9999s, 0d 0m 0s)'; - spoint ------------------------- - (3.14159264631759 , 0) -(1 row) - -SELECT spoint '( 0h 0m 0s, 180d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0h 0m 0s, -180d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 24h 0m 0s, 360d 0m 0s)'; - spoint ---------- - (0 , 0) -(1 row) - -SELECT spoint '( 12h 0m 0s, 360d 0m 0s)'; - spoint ------------------------- - (3.14159265358979 , 0) -(1 row) - -SELECT spoint '( 0h 0m 0s, 90d 0m 0s)'; - spoint ------------------------ - (0 , 1.5707963267949) -(1 row) - -SELECT spoint '( 0h 0m 0s, -90d 0m 0s)'; - spoint ------------------------- - (0 , -1.5707963267949) -(1 row) - --- mixed input --- operators -SELECT spoint '(0, 90d)' = spoint '(0, 90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0, 90d)' = spoint '(0,-90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0,-90d)' = spoint '(0,-90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0, 90d)' != spoint '(0, 90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0, 90d)' != spoint '(0,-90d)'; - ?column? ----------- - t -(1 row) - -SELECT spoint '(0,-90d)' != spoint '(0,-90d)'; - ?column? ----------- - f -(1 row) - -SELECT spoint '(0d, 0)' = spoint '(360d,0)'; - ?column? ----------- - t -(1 row) - From 65217de6e51a229737b793f24ab63a24349a3043 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 27 Jul 2023 18:02:20 +0200 Subject: [PATCH 24/40] Implement restriction selectivity estimators for <@(spoint, scircle) This implements restriction selectivity estimation for the <@ @> !<@ !@> family of operators on spoint and scircle. The selectivity is estimated to be (area of sphere circle) / (4 pi). Queries like `select * from sky where sky.star <@ scircle(const, radius)` will be able to properly estimate if using an index is appropriate depending on the size of radius. Secondly, a function spoint_dwithin(p1 spoint, p2 spoint, radius float8) is added that effectively returns `p1 <-> p2 <= radius`. But other than this two-operator expression, it has GIST index support so the optimizer can rewrite it to either `p1 <@ scircle(p2, radius)` or `p2 <@ scircle(p1, radius)`, i.e. it is symmetric in the first two arguments. This allows efficient matching queries without the user having to encode the join ordering in the query. On PostgreSQL 10/11, the spoint_dwithin function is created, but without the GIST support since that only appeared in PG12. The file expected/selectivity_1.out is used on PG10/11; it has <@ flipped around to @> in some plans. --- Makefile | 24 ++-- doc/functions.sgm | 35 ++++++ expected/gist_support.out | 155 ++++++++++++++++++++++++++ expected/index.out | 2 +- expected/points.out | 16 +++ expected/selectivity.out | 124 +++++++++++++++++++++ expected/selectivity_1.out | 124 +++++++++++++++++++++ pgs_circle_sel.sql.in | 109 ++++++++++++++++++ pgs_gist_support.sql.in | 12 ++ sql/gist_support.sql | 26 +++++ sql/index.sql | 2 +- sql/points.sql | 9 ++ sql/selectivity.sql | 36 ++++++ src/circle.c | 2 +- src/circle_sel.c | 218 ++++++++++++++++++++++++++++++++++++ src/gist_support.c | 223 +++++++++++++++++++++++++++++++++++++ src/pgs_util.h | 13 +++ src/point.c | 12 ++ 18 files changed, 1132 insertions(+), 10 deletions(-) create mode 100644 expected/gist_support.out create mode 100644 expected/selectivity.out create mode 100644 expected/selectivity_1.out create mode 100644 pgs_circle_sel.sql.in create mode 100644 pgs_gist_support.sql.in create mode 100644 sql/gist_support.sql create mode 100644 sql/selectivity.sql create mode 100644 src/circle_sel.c create mode 100644 src/gist_support.c diff --git a/Makefile b/Makefile index 5f428ea9..1e9805f4 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,8 @@ SRC_DIR = $(shell basename $(shell pwd)) MODULE_big = pg_sphere OBJS = src/sscan.o src/sparse.o src/sbuffer.o src/vector3d.o src/point.o \ - src/euler.o src/circle.o src/line.o src/ellipse.o src/polygon.o \ - src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o \ + src/euler.o src/circle.o src/circle_sel.o src/line.o src/ellipse.o src/polygon.o \ + src/path.o src/box.o src/output.o src/gq_cache.o src/gist.o src/gist_support.o \ src/key.o src/gnomo.o src/epochprop.o src/brin.o ifneq ($(USE_HEALPIX),0) @@ -35,11 +35,11 @@ DATA_built = $(RELEASE_SQL) \ DOCS = README.pg_sphere COPYRIGHT.pg_sphere REGRESS = init tables points euler circle line ellipse poly path box index \ contains_ops contains_ops_compat bounding_box_gist gnomo epochprop \ - contains overlaps spoint_brin sbox_brin + contains overlaps spoint_brin sbox_brin selectivity TESTS = init_test tables points euler circle line ellipse poly path box \ index contains_ops contains_ops_compat bounding_box_gist gnomo \ - epochprop contains overlaps spoint_brin sbox_brin + epochprop contains overlaps spoint_brin sbox_brin selectivity PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) @@ -58,7 +58,7 @@ CRUSH_TESTS = init_extended circle_extended PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \ pgs_line.sql pgs_ellipse.sql pgs_polygon.sql pgs_path.sql \ pgs_box.sql pgs_contains_ops.sql pgs_contains_ops_compat.sql \ - pgs_gist.sql gnomo.sql pgs_brin.sql + pgs_gist.sql gnomo.sql pgs_brin.sql pgs_circle_sel.sql ifneq ($(USE_HEALPIX),0) REGRESS += healpix moc moc1 moc100 mocautocast @@ -102,10 +102,17 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c $(COMPILE.c) -Wno-declaration-after-statement -o $@ $^ pg_version := $(word 2,$(shell $(PG_CONFIG) --version)) +has_support_functions = $(if $(filter-out 9.% 10.% 11.%,$(pg_version)),y,n) crushtest: REGRESS += $(CRUSH_TESTS) crushtest: installcheck +ifeq ($(has_support_functions),y) +PGS_SQL += pgs_gist_support.sql +REGRESS += gist_support +TESTS += gist_support +endif + test: pg_sphere.test.sql $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS) @@ -180,8 +187,11 @@ pg_sphere--1.2.3--1.3.0.sql: pgs_brin.sql.in pg_sphere--1.3.0--1.3.1.sql: cat upgrade_scripts/$@.in > $@ -pg_sphere--1.3.1--1.3.2.sql: - cat upgrade_scripts/$@.in > $@ +ifeq ($(has_support_functions),y) +pg_sphere--1.3.1--1.3.2.sql: pgs_gist_support.sql.in +endif +pg_sphere--1.3.1--1.3.2.sql: pgs_circle_sel.sql.in + cat upgrade_scripts/$@.in $^ > $@ # end of local stuff diff --git a/doc/functions.sgm b/doc/functions.sgm index b65f8c03..232b7552 100644 --- a/doc/functions.sgm +++ b/doc/functions.sgm @@ -149,6 +149,41 @@ + + Codestin Search App + + The function + + + + spoint_dwithin + spoint p1 + spoint p2 + float8 radius + + + + returns a boolean value that signifies whether the points + p1 and p2 + lie within distance radius (in radians) of each other, i.e. + it computes the boolean expression p1 <-> p2 <= radius. + On PostgreSQL 12 and later, the function has GiST + support and the PostgreSQL optimizer will transform it to either + p1 <@ scircle(p2, radius) or + p2 <@ scircle(p1, radius) where appropriate. + + + Codestin Search App + + SELECT * FROM stars1 JOIN stars2 WHERE spoint_dwithin(stars1.s, stars2.s, 1e-5);]]> + + + + diff --git a/expected/gist_support.out b/expected/gist_support.out new file mode 100644 index 00000000..dead655f --- /dev/null +++ b/expected/gist_support.out @@ -0,0 +1,155 @@ +-- spoint_dwithin function selectivity +set jit = off; -- suppress extra planning output +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), 1)'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '1'::double precision) + Rows Removed by Filter: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: (star <@ '<(1 , 1) , 1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '0.1'::double precision) + Rows Removed by Filter: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), .01)'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.01>'::scircle) +(2 rows) + +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, 1)'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Filter: spoint_dwithin('(1 , 1)'::spoint, star, '1'::double precision) + Rows Removed by Filter: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: (star <@ '<(1 , 1) , 1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, .1)'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Filter: spoint_dwithin('(1 , 1)'::spoint, star, '0.1'::double precision) + Rows Removed by Filter: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, .01)'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.01>'::scircle) +(2 rows) + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, 1)', do_analyze := 'false'); + explain +--------------------------------------------------------------------------------------- + Nested Loop (rows=22984885 width=32) + -> Seq Scan on spoint10k a (rows=10000 width=16) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=2298 width=16) + Index Cond: (star OPERATOR(public.<@) scircle(a.star, '1'::double precision)) +(4 rows) + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .1)'); + explain +----------------------------------------------------------------------------------------------------------- + Nested Loop (rows=249792 width=32) (actual rows=505342 loops=1) + -> Seq Scan on spoint10k a (rows=10000 width=16) (actual rows=10000 loops=1) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=25 width=16) (actual rows=51 loops=10000) + Index Cond: (star OPERATOR(public.<@) scircle(a.star, '0.1'::double precision)) + Rows Removed by Index Recheck: 31 +(5 rows) + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01)'); + explain +--------------------------------------------------------------------------------------------------------- + Nested Loop (rows=2500 width=32) (actual rows=17614 loops=1) + -> Seq Scan on spoint10k a (rows=10000 width=16) (actual rows=10000 loops=1) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=1 width=16) (actual rows=2 loops=10000) + Index Cond: (star OPERATOR(public.<@) scircle(a.star, '0.01'::double precision)) + Rows Removed by Index Recheck: 1 +(5 rows) + +-- spoint_dwithin is symmetric in the first two arguments +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------------------ + Nested Loop (rows=6 width=32) (actual rows=33 loops=1) + -> Bitmap Heap Scan on spoint10k a (rows=25 width=16) (actual rows=29 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '0.1'::double precision) + Rows Removed by Filter: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=1 width=16) (actual rows=1 loops=29) + Index Cond: (star OPERATOR(public.<@) scircle(a.star, '0.01'::double precision)) + Rows Removed by Index Recheck: 0 +(10 rows) + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(b.star, a.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------------------ + Nested Loop (rows=6 width=32) (actual rows=33 loops=1) + -> Bitmap Heap Scan on spoint10k a (rows=25 width=16) (actual rows=29 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '0.1'::double precision) + Rows Removed by Filter: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=1 width=16) (actual rows=1 loops=29) + Index Cond: (star OPERATOR(public.<@) scircle(a.star, '0.01'::double precision)) + Rows Removed by Index Recheck: 0 +(10 rows) + +-- both sides indexable, check if the planner figures out the better choice +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1) and spoint_dwithin(b.star, spoint(1,1), .05)'); + explain +------------------------------------------------------------------------------------------------------------------------------------- + Nested Loop (rows=1 width=32) (actual rows=16 loops=1) + -> Bitmap Heap Scan on spoint10k b (rows=6 width=16) (actual rows=12 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '0.05'::double precision) + Rows Removed by Filter: 4 + Heap Blocks: exact=14 + -> Bitmap Index Scan on spoint10k_star_idx (rows=6 width=0) (actual rows=16 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.05>'::scircle) + -> Index Scan using spoint10k_star_idx on spoint10k a (rows=1 width=16) (actual rows=1 loops=12) + Index Cond: ((star OPERATOR(public.<@) scircle(b.star, '0.01'::double precision)) AND (star <@ '<(1 , 1) , 0.1>'::scircle)) + Rows Removed by Index Recheck: 0 +(10 rows) + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .05) and spoint_dwithin(b.star, spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------------------------------------------------- + Nested Loop (rows=1 width=32) (actual rows=16 loops=1) + -> Bitmap Heap Scan on spoint10k a (rows=6 width=16) (actual rows=12 loops=1) + Filter: spoint_dwithin(star, '(1 , 1)'::spoint, '0.05'::double precision) + Rows Removed by Filter: 4 + Heap Blocks: exact=14 + -> Bitmap Index Scan on spoint10k_star_idx (rows=6 width=0) (actual rows=16 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.05>'::scircle) + -> Index Scan using spoint10k_star_idx on spoint10k b (rows=1 width=16) (actual rows=1 loops=12) + Index Cond: ((star OPERATOR(public.<@) scircle(a.star, '0.01'::double precision)) AND (star <@ '<(1 , 1) , 0.1>'::scircle)) + Rows Removed by Index Recheck: 0 +(10 rows) + diff --git a/expected/index.out b/expected/index.out index 8c671556..eefa5c63 100644 --- a/expected/index.out +++ b/expected/index.out @@ -55,6 +55,7 @@ SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>'; -- create idx CREATE TABLE spheretmp1b AS TABLE spheretmp1; +ANALYZE spheretmp1; CREATE INDEX aaaidx ON spheretmp1 USING gist ( p ); CREATE INDEX spoint3_idx ON spheretmp1b USING gist (p spoint3); CREATE INDEX bbbidx ON spheretmp2 USING gist ( c ); @@ -165,7 +166,6 @@ EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1 4 (1 row) -SET enable_bitmapscan = ON; SET enable_indexonlyscan = OFF; EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; QUERY PLAN diff --git a/expected/points.out b/expected/points.out index 6fb3c17b..f3a0713a 100644 --- a/expected/points.out +++ b/expected/points.out @@ -666,3 +666,19 @@ SELECT '( 0h 2m 30s , -90d 0m 0s)'::spoint<->'( 12h 2m 30s , -90d 0m 0s)'::spoin 0 (1 row) +-- spoint_dwithin function ---------- +SELECT a, b, radius, a <-> b AS "<->", spoint_dwithin(a, b, radius) +FROM (VALUES + ('(0, 0)'::spoint, '(0, 0)'::spoint, 0), + ('(0, 0)', '(0, 1)', 1), + ('(0, 0)', '(0.1, 0.1)', 0.14), + ('(0, 0)', '(0.1, 0.1)', 0.15) + ) sub (a, b, radius); + a | b | radius | <-> | spoint_dwithin +---------+-------------+--------+-----------------+---------------- + (0 , 0) | (0 , 0) | 0 | 0 | t + (0 , 0) | (0 , 1) | 1 | 1 | t + (0 , 0) | (0.1 , 0.1) | 0.14 | 0.1413032986961 | f + (0 , 0) | (0.1 , 0.1) | 0.15 | 0.1413032986961 | t +(4 rows) + diff --git a/expected/selectivity.out b/expected/selectivity.out new file mode 100644 index 00000000..e694f0f5 --- /dev/null +++ b/expected/selectivity.out @@ -0,0 +1,124 @@ +-- test selectivity estimator functions +create table spoint10k (star spoint); +insert into spoint10k select spoint(i, i*i) from generate_series(1, 10000) g(i); +create index on spoint10k using gist (star); +analyze spoint10k; +-- "explain analyze" wrapper that removes 'cost=...' since it varies across architectures +-- (we can't use "costs off" since that also removes the estimated row count) +create or replace function explain(query text, do_analyze text default 'true') returns setof text language plpgsql as $$ +declare + line text; +begin + for line in execute format('explain (analyze %s, timing off, summary off) %s', do_analyze, query) loop + return next regexp_replace(line, 'cost=\S+ ', ''); + end loop; + return; +end; +$$; +-- <@ operator selectivity +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), 1)'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Recheck Cond: (star <@ '<(1 , 1) , 1>'::scircle) + Rows Removed by Index Recheck: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: (star <@ '<(1 , 1) , 1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Recheck Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) + Rows Removed by Index Recheck: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .01)'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.01>'::scircle) +(2 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) @> star'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Recheck Cond: ('<(1 , 1) , 1>'::scircle @> star) + Rows Removed by Index Recheck: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: (star <@ '<(1 , 1) , 1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .1) @> star'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Recheck Cond: ('<(1 , 1) , 0.1>'::scircle @> star) + Rows Removed by Index Recheck: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .01) @> star'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.01>'::scircle) +(2 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), 1)'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=7702 width=16) (actual rows=6991 loops=1) + Filter: (star !<@ '<(1 , 1) , 1>'::scircle) + Rows Removed by Filter: 3009 +(3 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .1)'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=9975 width=16) (actual rows=9971 loops=1) + Filter: (star !<@ '<(1 , 1) , 0.1>'::scircle) + Rows Removed by Filter: 29 +(3 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .01)'); + explain +------------------------------------------------------------------------- + Seq Scan on spoint10k (rows=10000 width=16) (actual rows=9999 loops=1) + Filter: (star !<@ '<(1 , 1) , 0.01>'::scircle) + Rows Removed by Filter: 1 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) !@> star'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=7702 width=16) (actual rows=6991 loops=1) + Filter: ('<(1 , 1) , 1>'::scircle !@> star) + Rows Removed by Filter: 3009 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .1) !@> star'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=9975 width=16) (actual rows=9971 loops=1) + Filter: ('<(1 , 1) , 0.1>'::scircle !@> star) + Rows Removed by Filter: 29 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .01) !@> star'); + explain +------------------------------------------------------------------------- + Seq Scan on spoint10k (rows=10000 width=16) (actual rows=9999 loops=1) + Filter: ('<(1 , 1) , 0.01>'::scircle !@> star) + Rows Removed by Filter: 1 +(3 rows) + diff --git a/expected/selectivity_1.out b/expected/selectivity_1.out new file mode 100644 index 00000000..08cd8f74 --- /dev/null +++ b/expected/selectivity_1.out @@ -0,0 +1,124 @@ +-- test selectivity estimator functions +create table spoint10k (star spoint); +insert into spoint10k select spoint(i, i*i) from generate_series(1, 10000) g(i); +create index on spoint10k using gist (star); +analyze spoint10k; +-- "explain analyze" wrapper that removes 'cost=...' since it varies across architectures +-- (we can't use "costs off" since that also removes the estimated row count) +create or replace function explain(query text, do_analyze text default 'true') returns setof text language plpgsql as $$ +declare + line text; +begin + for line in execute format('explain (analyze %s, timing off, summary off) %s', do_analyze, query) loop + return next regexp_replace(line, 'cost=\S+ ', ''); + end loop; + return; +end; +$$; +-- <@ operator selectivity +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), 1)'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Recheck Cond: (star <@ '<(1 , 1) , 1>'::scircle) + Rows Removed by Index Recheck: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: (star <@ '<(1 , 1) , 1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .1)'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Recheck Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) + Rows Removed by Index Recheck: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.1>'::scircle) +(6 rows) + +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .01)'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: (star <@ '<(1 , 1) , 0.01>'::scircle) +(2 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) @> star'); + explain +----------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=2298 width=16) (actual rows=3009 loops=1) + Recheck Cond: ('<(1 , 1) , 1>'::scircle @> star) + Rows Removed by Index Recheck: 1560 + Heap Blocks: exact=55 + -> Bitmap Index Scan on spoint10k_star_idx (rows=2298 width=0) (actual rows=4569 loops=1) + Index Cond: ('<(1 , 1) , 1>'::scircle @> star) +(6 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .1) @> star'); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on spoint10k (rows=25 width=16) (actual rows=29 loops=1) + Recheck Cond: ('<(1 , 1) , 0.1>'::scircle @> star) + Rows Removed by Index Recheck: 19 + Heap Blocks: exact=32 + -> Bitmap Index Scan on spoint10k_star_idx (rows=25 width=0) (actual rows=48 loops=1) + Index Cond: ('<(1 , 1) , 0.1>'::scircle @> star) +(6 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .01) @> star'); + explain +--------------------------------------------------------------------------------------------- + Index Scan using spoint10k_star_idx on spoint10k (rows=1 width=16) (actual rows=1 loops=1) + Index Cond: ('<(1 , 1) , 0.01>'::scircle @> star) +(2 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), 1)'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=7702 width=16) (actual rows=6991 loops=1) + Filter: (star !<@ '<(1 , 1) , 1>'::scircle) + Rows Removed by Filter: 3009 +(3 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .1)'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=9975 width=16) (actual rows=9971 loops=1) + Filter: (star !<@ '<(1 , 1) , 0.1>'::scircle) + Rows Removed by Filter: 29 +(3 rows) + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .01)'); + explain +------------------------------------------------------------------------- + Seq Scan on spoint10k (rows=10000 width=16) (actual rows=9999 loops=1) + Filter: (star !<@ '<(1 , 1) , 0.01>'::scircle) + Rows Removed by Filter: 1 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) !@> star'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=7702 width=16) (actual rows=6991 loops=1) + Filter: ('<(1 , 1) , 1>'::scircle !@> star) + Rows Removed by Filter: 3009 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .1) !@> star'); + explain +------------------------------------------------------------------------ + Seq Scan on spoint10k (rows=9975 width=16) (actual rows=9971 loops=1) + Filter: ('<(1 , 1) , 0.1>'::scircle !@> star) + Rows Removed by Filter: 29 +(3 rows) + +select explain('select * from spoint10k where scircle(spoint(1,1), .01) !@> star'); + explain +------------------------------------------------------------------------- + Seq Scan on spoint10k (rows=10000 width=16) (actual rows=9999 loops=1) + Filter: ('<(1 , 1) , 0.01>'::scircle !@> star) + Rows Removed by Filter: 1 +(3 rows) + diff --git a/pgs_circle_sel.sql.in b/pgs_circle_sel.sql.in new file mode 100644 index 00000000..d1e9c7ee --- /dev/null +++ b/pgs_circle_sel.sql.in @@ -0,0 +1,109 @@ +CREATE FUNCTION spoint_contained_by_circle_sel(internal, oid, internal, integer) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_sel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_sel(internal, oid, internal, integer) IS + 'selectivity estimator function for spoint_contained_by_circle'; + +CREATE FUNCTION spoint_contained_by_circle_joinsel(internal, oid, internal, smallint, internal) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_joinsel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_joinsel(internal, oid, internal, smallint, internal) IS + 'join selectivity estimator function for spoint_contained_by_circle'; + + +CREATE FUNCTION spoint_contained_by_circle_neg_sel(internal, oid, internal, integer) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_neg_sel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_neg_sel(internal, oid, internal, integer) IS + 'selectivity estimator function for spoint_contained_by_circle_neg'; + +CREATE FUNCTION spoint_contained_by_circle_neg_joinsel(internal, oid, internal, smallint, internal) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_neg_joinsel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_neg_joinsel(internal, oid, internal, smallint, internal) IS + 'join selectivity estimator function for spoint_contained_by_circle_neg'; + + +CREATE FUNCTION spoint_contained_by_circle_com_sel(internal, oid, internal, integer) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_com_sel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_com_sel(internal, oid, internal, integer) IS + 'selectivity estimator function for spoint_contained_by_circle_com'; + +CREATE FUNCTION spoint_contained_by_circle_com_joinsel(internal, oid, internal, smallint, internal) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_com_joinsel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_com_joinsel(internal, oid, internal, smallint, internal) IS + 'join selectivity estimator function for spoint_contained_by_circle_com'; + + +CREATE FUNCTION spoint_contained_by_circle_com_neg_sel(internal, oid, internal, integer) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_com_neg_sel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_com_neg_sel(internal, oid, internal, integer) IS + 'selectivity estimator function for spoint_contained_by_circle_com_neg'; + +CREATE FUNCTION spoint_contained_by_circle_com_neg_joinsel(internal, oid, internal, smallint, internal) + RETURNS double precision + AS 'MODULE_PATHNAME' , 'spherepoint_in_circle_com_neg_joinsel' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_contained_by_circle_com_neg_joinsel(internal, oid, internal, smallint, internal) IS + 'join selectivity estimator function for spoint_contained_by_circle_com_neg'; + + +ALTER OPERATOR @> (scircle, spoint) +SET ( + RESTRICT = spoint_contained_by_circle_com_sel, + JOIN = spoint_contained_by_circle_com_joinsel +); + +ALTER OPERATOR <@ (spoint, scircle) +SET ( + RESTRICT = spoint_contained_by_circle_sel, + JOIN = spoint_contained_by_circle_joinsel +); + +ALTER OPERATOR !@> (scircle, spoint) +SET ( + RESTRICT = spoint_contained_by_circle_com_neg_sel, + JOIN = spoint_contained_by_circle_com_neg_joinsel +); + +ALTER OPERATOR !<@ (spoint, scircle) +SET ( + RESTRICT = spoint_contained_by_circle_neg_sel, + JOIN = spoint_contained_by_circle_neg_joinsel +); + + +CREATE FUNCTION spoint_dwithin(spoint, spoint, float8) + RETURNS boolean + AS 'MODULE_PATHNAME', 'spherepoint_dwithin' + LANGUAGE C + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoint_dwithin(spoint, spoint, float8) IS + 'predicate matching spherical points less than a given distance apart'; diff --git a/pgs_gist_support.sql.in b/pgs_gist_support.sql.in new file mode 100644 index 00000000..97b40597 --- /dev/null +++ b/pgs_gist_support.sql.in @@ -0,0 +1,12 @@ +-- PG12+ has support functions + +CREATE FUNCTION spoint_dwithin_supportfn (internal) + RETURNS internal + AS 'MODULE_PATHNAME', 'spherepoint_dwithin_supportfn' + LANGUAGE 'c'; + +COMMENT ON FUNCTION spoint_dwithin_supportfn(internal) IS + 'support function for spoint_dwithin'; + +ALTER FUNCTION spoint_dwithin(spoint, spoint, float8) + SUPPORT spoint_dwithin_supportfn; diff --git a/sql/gist_support.sql b/sql/gist_support.sql new file mode 100644 index 00000000..361b3d61 --- /dev/null +++ b/sql/gist_support.sql @@ -0,0 +1,26 @@ +-- spoint_dwithin function selectivity +set jit = off; -- suppress extra planning output + +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), 1)'); +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), .1)'); +select explain('select * from spoint10k where spoint_dwithin(star, spoint(1,1), .01)'); + +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, 1)'); +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, .1)'); +select explain('select * from spoint10k where spoint_dwithin(spoint(1,1), star, .01)'); + +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, 1)', do_analyze := 'false'); +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .1)'); +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01)'); + +-- spoint_dwithin is symmetric in the first two arguments +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1)'); +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(b.star, a.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1)'); + +-- both sides indexable, check if the planner figures out the better choice +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .1) and spoint_dwithin(b.star, spoint(1,1), .05)'); +select explain('select * from spoint10k a join spoint10k b on spoint_dwithin(a.star, b.star, .01) + where spoint_dwithin(a.star, spoint(1,1), .05) and spoint_dwithin(b.star, spoint(1,1), .1)'); diff --git a/sql/index.sql b/sql/index.sql index fb3730a8..87131065 100644 --- a/sql/index.sql +++ b/sql/index.sql @@ -24,6 +24,7 @@ SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>'; -- create idx CREATE TABLE spheretmp1b AS TABLE spheretmp1; +ANALYZE spheretmp1; CREATE INDEX aaaidx ON spheretmp1 USING gist ( p ); @@ -69,7 +70,6 @@ EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1), EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; -SET enable_bitmapscan = ON; SET enable_indexonlyscan = OFF; EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; diff --git a/sql/points.sql b/sql/points.sql index 5e63260a..b34ae6ec 100644 --- a/sql/points.sql +++ b/sql/points.sql @@ -240,3 +240,12 @@ SELECT '( 0h 2m 30s , 90d 0m 0s)'::spoint<->'( 12h 2m 30s , 90d 0m 0s)'::spoint; SELECT '( 0h 2m 30s , -90d 0m 0s)'::spoint<->'( 12h 2m 30s , -90d 0m 0s)'::spoint; +-- spoint_dwithin function ---------- + +SELECT a, b, radius, a <-> b AS "<->", spoint_dwithin(a, b, radius) +FROM (VALUES + ('(0, 0)'::spoint, '(0, 0)'::spoint, 0), + ('(0, 0)', '(0, 1)', 1), + ('(0, 0)', '(0.1, 0.1)', 0.14), + ('(0, 0)', '(0.1, 0.1)', 0.15) + ) sub (a, b, radius); diff --git a/sql/selectivity.sql b/sql/selectivity.sql new file mode 100644 index 00000000..d0f1d6e2 --- /dev/null +++ b/sql/selectivity.sql @@ -0,0 +1,36 @@ +-- test selectivity estimator functions + +create table spoint10k (star spoint); +insert into spoint10k select spoint(i, i*i) from generate_series(1, 10000) g(i); +create index on spoint10k using gist (star); +analyze spoint10k; + +-- "explain analyze" wrapper that removes 'cost=...' since it varies across architectures +-- (we can't use "costs off" since that also removes the estimated row count) +create or replace function explain(query text, do_analyze text default 'true') returns setof text language plpgsql as $$ +declare + line text; +begin + for line in execute format('explain (analyze %s, timing off, summary off) %s', do_analyze, query) loop + return next regexp_replace(line, 'cost=\S+ ', ''); + end loop; + return; +end; +$$; + +-- <@ operator selectivity +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), 1)'); +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .1)'); +select explain('select * from spoint10k where star <@ scircle(spoint(1,1), .01)'); + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) @> star'); +select explain('select * from spoint10k where scircle(spoint(1,1), .1) @> star'); +select explain('select * from spoint10k where scircle(spoint(1,1), .01) @> star'); + +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), 1)'); +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .1)'); +select explain('select * from spoint10k where star !<@ scircle(spoint(1,1), .01)'); + +select explain('select * from spoint10k where scircle(spoint(1,1), 1) !@> star'); +select explain('select * from spoint10k where scircle(spoint(1,1), .1) !@> star'); +select explain('select * from spoint10k where scircle(spoint(1,1), .01) !@> star'); diff --git a/src/circle.c b/src/circle.c index e28fe0c5..577ac3c4 100644 --- a/src/circle.c +++ b/src/circle.c @@ -391,7 +391,7 @@ spherecircle_area(PG_FUNCTION_ARGS) { SCIRCLE *c = (SCIRCLE *) PG_GETARG_POINTER(0); - PG_RETURN_FLOAT8(PID * (1 - cos(c->radius))); + PG_RETURN_FLOAT8(spherecircle_area_float(c->radius)); } Datum diff --git a/src/circle_sel.c b/src/circle_sel.c new file mode 100644 index 00000000..d7bd843b --- /dev/null +++ b/src/circle_sel.c @@ -0,0 +1,218 @@ +#include "circle.h" +#include +#include + +/* Circle selectivity functions */ + +PG_FUNCTION_INFO_V1(spherepoint_in_circle_sel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_joinsel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_neg_sel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_neg_joinsel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_com_sel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_com_joinsel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_com_neg_sel); +PG_FUNCTION_INFO_V1(spherepoint_in_circle_com_neg_joinsel); + +/* + * Common code for spherepoint_in_circle_sel() + */ +static double +spherepoint_in_circle_sel_funcexpr(Node *other) +{ + FuncExpr *ofunc = (FuncExpr *)other; + char *func_name = get_func_name(ofunc->funcid); + Const *arg2; + double radius; + double selec; + + /* + * Safety checks: are we called on a function called scircle that takes a + * const double as 2nd argument? + */ + if (strcmp(func_name, "scircle") != 0) + { + ereport(DEBUG1, (errmsg("<@ selectivity called on function that is not scircle"))); + return DEFAULT_SCIRCLE_SEL; + } + if (list_length(ofunc->args) != 2) + { + ereport(DEBUG1, (errmsg("<@ selectivity called on function that does not have 2 arguments"))); + return DEFAULT_SCIRCLE_SEL; + } + if (!IsA(lsecond(ofunc->args), Const)) + { + ereport(DEBUG1, (errmsg("<@ selectivity called on scircle() with non-const 2nd arg"))); + return DEFAULT_SCIRCLE_SEL; + } + arg2 = (Const *) lsecond(ofunc->args); + if (arg2->consttype != FLOAT8OID) + { + ereport(DEBUG1, (errmsg("<@ selectivity called on scircle() with non-float8 2nd arg"))); + return DEFAULT_SCIRCLE_SEL; + } + + radius = DatumGetFloat8(arg2->constvalue); + selec = spherecircle_area_float(radius) / SPHERE_SURFACE; + CLAMP_PROBABILITY(selec); + + return selec; +} + +static double +spherepoint_in_circle_sel_internal(PG_FUNCTION_ARGS, bool commute, bool negate) +{ + PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0); + Oid operator = PG_GETARG_OID(1); + List *args = (List *) PG_GETARG_POINTER(2); + int varRelid = PG_GETARG_INT32(3); + //Oid collation = PG_GET_COLLATION(); + VariableStatData vardata; + Node *other; + bool varonleft; + double selec; + + /* + * When asked about <>, we do the estimation using the corresponding = + * operator, then convert to <> via "1.0 - eq_selectivity - nullfrac". + */ + if (negate) + { + operator = get_negator(operator); + if (!OidIsValid(operator)) + { + /* Use default selectivity (should we raise an error instead?) */ + return 1.0 - DEFAULT_SCIRCLE_SEL; + } + } + + /* + * If expression is not variable = something or something = variable, then + * punt and return a default estimate. + */ + if (!get_restriction_variable(root, args, varRelid, + &vardata, &other, &varonleft)) + return negate ? (1.0 - DEFAULT_SCIRCLE_SEL) : DEFAULT_SCIRCLE_SEL; + + /* + * We can do a lot better if the something is a constant. (Note: the + * Const might result from estimation rather than being a simple constant + * in the query.) + * Look only at var op circle_const, not var op point_const. + */ + if (IsA(other, Const) && varonleft != commute) + { + Const *constnode = (Const *) other; + SCIRCLE *c; + + Assert(!constnode->constisnull); /* operators are strict, shouldn't have NULLs here */ + c = (SCIRCLE *) constnode->constvalue; + selec = spherecircle_area_float(c->radius) / SPHERE_SURFACE; + CLAMP_PROBABILITY(selec); + } + /* + * Check for <@ scircle(..., radius) + */ + else if (IsA(other, FuncExpr) && varonleft != commute) + { + selec = spherepoint_in_circle_sel_funcexpr(other); + // p *((double * )&((*(Const *)((((FuncExpr*) other)->args->elements)[1].ptr_value)).constvalue)) + } + else + { + ereport(DEBUG1, (errmsg("<@ selectivity not const, other node tag %i", other->type))); + selec = DEFAULT_SCIRCLE_SEL; + } + + ReleaseVariableStats(vardata); + + return negate ? (1.0 - selec) : selec; +} + +/* + * Common code for spherepoint_in_circle_joinsel() + */ +static double +spherepoint_in_circle_joinsel_internal(PG_FUNCTION_ARGS, bool commute) +{ +#ifdef NOT_USED + PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0); + Oid operator = PG_GETARG_OID(1); + List *args = (List *) PG_GETARG_POINTER(2); + + JoinType jointype = (JoinType) PG_GETARG_INT16(3); + SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) PG_GETARG_POINTER(4); + Oid collation = PG_GET_COLLATION(); + double selec; + double selec_inner; + VariableStatData vardata1; + VariableStatData vardata2; + double nd1; + double nd2; + bool isdefault1; + bool isdefault2; + Oid opfuncoid; + AttStatsSlot sslot1; + AttStatsSlot sslot2; + bool join_is_reversed; + RelOptInfo *inner_rel; + + get_join_variables(root, args, sjinfo, + &vardata1, &vardata2, &join_is_reversed); + + ReleaseVariableStats(vardata1); + ReleaseVariableStats(vardata2); +#endif + + /* return a constant default for now; practically joins should use the + * spoint_dwithin function instead which has join support with the + * additional advantage that it's symmetric */ + return DEFAULT_SCIRCLE_SEL; +} + +Datum +spherepoint_in_circle_sel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_sel_internal(fcinfo, false, false)); +} + +Datum +spherepoint_in_circle_joinsel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_joinsel_internal(fcinfo, false)); +} + +Datum +spherepoint_in_circle_neg_sel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_sel_internal(fcinfo, false, true)); +} + +Datum +spherepoint_in_circle_neg_joinsel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL); +} + +Datum +spherepoint_in_circle_com_sel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_sel_internal(fcinfo, true, false)); +} + +Datum +spherepoint_in_circle_com_joinsel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_joinsel_internal(fcinfo, true)); +} + +Datum +spherepoint_in_circle_com_neg_sel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(spherepoint_in_circle_sel_internal(fcinfo, true, true)); +} + +Datum +spherepoint_in_circle_com_neg_joinsel(PG_FUNCTION_ARGS) +{ + PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL); +} diff --git a/src/gist_support.c b/src/gist_support.c new file mode 100644 index 00000000..95aa65cb --- /dev/null +++ b/src/gist_support.c @@ -0,0 +1,223 @@ +/********************************************************************** + * + * pgsphere gist_support.c + * based on gserialized_supportfn.c from PostGIS + * + * PostGIS - Spatial Types for PostgreSQL + * http://postgis.net + * + * PostGIS is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * PostGIS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PostGIS. If not, see . + * + **********************************************************************/ + + +/* PostgreSQL */ +#include "postgres.h" +#if PG_VERSION_NUM >= 120000 +#include "funcapi.h" +#include "access/htup_details.h" +#include "access/stratnum.h" +#include "catalog/namespace.h" +#include "catalog/pg_opfamily.h" +#include "catalog/pg_type_d.h" +#include "catalog/pg_am_d.h" +#include "nodes/supportnodes.h" +#include "nodes/nodeFuncs.h" +#include "nodes/makefuncs.h" +#include "optimizer/optimizer.h" +#include "parser/parse_func.h" +#include "parser/parse_type.h" +#include "utils/array.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/numeric.h" +#include "utils/selfuncs.h" +#include "utils/syscache.h" + +#include "point.h" +#include "circle.h" + +static Oid +scircleTypeOid(Oid callingfunc) +{ + /* type must be in same namespace as the caller */ + char *nspname = get_namespace_name(get_func_namespace(callingfunc)); + List *type_name_list = list_make2(makeString(nspname), makeString("scircle")); + TypeName *type_name = makeTypeNameFromNameList(type_name_list); + Oid type_oid = LookupTypeNameOid(NULL, type_name, true); + if (type_oid == InvalidOid) + elog(ERROR, "%s: unable to lookup type 'scircle'", __func__); + return type_oid; +} + +static Oid +scircleFunctionOid(Oid geotype, Oid callingfunc) +{ + const Oid radiustype = FLOAT8OID; /* Should always be FLOAT8OID */ + const Oid scircle_function_args[2] = {geotype, radiustype}; + const bool noError = true; + /* Expand function must be in same namespace as the caller */ + char *nspname = get_namespace_name(get_func_namespace(callingfunc)); + List *scircle_function_name = list_make2(makeString(nspname), makeString("scircle")); + Oid scircle_function_oid = LookupFuncName(scircle_function_name, 2, scircle_function_args, noError); + if (scircle_function_oid == InvalidOid) + elog(ERROR, "%s: unable to lookup 'scircle(Oid[%u], Oid[%u])'", __func__, geotype, radiustype); + return scircle_function_oid; +} + +PG_FUNCTION_INFO_V1(spherepoint_dwithin_supportfn); +Datum spherepoint_dwithin_supportfn(PG_FUNCTION_ARGS) +{ + Node *rawreq = (Node *) PG_GETARG_POINTER(0); + Node *ret = NULL; + + if (IsA(rawreq, SupportRequestSelectivity)) + { + SupportRequestSelectivity *req = (SupportRequestSelectivity *) rawreq; + Node *radiusarg = (Node *) list_nth(req->args, 2); + float8 selec; + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn sel called on %d", req->funcid))); + + /* + * If the radius is a constant, compute the circle constant. + */ + if (IsA(radiusarg, Const)) + { + Const *constarg = (Const *) radiusarg; + float8 radius = DatumGetFloat8(constarg->constvalue); + selec = spherecircle_area_float(radius) / SPHERE_SURFACE; + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn const radius %g", radius))); + } + else + { + selec = DEFAULT_SCIRCLE_SEL; + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn non-const radius"))); + } + + if (req->is_join) + { + req->selectivity = selec; + } + else + { + req->selectivity = selec; + } + CLAMP_PROBABILITY(req->selectivity); + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn selectivity %g is_join %d", req->selectivity, req->is_join))); + ret = rawreq; + } + + else if (IsA(rawreq, SupportRequestIndexCondition)) + { + SupportRequestIndexCondition *req = (SupportRequestIndexCondition *) rawreq; + + FuncExpr *clause = (FuncExpr *) req->node; + Oid funcid = clause->funcid; + Oid opfamilyoid = req->opfamily; /* OPERATOR FAMILY of the index */ + + Node *leftarg, *rightarg, *radiusarg; + Oid leftdatatype, oproid; + + Oid scircle_type_oid = scircleTypeOid(funcid); + Expr *scircle_expr; + Expr *expr; + + /* + * Extract "leftarg" as the arg matching the index and "rightarg" as + * the other, even if they were in the opposite order in the call. + */ + if (req->indexarg == 0) + { + leftarg = linitial(clause->args); + rightarg = lsecond(clause->args); + } + else if (req->indexarg == 1) + { + rightarg = linitial(clause->args); + leftarg = lsecond(clause->args); + } + else + PG_RETURN_POINTER((Node *)NULL); + + leftdatatype = exprType(leftarg); + Assert(leftdatatype == exprType(rightarg)); /* expect spoint, spoint */ + + radiusarg = (Node *) list_nth(clause->args, 2); + + /* + * Given the index operator family and the arguments and the desired + * strategy number we can now lookup the operator we want. + */ + oproid = get_opfamily_member(opfamilyoid, + leftdatatype, + scircle_type_oid, + 37); /* spoint <@ scircle */ + if (!OidIsValid(oproid)) + elog(ERROR, + "no spatial operator found for '%s': opfamily %u types %d %d strategy %d", + "scircle", + opfamilyoid, + leftdatatype, + scircle_type_oid, + 37); + + /* + * If both the right argument and the radius are a constant, compute + * the circle constant. (makeFuncExpr won't constify by itself + * unfortunately.) + */ + if (IsA(rightarg, Const) && IsA(radiusarg, Const)) + { + Datum center = ((Const *) rightarg)->constvalue; + Datum radius = ((Const *) radiusarg)->constvalue; + Datum circle = DirectFunctionCall2(spherecircle_by_center, center, radius); + scircle_expr = (Expr *) makeConst(scircle_type_oid, -1, InvalidOid, + sizeof(SCIRCLE), circle, false, false); + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn index condition const"))); + } + else + { + Oid scircle_function_oid = scircleFunctionOid(leftdatatype, clause->funcid); + scircle_expr = (Expr *) makeFuncExpr(scircle_function_oid, leftdatatype, + list_make2(rightarg, radiusarg), + InvalidOid, InvalidOid, COERCE_EXPLICIT_CALL); + ereport(DEBUG1, (errmsg("spherepoint_dwithin_supportfn index condition function"))); + } + + /* + * The comparison expression has to be a pseudo constant, + * (not volatile or dependent on the target index table) + */ +#if PG_VERSION_NUM >= 140000 + if (!is_pseudo_constant_for_index(req->root, (Node*)scircle_expr, req->index)) +#else + if (!is_pseudo_constant_for_index((Node*)scircle_expr, req->index)) +#endif + PG_RETURN_POINTER((Node*)NULL); + + /* OK, we can make an index expression */ + expr = make_opclause(oproid, BOOLOID, false, + (Expr *) leftarg, scircle_expr, + InvalidOid, InvalidOid); + + ret = (Node *)(list_make1(expr)); + + /* This is an exact index lookup */ + req->lossy = false; + } + + PG_RETURN_POINTER(ret); +} + +#endif /* PG_VERSION_NUM */ diff --git a/src/pgs_util.h b/src/pgs_util.h index b79170ba..1b3ad76f 100644 --- a/src/pgs_util.h +++ b/src/pgs_util.h @@ -14,6 +14,10 @@ #endif #define EPSILON 1.0E-09 /* precision of floating point values */ +/* spherical circle constants */ +#define SPHERE_SURFACE (4 * PI) +#define DEFAULT_SCIRCLE_SEL 1e-7 + /* convert pg_sphere theta [pi/2 .. -pi/2] to healpix theta [0 .. pi] ([north .. south pole]) */ static inline double conv_theta(double x) @@ -31,4 +35,13 @@ static inline double deg_to_rad(double in) return in * PI / 180; } +/* + * Area of circle on sphere + */ +static inline double +spherecircle_area_float(double radius) +{ + return PID * (1 - cos(radius)); +} + #endif diff --git a/src/point.c b/src/point.c index 0cbfa009..498ee5e2 100644 --- a/src/point.c +++ b/src/point.c @@ -8,6 +8,7 @@ PG_FUNCTION_INFO_V1(spherepoint_in); PG_FUNCTION_INFO_V1(spherepoint_from_long_lat); PG_FUNCTION_INFO_V1(spherepoint_from_long_lat_deg); PG_FUNCTION_INFO_V1(spherepoint_distance); +PG_FUNCTION_INFO_V1(spherepoint_dwithin); PG_FUNCTION_INFO_V1(spherepoint_long); PG_FUNCTION_INFO_V1(spherepoint_lat); PG_FUNCTION_INFO_V1(spherepoint_x); @@ -223,6 +224,17 @@ spherepoint_distance(PG_FUNCTION_ARGS) } +Datum +spherepoint_dwithin(PG_FUNCTION_ARGS) +{ + SPoint *p1 = (SPoint *) PG_GETARG_POINTER(0); + SPoint *p2 = (SPoint *) PG_GETARG_POINTER(1); + float8 within = PG_GETARG_FLOAT8(2); + float8 dist = spoint_dist(p1, p2); + + PG_RETURN_BOOL(FPle(dist, within)); +} + Datum spherepoint_long(PG_FUNCTION_ARGS) { From 24daa229ab48f8cd4fa4099c72c5bede6ee01bb7 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 23 Oct 2023 12:23:03 +0200 Subject: [PATCH 25/40] Maintain only one list of tests Make evaluates "=" variables lazily, so we can add items to TESTS later in the file and still have them show up in REGRESS. --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1e9805f4..6c648d94 100644 --- a/Makefile +++ b/Makefile @@ -33,13 +33,10 @@ DATA_built = $(RELEASE_SQL) \ pg_sphere--1.3.1--1.3.2.sql DOCS = README.pg_sphere COPYRIGHT.pg_sphere -REGRESS = init tables points euler circle line ellipse poly path box index \ - contains_ops contains_ops_compat bounding_box_gist gnomo epochprop \ - contains overlaps spoint_brin sbox_brin selectivity - -TESTS = init_test tables points euler circle line ellipse poly path box \ +TESTS = tables points euler circle line ellipse poly path box \ index contains_ops contains_ops_compat bounding_box_gist gnomo \ epochprop contains overlaps spoint_brin sbox_brin selectivity +REGRESS = init $(TESTS) PG_CFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) PG_CPPFLAGS += -DPGSPHERE_VERSION=$(PGSPHERE_VERSION) @@ -61,7 +58,6 @@ PGS_SQL = pgs_types.sql pgs_point.sql pgs_euler.sql pgs_circle.sql \ pgs_gist.sql gnomo.sql pgs_brin.sql pgs_circle_sel.sql ifneq ($(USE_HEALPIX),0) -REGRESS += healpix moc moc1 moc100 mocautocast TESTS += healpix moc moc1 moc100 mocautocast PGS_SQL += healpix.sql endif @@ -104,17 +100,17 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c pg_version := $(word 2,$(shell $(PG_CONFIG) --version)) has_support_functions = $(if $(filter-out 9.% 10.% 11.%,$(pg_version)),y,n) -crushtest: REGRESS += $(CRUSH_TESTS) +crushtest: TESTS += $(CRUSH_TESTS) crushtest: installcheck ifeq ($(has_support_functions),y) PGS_SQL += pgs_gist_support.sql -REGRESS += gist_support TESTS += gist_support endif +# "make test" uses a special initialization file that doesn't rely on "create extension" test: pg_sphere.test.sql - $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) $(TESTS) + $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) init_test $(TESTS) pg_sphere.test.sql: $(RELEASE_SQL) $(shlib) tail -n+3 $< | sed 's,MODULE_PATHNAME,$(realpath $(shlib)),g' >$@ From 9d0c414bda38a510c21bcdbeace97d4c48815665 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Tue, 24 Oct 2023 12:02:20 +0200 Subject: [PATCH 26/40] Import .editorconfig from PostgreSQL This is the very same .editorconfig file that PostgreSQL is using. https://github.com/postgres/postgres/commit/ecb09cd5de5279ab9cfa20a58fd3da44f7df5779 --- .editorconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..d69a3d1d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*.{c,h,l,y,pl,pm}] +indent_style = tab +indent_size = tab +tab_width = 4 + +[*.{sgml,xml}] +indent_style = space +indent_size = 1 + +[*.xsl] +indent_style = space +indent_size = 2 From 686987793dda0aaf0ff71f408c01a4018a8f29c2 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Tue, 24 Oct 2023 16:10:01 +0200 Subject: [PATCH 27/40] .gitignore: Ignore doc and "make test" artifacts --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index ff5e881e..f7267631 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,17 @@ *.so /*.sql /doc/html/ +/doc/pg_sphere*.fo +/doc/pg_sphere-*.html +/doc/pg_sphere-*.pdf +/doc/pg_sphere-full.xml /doc/pg_sphere.dsl +/doc/version.xml +/log /results/ regression.out regression.diffs tags +/tmp_check buildpod .deps From b96b067c8f3fb062195d1f0fcabff745ed8deeab Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Tue, 24 Oct 2023 22:35:21 +0200 Subject: [PATCH 28/40] Configurable smoc_gin_ops index resolution Back when smoc GIN indexes were implemented, indexes did not support opclass options yet; that was added only later in PG 13. Add an "order" parameter on the smoc_gin_ops opclass to allow picking the smoc index granularity between level 0 and 12. (Larger levels do not fit into the internal int32 datatype anymore.) Example: `create index on sky using gin (coverage smoc_gin_ops (order = 8))` --- Makefile | 13 +++++++++++++ doc/indices.sgm | 21 +++++++++++++++------ expected/moc_options.out | 40 ++++++++++++++++++++++++++++++++++++++++ pgs_moc_ops.sql.in | 1 + pgs_moc_options.sql.in | 12 ++++++++++++ sql/moc_options.sql | 14 ++++++++++++++ src/moc.c | 29 +++++++++++++++++++++++++---- src/pgs_moc.h | 19 ++++++++++++++++++- 8 files changed, 138 insertions(+), 11 deletions(-) create mode 100644 expected/moc_options.out create mode 100644 pgs_moc_options.sql.in create mode 100644 sql/moc_options.sql diff --git a/Makefile b/Makefile index 6c648d94..5782814e 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c pg_version := $(word 2,$(shell $(PG_CONFIG) --version)) has_support_functions = $(if $(filter-out 9.% 10.% 11.%,$(pg_version)),y,n) +has_index_options = $(if $(filter-out 9.% 10.% 11.% 12.%,$(pg_version)),y,n) crushtest: TESTS += $(CRUSH_TESTS) crushtest: installcheck @@ -108,6 +109,13 @@ PGS_SQL += pgs_gist_support.sql TESTS += gist_support endif +ifneq ($(USE_HEALPIX),0) +ifeq ($(has_index_options),y) +PGS_SQL += pgs_moc_options.sql +TESTS += moc_options +endif +endif + # "make test" uses a special initialization file that doesn't rely on "create extension" test: pg_sphere.test.sql $(pg_regress_installcheck) --temp-instance=tmp_check $(REGRESS_OPTS) init_test $(TESTS) @@ -186,6 +194,11 @@ pg_sphere--1.3.0--1.3.1.sql: ifeq ($(has_support_functions),y) pg_sphere--1.3.1--1.3.2.sql: pgs_gist_support.sql.in endif +ifneq ($(USE_HEALPIX),0) +ifeq ($(has_index_options),y) +pg_sphere--1.3.1--1.3.2.sql: pgs_moc_options.sql.in +endif +endif pg_sphere--1.3.1--1.3.2.sql: pgs_circle_sel.sql.in cat upgrade_scripts/$@.in $^ > $@ diff --git a/doc/indices.sgm b/doc/indices.sgm index 0ef179f6..b3a9c698 100644 --- a/doc/indices.sgm +++ b/doc/indices.sgm @@ -121,14 +121,20 @@ The index works by casting all contained smocs to a fixed level, and for each pixel at that level, storing which smocs overlap with that pixel. This is especially beneficial for "overlaps" queries using - the && operator. Two levels of granularity - are provided: the default opclass smoc_gin_ops - works on level 5 with a resolution of 12288 pixels, while the - opclass smoc_gin_ops_fine works on level 8 with - 786432 pixels. The downside of that approach is that storing large + the && operator. + The downside of that approach is that storing large smocs like "all sky" (0/0-11) produces a large number of index entries. + + The default opclass smoc_gin_ops defaults to + working on level 5 with a resolution of 12288 pixels (12 * 4^5). + An alternative granularity can be selected by setting the + order parameter on the opclass (integer value + between 0 and 12; option only available on PG 13 and later). + The alternative smoc_gin_ops_fine opclass works + on level 8 with 786432 pixels. + Codestin Search App @@ -136,8 +142,11 @@ + - + + + diff --git a/expected/moc_options.out b/expected/moc_options.out new file mode 100644 index 00000000..2342b79a --- /dev/null +++ b/expected/moc_options.out @@ -0,0 +1,40 @@ +create table moc_opt (m smoc); +insert into moc_opt select format('9/%s', i)::smoc from generate_series(1, 1000) g(i); +analyze moc_opt; +create index moc_opt5 on moc_opt using gin (m); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; + QUERY PLAN +--------------------------------------------------------------- + Bitmap Heap Scan on moc_opt (actual rows=1 loops=1) + Recheck Cond: (m && '9/1'::smoc) + Rows Removed by Index Recheck: 254 + Heap Blocks: exact=4 + -> Bitmap Index Scan on moc_opt5 (actual rows=255 loops=1) + Index Cond: (m && '9/1'::smoc) +(6 rows) + +drop index moc_opt5; +create index moc_opt8 on moc_opt using gin (m smoc_gin_ops_fine); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; + QUERY PLAN +------------------------------------------------------------- + Bitmap Heap Scan on moc_opt (actual rows=1 loops=1) + Recheck Cond: (m && '9/1'::smoc) + Rows Removed by Index Recheck: 2 + Heap Blocks: exact=1 + -> Bitmap Index Scan on moc_opt8 (actual rows=3 loops=1) + Index Cond: (m && '9/1'::smoc) +(6 rows) + +drop index moc_opt8; +create index moc_opt9 on moc_opt using gin (m smoc_gin_ops (order = 9)); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; + QUERY PLAN +------------------------------------------------------------- + Bitmap Heap Scan on moc_opt (actual rows=1 loops=1) + Recheck Cond: (m && '9/1'::smoc) + Heap Blocks: exact=1 + -> Bitmap Index Scan on moc_opt9 (actual rows=1 loops=1) + Index Cond: (m && '9/1'::smoc) +(5 rows) + diff --git a/pgs_moc_ops.sql.in b/pgs_moc_ops.sql.in index 1319f5b0..4e71af36 100644 --- a/pgs_moc_ops.sql.in +++ b/pgs_moc_ops.sql.in @@ -354,6 +354,7 @@ CREATE OPERATOR CLASS smoc_gin_ops FUNCTION 4 smoc_gin_consistent (internal, int2, smoc, int4, internal, internal, internal, internal), --FUNCTION 5 smoc_gin_compare_partial (), --FUNCTION 6 smoc_gin_tri_consistent (), + --FUNCTION 7 (smoc) smoc_gin_options (internal), -- needs PG13 STORAGE int4; CREATE OPERATOR CLASS smoc_gin_ops_fine diff --git a/pgs_moc_options.sql.in b/pgs_moc_options.sql.in new file mode 100644 index 00000000..e2b8e846 --- /dev/null +++ b/pgs_moc_options.sql.in @@ -0,0 +1,12 @@ +-- GIN opclass options + +CREATE FUNCTION smoc_gin_options (internal) + RETURNS void + AS 'MODULE_PATHNAME' + LANGUAGE C + PARALLEL SAFE + IMMUTABLE + STRICT; + +ALTER OPERATOR FAMILY smoc_gin_ops USING gin + ADD FUNCTION 7 (smoc) smoc_gin_options (internal); diff --git a/sql/moc_options.sql b/sql/moc_options.sql new file mode 100644 index 00000000..5041f658 --- /dev/null +++ b/sql/moc_options.sql @@ -0,0 +1,14 @@ +create table moc_opt (m smoc); +insert into moc_opt select format('9/%s', i)::smoc from generate_series(1, 1000) g(i); +analyze moc_opt; + +create index moc_opt5 on moc_opt using gin (m); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; +drop index moc_opt5; + +create index moc_opt8 on moc_opt using gin (m smoc_gin_ops_fine); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; +drop index moc_opt8; + +create index moc_opt9 on moc_opt using gin (m smoc_gin_ops (order = 9)); +explain (analyze, costs off, timing off, summary off) select * from moc_opt where m && '9/1'; diff --git a/src/moc.c b/src/moc.c index 6f1cbaf0..4457aa65 100644 --- a/src/moc.c +++ b/src/moc.c @@ -3,7 +3,8 @@ #include #include -#include +#include "access/gin.h" +#include "access/reloptions.h" #include "circle.h" #include "polygon.h" @@ -45,6 +46,7 @@ PG_FUNCTION_INFO_V1(smoc_gin_extract_value_fine); PG_FUNCTION_INFO_V1(smoc_gin_extract_query); PG_FUNCTION_INFO_V1(smoc_gin_extract_query_fine); PG_FUNCTION_INFO_V1(smoc_gin_consistent); +PG_FUNCTION_INFO_V1(smoc_gin_options); int32 smoc_output_type = 0; @@ -1079,7 +1081,6 @@ smoc_gin_extract_internal(Smoc *moc_a, int32 *nkeys, int gin_order) if (*nkeys >= nalloc) { nalloc *= 2; - Assert(nalloc < 2000000); keys = repalloc(keys, nalloc * sizeof(Datum)); } keys[(*nkeys)++] = Int32GetDatum(p); @@ -1094,8 +1095,9 @@ smoc_gin_extract_value(PG_FUNCTION_ARGS) { Smoc* moc_a = (Smoc *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); int32* nkeys = (int32 *) PG_GETARG_POINTER(1); + int order = SMOC_GIN_GET_ORDER(); - PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a, nkeys, MOC_GIN_ORDER)); + PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a, nkeys, order)); } Datum @@ -1114,13 +1116,14 @@ smoc_gin_extract_query(PG_FUNCTION_ARGS) int32* nkeys = (int32 *) PG_GETARG_POINTER(1); StrategyNumber st = PG_GETARG_UINT16(2); int32* searchmode = (int32 *) PG_GETARG_POINTER(6); + int order = SMOC_GIN_GET_ORDER(); if (st == MOC_GIN_STRATEGY_SUBSET || (st == MOC_GIN_STRATEGY_EQUAL && moc_a->area == 0)) *searchmode = GIN_SEARCH_MODE_INCLUDE_EMPTY; else if (st == MOC_GIN_STRATEGY_UNEQUAL) *searchmode = GIN_SEARCH_MODE_ALL; - PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a, nkeys, MOC_GIN_ORDER)); + PG_RETURN_DATUM(smoc_gin_extract_internal(moc_a, nkeys, order)); } Datum @@ -1202,3 +1205,21 @@ smoc_gin_consistent(PG_FUNCTION_ARGS) /* not reached */ PG_RETURN_NULL(); } + +#if PG_VERSION_NUM >= 130000 +Datum +smoc_gin_options(PG_FUNCTION_ARGS) +{ + local_relopts *relopts = (local_relopts *) PG_GETARG_POINTER(0); + + init_local_reloptions(relopts, sizeof(SMocGinOptions)); + add_local_int_reloption(relopts, "order", + "smoc order to store in index", + MOC_GIN_ORDER_DEFAULT, + 0, + 12, /* maximum order fitting into 32bit */ + offsetof(SMocGinOptions, order)); + + PG_RETURN_VOID(); +} +#endif diff --git a/src/pgs_moc.h b/src/pgs_moc.h index 6bad1ae7..68116d09 100644 --- a/src/pgs_moc.h +++ b/src/pgs_moc.h @@ -122,7 +122,7 @@ next_interval(int32 a) #define MOC_AREA_ALL_SKY 3458764513820540928 -#define MOC_GIN_ORDER 5 /* order 5 has 12 * 4^5 = 12288 pixels */ +#define MOC_GIN_ORDER_DEFAULT 5 /* order 5 has 12 * 4^5 = 12288 pixels */ #define MOC_GIN_ORDER_FINE 8 /* order 8 has 12 * 4^8 = 786432 pixels */ #define MOC_GIN_STRATEGY_INTERSECTS 1 #define MOC_GIN_STRATEGY_SUBSET 2 @@ -130,4 +130,21 @@ next_interval(int32 a) #define MOC_GIN_STRATEGY_EQUAL 4 #define MOC_GIN_STRATEGY_UNEQUAL 5 +/* smoc_gin_ops opclass options */ +#if PG_VERSION_NUM >= 130000 +Datum smoc_gin_options(PG_FUNCTION_ARGS); + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int order; /* smoc order to store in index (default 5) */ +} SMocGinOptions; + +#define SMOC_GIN_GET_ORDER() (PG_HAS_OPCLASS_OPTIONS() ? \ + ((SMocGinOptions *) PG_GET_OPCLASS_OPTIONS())->order : \ + MOC_GIN_ORDER_DEFAULT) +#else +#define SMOC_GIN_GET_ORDER() MOC_GIN_ORDER_DEFAULT +#endif + #endif From 1dc181ae0ac97c9a557ca5b6029683ace392e90a Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 23 Oct 2023 16:56:57 +0200 Subject: [PATCH 29/40] Use explain() function in moc100 test The interesting part of the moc100 test are the row counts and "Rows Removed by Filter". Remove all other noise. This also lets us get rid of the moc100_N alternative output files. --- expected/moc100.out | 251 ++++++++++++++-------------------- expected/moc100_1.out | 263 ----------------------------------- expected/moc100_2.out | 297 ---------------------------------------- expected/moc100_3.out | 297 ---------------------------------------- expected/moc100_4.out | 309 ------------------------------------------ expected/moc100_5.out | 309 ------------------------------------------ sql/moc100.sql | 88 ++++-------- 7 files changed, 132 insertions(+), 1682 deletions(-) delete mode 100644 expected/moc100_1.out delete mode 100644 expected/moc100_2.out delete mode 100644 expected/moc100_3.out delete mode 100644 expected/moc100_4.out delete mode 100644 expected/moc100_5.out diff --git a/expected/moc100.out b/expected/moc100.out index 51d668b9..c74fb6ed 100644 --- a/expected/moc100.out +++ b/expected/moc100.out @@ -1,20 +1,10 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 10, 11, 12 -(1 row) - - outputfile_for_arch_bits --------------------------- - 64-bit -(1 row) - CREATE TABLE moc100 ( ivoid text, coverage smoc, ref_system_name text ); COPY moc100 FROM STDIN; +ANALYZE moc100; CREATE INDEX ON moc100 USING GIN (coverage); SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; ivoid @@ -56,208 +46,175 @@ SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; ivo://vopdc.obspm/luth/hess (35 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) +-- PG 10 does not have JIT, ignore errors on SET +DO $$ + begin + set jit = off; + exception + when undefined_object then null; + when others then raise; + end; +$$; +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '0/'$$); + explain +------------------------------------------------------------------------------------------ + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=0 loops=1) Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=0 loops=1) Index Cond: (coverage && '0/'::smoc) (4 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=35 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '4/0'$$); + explain +----------------------------------------------------------------- + Seq Scan on moc100 (rows=1 width=341) (actual rows=35 loops=1) Filter: (coverage && '4/0'::smoc) Rows Removed by Filter: 66 - Buffers: shared hit=114 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=23 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/0-11'$$); + explain +----------------------------------------------------------------- + Seq Scan on moc100 (rows=1 width=341) (actual rows=23 loops=1) Filter: (coverage = '0/0-11'::smoc) Rows Removed by Filter: 78 - Buffers: shared hit=59 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '6/43225,43227'$$); + explain +---------------------------------------------------------------- + Seq Scan on moc100 (rows=1 width=341) (actual rows=1 loops=1) Filter: (coverage = '6/43225 43227'::smoc) Rows Removed by Filter: 100 - Buffers: shared hit=59 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/'$$); + explain +---------------------------------------------------------------- + Seq Scan on moc100 (rows=1 width=341) (actual rows=1 loops=1) Filter: (coverage = '0/'::smoc) Rows Removed by Filter: 100 - Buffers: shared hit=59 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=78 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/0-11'$$); + explain +------------------------------------------------------------------- + Seq Scan on moc100 (rows=100 width=341) (actual rows=78 loops=1) Filter: (coverage <> '0/0-11'::smoc) Rows Removed by Filter: 23 - Buffers: shared hit=59 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'$$); + explain +-------------------------------------------------------------------- + Seq Scan on moc100 (rows=100 width=341) (actual rows=100 loops=1) Filter: (coverage <> '6/43225 43227'::smoc) Rows Removed by Filter: 1 - Buffers: shared hit=59 -(4 rows) +(3 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/'$$); + explain +-------------------------------------------------------------------- + Seq Scan on moc100 (rows=100 width=341) (actual rows=100 loops=1) Filter: (coverage <> '0/'::smoc) Rows Removed by Filter: 1 - Buffers: shared hit=59 -(4 rows) +(3 rows) SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=35 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '4/0'$$); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=35 loops=1) Recheck Cond: (coverage && '4/0'::smoc) Heap Blocks: exact=5 - Buffers: shared hit=85 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=35 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=35 loops=1) Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 -(7 rows) +(5 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=44.00..48.01 rows=1 width=96) (actual rows=1 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <@ '4/0'$$); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=1 loops=1) Recheck Cond: (coverage <@ '4/0'::smoc) Rows Removed by Index Recheck: 35 Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..44.00 rows=1 width=0) (actual rows=36 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=36 loops=1) Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=28 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage @> '4/0'$$); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=28 loops=1) Recheck Cond: (coverage @> '4/0'::smoc) Rows Removed by Index Recheck: 1 Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=29 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=29 loops=1) Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98308.01..98312.02 rows=1 width=96) (actual rows=23 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/0-11'$$); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=23 loops=1) Recheck Cond: (coverage = '0/0-11'::smoc) Rows Removed by Index Recheck: 1 Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98308.01 rows=1 width=0) (actual rows=24 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=24 loops=1) Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '6/43225,43227'$$); + explain +------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=1 loops=1) Recheck Cond: (coverage = '6/43225 43227'::smoc) Rows Removed by Index Recheck: 28 Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=29 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=29 loops=1) Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/'$$); + explain +------------------------------------------------------------------------------------------ + Bitmap Heap Scan on moc100 (rows=1 width=341) (actual rows=1 loops=1) Recheck Cond: (coverage = '0/'::smoc) Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=1 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=1 width=0) (actual rows=1 loops=1) Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 -(7 rows) +(5 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=78 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/0-11'$$); + explain +---------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=100 width=341) (actual rows=78 loops=1) Recheck Cond: (coverage <> '0/0-11'::smoc) Rows Removed by Index Recheck: 23 Heap Blocks: exact=5 - Buffers: shared hit=24821 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=100 width=0) (actual rows=101 loops=1) Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24762 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'$$); + explain +---------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=100 width=341) (actual rows=100 loops=1) Recheck Cond: (coverage <> '6/43225 43227'::smoc) Rows Removed by Index Recheck: 1 Heap Blocks: exact=5 - Buffers: shared hit=247 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=100 width=0) (actual rows=101 loops=1) Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=188 -(8 rows) +(6 rows) -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/'$$); + explain +---------------------------------------------------------------------------------------------- + Bitmap Heap Scan on moc100 (rows=100 width=341) (actual rows=100 loops=1) Recheck Cond: (coverage <> '0/'::smoc) Rows Removed by Index Recheck: 1 Heap Blocks: exact=5 - Buffers: shared hit=245 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) + -> Bitmap Index Scan on moc100_coverage_idx (rows=100 width=0) (actual rows=101 loops=1) Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=186 -(8 rows) +(6 rows) diff --git a/expected/moc100_1.out b/expected/moc100_1.out deleted file mode 100644 index c7d62557..00000000 --- a/expected/moc100_1.out +++ /dev/null @@ -1,263 +0,0 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 10, 11, 12 -(1 row) - - outputfile_for_arch_bits --------------------------- - 32-bit -(1 row) - -CREATE TABLE moc100 ( - ivoid text, - coverage smoc, - ref_system_name text -); -COPY moc100 FROM STDIN; -CREATE INDEX ON moc100 USING GIN (coverage); -SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; - ivoid ------------------------------------------- - ivo://byu.arvo/dfbsspec/q/getssa - ivo://cadc.nrc.ca/archive/cfht - ivo://cadc.nrc.ca/archive/hst - ivo://cds.vizier/b/assocdata - ivo://cds.vizier/b/swift - ivo://cds.vizier/i/241 - ivo://cds.vizier/iv/12 - ivo://cds.vizier/ix/13 - ivo://cds.vizier/j/a+a/316/147 - ivo://cds.vizier/j/a+as/105/311 - ivo://cds.vizier/j/a+as/122/235 - ivo://chivo/gaia/q/dr1 - ivo://chivo/openngc/q/data - ivo://cxc.harvard.edu/csc - ivo://irsa.ipac/2mass/catalog/psc - ivo://irsa.ipac/2mass/catalog/xsc - ivo://irsa.ipac/2mass/images/asky-ql - ivo://irsa.ipac/cosmos/images - ivo://irsa.ipac/iras/images/issa - ivo://irsa.ipac/mast/scrapbook - ivo://irsa.ipac/spitzer/images/swire - ivo://mssl.ucl.ac.uk/xmmsuss_dsa/xmmsuss - ivo://ned.ipac/sia - ivo://ned.ipac/tap - ivo://svo.cab/cat/gbs - ivo://svo.cab/cat/uves - ivo://svo.cab/cat/xshooter - ivo://vopdc.iap/fss - ivo://vopdc.obspm/imcce/m4ast - ivo://vopdc.obspm/imcce/miriade - ivo://vopdc.obspm/imcce/skybot - ivo://vopdc.obspm/lesia/bestars/besc - ivo://vopdc.obspm/lesia/bestars/bess - ivo://vopdc.obspm/luth/exoplanet - ivo://vopdc.obspm/luth/hess -(35 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) - Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) - Index Cond: (coverage && '0/'::smoc) -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=35 loops=1) - Filter: (coverage && '4/0'::smoc) - Rows Removed by Filter: 66 - Buffers: shared hit=115 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=23 loops=1) - Filter: (coverage = '0/0-11'::smoc) - Rows Removed by Filter: 78 - Buffers: shared hit=59 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '6/43225 43227'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '0/'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=78 loops=1) - Filter: (coverage <> '0/0-11'::smoc) - Rows Removed by Filter: 23 - Buffers: shared hit=59 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 -(4 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '0/'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 -(4 rows) - -SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=35 loops=1) - Recheck Cond: (coverage && '4/0'::smoc) - Heap Blocks: exact=5 - Buffers: shared hit=86 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=35 loops=1) - Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 -(7 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=44.00..48.01 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage <@ '4/0'::smoc) - Rows Removed by Index Recheck: 35 - Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..44.00 rows=1 width=0) (actual rows=36 loops=1) - Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=28 loops=1) - Recheck Cond: (coverage @> '4/0'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98308.01..98312.02 rows=1 width=96) (actual rows=23 loops=1) - Recheck Cond: (coverage = '0/0-11'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98308.01 rows=1 width=0) (actual rows=24 loops=1) - Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 28 - Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '0/'::smoc) - Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=1 loops=1) - Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 -(7 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=78 loops=1) - Recheck Cond: (coverage <> '0/0-11'::smoc) - Rows Removed by Index Recheck: 23 - Heap Blocks: exact=5 - Buffers: shared hit=24804 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24745 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=230 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=171 -(8 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '0/'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=228 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=169 -(8 rows) - diff --git a/expected/moc100_2.out b/expected/moc100_2.out deleted file mode 100644 index 0f511a85..00000000 --- a/expected/moc100_2.out +++ /dev/null @@ -1,297 +0,0 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 13, 14, 15 -(1 row) - - outputfile_for_arch_bits --------------------------- - 64-bit -(1 row) - -CREATE TABLE moc100 ( - ivoid text, - coverage smoc, - ref_system_name text -); -COPY moc100 FROM STDIN; -CREATE INDEX ON moc100 USING GIN (coverage); -SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; - ivoid ------------------------------------------- - ivo://byu.arvo/dfbsspec/q/getssa - ivo://cadc.nrc.ca/archive/cfht - ivo://cadc.nrc.ca/archive/hst - ivo://cds.vizier/b/assocdata - ivo://cds.vizier/b/swift - ivo://cds.vizier/i/241 - ivo://cds.vizier/iv/12 - ivo://cds.vizier/ix/13 - ivo://cds.vizier/j/a+a/316/147 - ivo://cds.vizier/j/a+as/105/311 - ivo://cds.vizier/j/a+as/122/235 - ivo://chivo/gaia/q/dr1 - ivo://chivo/openngc/q/data - ivo://cxc.harvard.edu/csc - ivo://irsa.ipac/2mass/catalog/psc - ivo://irsa.ipac/2mass/catalog/xsc - ivo://irsa.ipac/2mass/images/asky-ql - ivo://irsa.ipac/cosmos/images - ivo://irsa.ipac/iras/images/issa - ivo://irsa.ipac/mast/scrapbook - ivo://irsa.ipac/spitzer/images/swire - ivo://mssl.ucl.ac.uk/xmmsuss_dsa/xmmsuss - ivo://ned.ipac/sia - ivo://ned.ipac/tap - ivo://svo.cab/cat/gbs - ivo://svo.cab/cat/uves - ivo://svo.cab/cat/xshooter - ivo://vopdc.iap/fss - ivo://vopdc.obspm/imcce/m4ast - ivo://vopdc.obspm/imcce/miriade - ivo://vopdc.obspm/imcce/skybot - ivo://vopdc.obspm/lesia/bestars/besc - ivo://vopdc.obspm/lesia/bestars/bess - ivo://vopdc.obspm/luth/exoplanet - ivo://vopdc.obspm/luth/hess -(35 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) - Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) - Index Cond: (coverage && '0/'::smoc) - Planning: - Buffers: shared hit=5 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=35 loops=1) - Filter: (coverage && '4/0'::smoc) - Rows Removed by Filter: 66 - Buffers: shared hit=114 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=23 loops=1) - Filter: (coverage = '0/0-11'::smoc) - Rows Removed by Filter: 78 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '6/43225 43227'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '0/'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=78 loops=1) - Filter: (coverage <> '0/0-11'::smoc) - Rows Removed by Filter: 23 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '0/'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=35 loops=1) - Recheck Cond: (coverage && '4/0'::smoc) - Heap Blocks: exact=5 - Buffers: shared hit=85 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=35 loops=1) - Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=44.00..48.01 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage <@ '4/0'::smoc) - Rows Removed by Index Recheck: 35 - Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..44.00 rows=1 width=0) (actual rows=36 loops=1) - Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=28 loops=1) - Recheck Cond: (coverage @> '4/0'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98308.01..98312.02 rows=1 width=96) (actual rows=23 loops=1) - Recheck Cond: (coverage = '0/0-11'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98308.01 rows=1 width=0) (actual rows=24 loops=1) - Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 28 - Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '0/'::smoc) - Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=1 loops=1) - Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=78 loops=1) - Recheck Cond: (coverage <> '0/0-11'::smoc) - Rows Removed by Index Recheck: 23 - Heap Blocks: exact=5 - Buffers: shared hit=24821 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24762 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=247 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=188 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '0/'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=245 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=186 - Planning: - Buffers: shared hit=1 -(10 rows) - diff --git a/expected/moc100_3.out b/expected/moc100_3.out deleted file mode 100644 index c650501b..00000000 --- a/expected/moc100_3.out +++ /dev/null @@ -1,297 +0,0 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 13, 14, 15 -(1 row) - - outputfile_for_arch_bits --------------------------- - 32-bit -(1 row) - -CREATE TABLE moc100 ( - ivoid text, - coverage smoc, - ref_system_name text -); -COPY moc100 FROM STDIN; -CREATE INDEX ON moc100 USING GIN (coverage); -SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; - ivoid ------------------------------------------- - ivo://byu.arvo/dfbsspec/q/getssa - ivo://cadc.nrc.ca/archive/cfht - ivo://cadc.nrc.ca/archive/hst - ivo://cds.vizier/b/assocdata - ivo://cds.vizier/b/swift - ivo://cds.vizier/i/241 - ivo://cds.vizier/iv/12 - ivo://cds.vizier/ix/13 - ivo://cds.vizier/j/a+a/316/147 - ivo://cds.vizier/j/a+as/105/311 - ivo://cds.vizier/j/a+as/122/235 - ivo://chivo/gaia/q/dr1 - ivo://chivo/openngc/q/data - ivo://cxc.harvard.edu/csc - ivo://irsa.ipac/2mass/catalog/psc - ivo://irsa.ipac/2mass/catalog/xsc - ivo://irsa.ipac/2mass/images/asky-ql - ivo://irsa.ipac/cosmos/images - ivo://irsa.ipac/iras/images/issa - ivo://irsa.ipac/mast/scrapbook - ivo://irsa.ipac/spitzer/images/swire - ivo://mssl.ucl.ac.uk/xmmsuss_dsa/xmmsuss - ivo://ned.ipac/sia - ivo://ned.ipac/tap - ivo://svo.cab/cat/gbs - ivo://svo.cab/cat/uves - ivo://svo.cab/cat/xshooter - ivo://vopdc.iap/fss - ivo://vopdc.obspm/imcce/m4ast - ivo://vopdc.obspm/imcce/miriade - ivo://vopdc.obspm/imcce/skybot - ivo://vopdc.obspm/lesia/bestars/besc - ivo://vopdc.obspm/lesia/bestars/bess - ivo://vopdc.obspm/luth/exoplanet - ivo://vopdc.obspm/luth/hess -(35 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) - Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) - Index Cond: (coverage && '0/'::smoc) - Planning: - Buffers: shared hit=5 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=35 loops=1) - Filter: (coverage && '4/0'::smoc) - Rows Removed by Filter: 66 - Buffers: shared hit=115 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=23 loops=1) - Filter: (coverage = '0/0-11'::smoc) - Rows Removed by Filter: 78 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '6/43225 43227'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '0/'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=78 loops=1) - Filter: (coverage <> '0/0-11'::smoc) - Rows Removed by Filter: 23 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '0/'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=35 loops=1) - Recheck Cond: (coverage && '4/0'::smoc) - Heap Blocks: exact=5 - Buffers: shared hit=86 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=35 loops=1) - Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=44.00..48.01 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage <@ '4/0'::smoc) - Rows Removed by Index Recheck: 35 - Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..44.00 rows=1 width=0) (actual rows=36 loops=1) - Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=36.00..40.01 rows=1 width=96) (actual rows=28 loops=1) - Recheck Cond: (coverage @> '4/0'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..36.00 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98308.01..98312.02 rows=1 width=96) (actual rows=23 loops=1) - Recheck Cond: (coverage = '0/0-11'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98308.01 rows=1 width=0) (actual rows=24 loops=1) - Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 28 - Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.01..16.02 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '0/'::smoc) - Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.01 rows=1 width=0) (actual rows=1 loops=1) - Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=78 loops=1) - Recheck Cond: (coverage <> '0/0-11'::smoc) - Rows Removed by Index Recheck: 23 - Heap Blocks: exact=5 - Buffers: shared hit=24804 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24745 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=230 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=171 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=98316.77..98323.02 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '0/'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=228 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..98316.75 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=169 - Planning: - Buffers: shared hit=1 -(10 rows) - diff --git a/expected/moc100_4.out b/expected/moc100_4.out deleted file mode 100644 index 0dc26bd4..00000000 --- a/expected/moc100_4.out +++ /dev/null @@ -1,309 +0,0 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 16+ -(1 row) - - outputfile_for_arch_bits --------------------------- - 64-bit -(1 row) - -CREATE TABLE moc100 ( - ivoid text, - coverage smoc, - ref_system_name text -); -COPY moc100 FROM STDIN; -CREATE INDEX ON moc100 USING GIN (coverage); -SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; - ivoid ------------------------------------------- - ivo://byu.arvo/dfbsspec/q/getssa - ivo://cadc.nrc.ca/archive/cfht - ivo://cadc.nrc.ca/archive/hst - ivo://cds.vizier/b/assocdata - ivo://cds.vizier/b/swift - ivo://cds.vizier/i/241 - ivo://cds.vizier/iv/12 - ivo://cds.vizier/ix/13 - ivo://cds.vizier/j/a+a/316/147 - ivo://cds.vizier/j/a+as/105/311 - ivo://cds.vizier/j/a+as/122/235 - ivo://chivo/gaia/q/dr1 - ivo://chivo/openngc/q/data - ivo://cxc.harvard.edu/csc - ivo://irsa.ipac/2mass/catalog/psc - ivo://irsa.ipac/2mass/catalog/xsc - ivo://irsa.ipac/2mass/images/asky-ql - ivo://irsa.ipac/cosmos/images - ivo://irsa.ipac/iras/images/issa - ivo://irsa.ipac/mast/scrapbook - ivo://irsa.ipac/spitzer/images/swire - ivo://mssl.ucl.ac.uk/xmmsuss_dsa/xmmsuss - ivo://ned.ipac/sia - ivo://ned.ipac/tap - ivo://svo.cab/cat/gbs - ivo://svo.cab/cat/uves - ivo://svo.cab/cat/xshooter - ivo://vopdc.iap/fss - ivo://vopdc.obspm/imcce/m4ast - ivo://vopdc.obspm/imcce/miriade - ivo://vopdc.obspm/imcce/skybot - ivo://vopdc.obspm/lesia/bestars/besc - ivo://vopdc.obspm/lesia/bestars/bess - ivo://vopdc.obspm/luth/exoplanet - ivo://vopdc.obspm/luth/hess -(35 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) - Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) - Index Cond: (coverage && '0/'::smoc) - Planning: - Buffers: shared hit=5 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..7.26 rows=1 width=96) (actual rows=35 loops=1) - Filter: (coverage && '4/0'::smoc) - Rows Removed by Filter: 66 - Buffers: shared hit=115 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..7.26 rows=1 width=96) (actual rows=23 loops=1) - Filter: (coverage = '0/0-11'::smoc) - Rows Removed by Filter: 78 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..7.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '6/43225 43227'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..7.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '0/'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..7.26 rows=100 width=96) (actual rows=78 loops=1) - Filter: (coverage <> '0/0-11'::smoc) - Rows Removed by Filter: 23 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..7.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..7.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '0/'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=60 - Planning: - Buffers: shared hit=1 -(6 rows) - -SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=38.92..42.93 rows=1 width=96) (actual rows=35 loops=1) - Recheck Cond: (coverage && '4/0'::smoc) - Heap Blocks: exact=5 - Buffers: shared hit=85 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..38.92 rows=1 width=0) (actual rows=35 loops=1) - Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=47.61..51.63 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage <@ '4/0'::smoc) - Rows Removed by Index Recheck: 35 - Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..47.61 rows=1 width=0) (actual rows=36 loops=1) - Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=38.92..42.93 rows=1 width=96) (actual rows=28 loops=1) - Recheck Cond: (coverage @> '4/0'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..38.92 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106879.01..106883.02 rows=1 width=96) (actual rows=23 loops=1) - Recheck Cond: (coverage = '0/0-11'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106879.01 rows=1 width=0) (actual rows=24 loops=1) - Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.83..16.84 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 28 - Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.83 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.83..16.84 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '0/'::smoc) - Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.83 rows=1 width=0) (actual rows=1 loops=1) - Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106895.48 rows=100 width=96) (actual rows=78 loops=1) - Recheck Cond: (coverage <> '0/0-11'::smoc) - Rows Removed by Index Recheck: 23 - Heap Blocks: exact=5 - Buffers: shared hit=24821 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24762 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106895.48 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=247 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=188 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106895.48 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '0/'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=245 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=186 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - diff --git a/expected/moc100_5.out b/expected/moc100_5.out deleted file mode 100644 index 3fb98a43..00000000 --- a/expected/moc100_5.out +++ /dev/null @@ -1,309 +0,0 @@ -\set ECHO none - outputfile_for_majorversion ------------------------------ - 16+ -(1 row) - - outputfile_for_arch_bits --------------------------- - 32-bit -(1 row) - -CREATE TABLE moc100 ( - ivoid text, - coverage smoc, - ref_system_name text -); -COPY moc100 FROM STDIN; -CREATE INDEX ON moc100 USING GIN (coverage); -SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; - ivoid ------------------------------------------- - ivo://byu.arvo/dfbsspec/q/getssa - ivo://cadc.nrc.ca/archive/cfht - ivo://cadc.nrc.ca/archive/hst - ivo://cds.vizier/b/assocdata - ivo://cds.vizier/b/swift - ivo://cds.vizier/i/241 - ivo://cds.vizier/iv/12 - ivo://cds.vizier/ix/13 - ivo://cds.vizier/j/a+a/316/147 - ivo://cds.vizier/j/a+as/105/311 - ivo://cds.vizier/j/a+as/122/235 - ivo://chivo/gaia/q/dr1 - ivo://chivo/openngc/q/data - ivo://cxc.harvard.edu/csc - ivo://irsa.ipac/2mass/catalog/psc - ivo://irsa.ipac/2mass/catalog/xsc - ivo://irsa.ipac/2mass/images/asky-ql - ivo://irsa.ipac/cosmos/images - ivo://irsa.ipac/iras/images/issa - ivo://irsa.ipac/mast/scrapbook - ivo://irsa.ipac/spitzer/images/swire - ivo://mssl.ucl.ac.uk/xmmsuss_dsa/xmmsuss - ivo://ned.ipac/sia - ivo://ned.ipac/tap - ivo://svo.cab/cat/gbs - ivo://svo.cab/cat/uves - ivo://svo.cab/cat/xshooter - ivo://vopdc.iap/fss - ivo://vopdc.obspm/imcce/m4ast - ivo://vopdc.obspm/imcce/miriade - ivo://vopdc.obspm/imcce/skybot - ivo://vopdc.obspm/lesia/bestars/besc - ivo://vopdc.obspm/lesia/bestars/bess - ivo://vopdc.obspm/luth/exoplanet - ivo://vopdc.obspm/luth/hess -(35 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=0.00..4.01 rows=1 width=96) (actual rows=0 loops=1) - Recheck Cond: (coverage && '0/'::smoc) - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..0.00 rows=1 width=0) (actual rows=0 loops=1) - Index Cond: (coverage && '0/'::smoc) - Planning: - Buffers: shared hit=5 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=35 loops=1) - Filter: (coverage && '4/0'::smoc) - Rows Removed by Filter: 66 - Buffers: shared hit=115 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN --------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=23 loops=1) - Filter: (coverage = '0/0-11'::smoc) - Rows Removed by Filter: 78 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '6/43225 43227'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN -------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=1 width=96) (actual rows=1 loops=1) - Filter: (coverage = '0/'::smoc) - Rows Removed by Filter: 100 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------- - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=78 loops=1) - Filter: (coverage <> '0/0-11'::smoc) - Rows Removed by Filter: 23 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=4 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN ------------------------------------------------------------------------------------ - Seq Scan on moc100 (cost=0.00..6.26 rows=100 width=96) (actual rows=100 loops=1) - Filter: (coverage <> '0/'::smoc) - Rows Removed by Filter: 1 - Buffers: shared hit=59 - Planning: - Buffers: shared hit=1 -(6 rows) - -SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=38.92..42.93 rows=1 width=96) (actual rows=35 loops=1) - Recheck Cond: (coverage && '4/0'::smoc) - Heap Blocks: exact=5 - Buffers: shared hit=86 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..38.92 rows=1 width=0) (actual rows=35 loops=1) - Index Cond: (coverage && '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=47.61..51.63 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage <@ '4/0'::smoc) - Rows Removed by Index Recheck: 35 - Heap Blocks: exact=5 - Buffers: shared hit=33 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..47.61 rows=1 width=0) (actual rows=36 loops=1) - Index Cond: (coverage <@ '4/0'::smoc) - Buffers: shared hit=12 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=38.92..42.93 rows=1 width=96) (actual rows=28 loops=1) - Recheck Cond: (coverage @> '4/0'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=4 - Buffers: shared hit=36 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..38.92 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage @> '4/0'::smoc) - Buffers: shared hit=9 - Planning: - Buffers: shared hit=4 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106879.01..106883.02 rows=1 width=96) (actual rows=23 loops=1) - Recheck Cond: (coverage = '0/0-11'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=2 - Buffers: shared hit=24581 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106879.01 rows=1 width=0) (actual rows=24 loops=1) - Index Cond: (coverage = '0/0-11'::smoc) - Buffers: shared hit=24577 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=12.83..16.84 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 28 - Heap Blocks: exact=3 - Buffers: shared hit=12 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.83 rows=1 width=0) (actual rows=29 loops=1) - Index Cond: (coverage = '6/43225 43227'::smoc) - Buffers: shared hit=3 - Planning: - Buffers: shared hit=1 -(10 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ - Bitmap Heap Scan on moc100 (cost=12.83..16.84 rows=1 width=96) (actual rows=1 loops=1) - Recheck Cond: (coverage = '0/'::smoc) - Heap Blocks: exact=1 - Buffers: shared hit=5 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..12.83 rows=1 width=0) (actual rows=1 loops=1) - Index Cond: (coverage = '0/'::smoc) - Buffers: shared hit=4 - Planning: - Buffers: shared hit=1 -(9 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106894.48 rows=100 width=96) (actual rows=78 loops=1) - Recheck Cond: (coverage <> '0/0-11'::smoc) - Rows Removed by Index Recheck: 23 - Heap Blocks: exact=5 - Buffers: shared hit=24804 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/0-11'::smoc) - Buffers: shared hit=24745 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106894.48 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '6/43225 43227'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=230 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '6/43225 43227'::smoc) - Buffers: shared hit=171 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Bitmap Heap Scan on moc100 (cost=106888.23..106894.48 rows=100 width=96) (actual rows=100 loops=1) - Recheck Cond: (coverage <> '0/'::smoc) - Rows Removed by Index Recheck: 1 - Heap Blocks: exact=5 - Buffers: shared hit=228 - -> Bitmap Index Scan on moc100_coverage_idx (cost=0.00..106888.20 rows=100 width=0) (actual rows=101 loops=1) - Index Cond: (coverage <> '0/'::smoc) - Buffers: shared hit=169 - Planning: - Buffers: shared hit=1 - JIT: - Functions: 2 - Options: Inlining false, Optimization false, Expressions true, Deforming true -(13 rows) - diff --git a/sql/moc100.sql b/sql/moc100.sql index 8c700b17..93afd1e6 100644 --- a/sql/moc100.sql +++ b/sql/moc100.sql @@ -1,14 +1,3 @@ -\set ECHO none -SELECT CASE - WHEN setting::int/10000 IN (10, 11, 12) THEN '10, 11, 12' -- moc100 - WHEN setting::int/10000 IN (13, 14, 15) THEN '13, 14, 15' -- moc100_2 - ELSE '16+' -END AS outputfile_for_majorversion -FROM pg_settings WHERE name = 'server_version_num'; - -SELECT (regexp_matches(version(), '..-bit'))[1] outputfile_for_arch_bits; -\set ECHO queries - CREATE TABLE moc100 ( ivoid text, coverage smoc, @@ -119,59 +108,38 @@ ivo://cds.vizier/j/a+as/124/353 6/24603,24796,25383,26065,27212,29368,29399,3101 empty 0/ \N \. +ANALYZE moc100; CREATE INDEX ON moc100 USING GIN (coverage); SELECT ivoid FROM moc100 WHERE coverage && '4/0' ORDER BY ivoid; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '0/'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; +-- PG 10 does not have JIT, ignore errors on SET +DO $$ + begin + set jit = off; + exception + when undefined_object then null; + when others then raise; + end; +$$; + +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '0/'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '4/0'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/0-11'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '6/43225,43227'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/0-11'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/'$$); SET enable_seqscan = off; -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage && '4/0'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <@ '4/0'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage @> '4/0'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/0-11'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '6/43225,43227'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage = '0/'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/0-11'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'; - -EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) - SELECT * FROM moc100 WHERE coverage <> '0/'; +SELECT explain ($$SELECT * FROM moc100 WHERE coverage && '4/0'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <@ '4/0'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage @> '4/0'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/0-11'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '6/43225,43227'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage = '0/'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/0-11'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '6/43225,43227'$$); +SELECT explain ($$SELECT * FROM moc100 WHERE coverage <> '0/'$$); From e810f5ddd827881b06a92a303c5c9fbf997b892e Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 26 Oct 2023 12:01:10 +0200 Subject: [PATCH 30/40] Drop obsolete compatibility @({bigint,spoint}, smoc) operators These were required by GAVO DaCHS, but are not used anymore. Furthermore, PG17 will forbid declaring commutators and negators relations with operators that themselves have relations to different operators. We delete pgs_moc_compat.sql.in and remove it from the old pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql upgrade script. This is ok to do since dropping the operators uses "if exists". Discussion: https://www.postgresql.org/message-id/flat/ZTfL1G1fBPQHVPWV%40msg.df7cb.de#ce3801c084bcf05b6b976cb2d0e25b2d Close #85. --- Makefile | 4 ++-- pgs_moc_compat.sql.in | 22 ------------------- .../pg_sphere--1.3.1--1.3.2.sql.in | 4 ++++ 3 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 pgs_moc_compat.sql.in diff --git a/Makefile b/Makefile index 5782814e..2a685d33 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ endif PGS_SQL += pgs_gist_spoint3.sql ifneq ($(USE_HEALPIX),0) -PGS_SQL += pgs_moc_type.sql pgs_moc_compat.sql pgs_moc_ops.sql \ +PGS_SQL += pgs_moc_type.sql pgs_moc_ops.sql \ pgs_moc_geo_casts.sql endif @@ -154,7 +154,7 @@ ifneq ($(USE_HEALPIX),0) pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql: pgs_moc_type.sql.in cat upgrade_scripts/$@.in $^ > $@ -pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql: pgs_moc_compat.sql.in +pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql: cat upgrade_scripts/$@.in $^ > $@ pg_sphere--1.1.5beta4gavo--1.2.0.sql: pgs_moc_ops.sql.in diff --git a/pgs_moc_compat.sql.in b/pgs_moc_compat.sql.in deleted file mode 100644 index 212b4f37..00000000 --- a/pgs_moc_compat.sql.in +++ /dev/null @@ -1,22 +0,0 @@ --- a minimal set of backwards-compatible operators for GAVO DaCHS, --- see http://soft.g-vo.org/dachs - -CREATE OPERATOR @ ( - LEFTARG = bigint, - RIGHTARG = smoc, - PROCEDURE = healpix_subset_smoc, - COMMUTATOR = '@>', - NEGATOR = '!<@', - RESTRICT = contsel, - JOIN = contjoinsel -); - -CREATE OPERATOR @ ( - LEFTARG = spoint, - RIGHTARG = smoc, - PROCEDURE = spoint_subset_smoc, - COMMUTATOR = '@>', - NEGATOR = '!<@', - RESTRICT = contsel, - JOIN = contjoinsel -); diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in index 1ada0662..bdad0c21 100644 --- a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -12,3 +12,7 @@ EXCEPTION WHEN OTHERS THEN RAISE; END; $$; + +-- remove legacy spellings of operators +DROP OPERATOR IF EXISTS @(bigint, smoc); +DROP OPERATOR IF EXISTS @(spoint, smoc); From 2ce76ba5cd08794e3438202975067ae464c86198 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 30 Oct 2023 10:48:24 +0100 Subject: [PATCH 31/40] Add *.cpp to .editorconfig src/process_moc.cpp is C++. --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index d69a3d1d..993a1d11 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,6 @@ root = true -[*.{c,h,l,y,pl,pm}] +[*.{c,cpp,h,l,y,pl,pm}] indent_style = tab indent_size = tab tab_width = 4 From 0fcfa3631972c84b83baf856eda07b5e31eb42e8 Mon Sep 17 00:00:00 2001 From: Ed Sabol Date: Sat, 28 Oct 2023 18:55:00 -0400 Subject: [PATCH 32/40] Add function to create spoly from an array of numbers in radians. --- expected/poly.out | 26 ++++++ pgs_polygon.sql.in | 41 ++++++---- sql/poly.sql | 14 ++++ src/polygon.c | 82 ++++++++++++++++--- src/polygon.h | 9 +- .../pg_sphere--1.3.1--1.3.2.sql.in | 17 ++++ 6 files changed, 160 insertions(+), 29 deletions(-) diff --git a/expected/poly.out b/expected/poly.out index 50e510e3..2d622b56 100644 --- a/expected/poly.out +++ b/expected/poly.out @@ -318,6 +318,18 @@ SELECT spoly '{(10d,0d),(10d,1d),(15d,0d)}'; {(10d , 0d),(10d , 1d),(15d , 0d)} (1 row) +SELECT spoly(ARRAY[0.017453292519943295, 0.03490658503988659, 0.05235987755982988, 0.06981317007977318, 0.08726646259971647, 0.10471975511965977]); + spoly +--------------------------------- + {(1d , 2d),(3d , 4d),(5d , 6d)} +(1 row) + +SELECT spoly(ARRAY[0.17453292519943295, 0.0, 0.17453292519943295, 0.017453292519943295, 0.2617993877991494, 0.0]); + spoly +------------------------------------ + {(10d , 0d),(10d , 1d),(15d , 0d)} +(1 row) + SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); spoly_deg --------------------------------- @@ -335,8 +347,22 @@ SELECT spoly '{(10d,0d),(10d,1d)}'; ERROR: spherepoly_in: more than two points needed LINE 1: SELECT spoly '{(10d,0d),(10d,1d)}'; ^ +SELECT spoly(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]); +ERROR: spherepoly_rad: invalid number of arguments (must be even and >= 6) +SELECT spoly(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]); +ERROR: spherepoly_rad: input array is invalid because it has null values +SELECT spoly(ARRAY[]::float8[]); +ERROR: spherepoly_rad: invalid number of arguments (must be even and >= 6) +SELECT spoly(NULL::float8[]); + spoly +------- + +(1 row) + SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]); ERROR: spherepoly_deg: invalid number of arguments (must be even and >= 6) +SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]); +ERROR: spherepoly_deg: input array is invalid because it has null values SELECT spoly_deg(ARRAY[]::float8[]); ERROR: spherepoly_deg: invalid number of arguments (must be even and >= 6) SELECT spoly_deg(NULL::float8[]); diff --git a/pgs_polygon.sql.in b/pgs_polygon.sql.in index fdd42772..3a5d8018 100644 --- a/pgs_polygon.sql.in +++ b/pgs_polygon.sql.in @@ -1,6 +1,8 @@ - +-- ************************** +-- -- spherical polygon functions - +-- +-- ************************** CREATE FUNCTION npoints(spoly) RETURNS INT4 @@ -933,6 +935,29 @@ COMMENT ON OPERATOR !&& (sellipse, spoly) IS 'true if spherical ellipse does not overlap spherical polygon'; +-- +-- Functions to create a polygon from arrays +-- + +CREATE FUNCTION spoly(float8[]) + RETURNS spoly + AS 'MODULE_PATHNAME', 'spherepoly_rad' + LANGUAGE 'c' + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoly(float8[]) IS + 'creates spoly from array of numbers in radians'; + +CREATE FUNCTION spoly_deg(float8[]) + RETURNS spoly + AS 'MODULE_PATHNAME', 'spherepoly_deg' + LANGUAGE 'c' + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoly_deg(float8[]) IS + 'creates spoly from array of numbers in degrees'; + + -- -- Aggregate functions to add points to polygon -- @@ -946,18 +971,6 @@ CREATE FUNCTION spoly_add_point_aggr (spoly, spoint) COMMENT ON FUNCTION spoly_add_point_aggr (spoly, spoint) IS 'adds a spherical point to spherical polygon. Do not use it standalone!'; -CREATE FUNCTION spoly_deg(float8[]) - RETURNS spoly - AS 'MODULE_PATHNAME', 'spherepoly_deg' - LANGUAGE 'c' - IMMUTABLE STRICT; - -COMMENT ON FUNCTION spoly_deg(float8[]) IS - ' Create spoly from array of points. - Two consecutive numbers among those present - refer to the same occurrence and cover its - latitude and longitude, respectively.'; - CREATE FUNCTION spoly_add_points_fin_aggr (spoly) RETURNS spoly AS 'MODULE_PATHNAME', 'spherepoly_add_points_finalize' diff --git a/sql/poly.sql b/sql/poly.sql index 2281aba1..a3f36d4b 100644 --- a/sql/poly.sql +++ b/sql/poly.sql @@ -78,6 +78,10 @@ SELECT spoly '{(359d,0d),(359d,1d),(4d,0d)}'; SELECT spoly '{(10d,0d),(10d,1d),(15d,0d)}'; +SELECT spoly(ARRAY[0.017453292519943295, 0.03490658503988659, 0.05235987755982988, 0.06981317007977318, 0.08726646259971647, 0.10471975511965977]); + +SELECT spoly(ARRAY[0.17453292519943295, 0.0, 0.17453292519943295, 0.017453292519943295, 0.2617993877991494, 0.0]); + SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); SELECT spoly_deg(ARRAY[10.0, 0.0, 10.0, 1.0, 15.0, 0.0]); @@ -86,8 +90,18 @@ SELECT spoly_deg(ARRAY[10.0, 0.0, 10.0, 1.0, 15.0, 0.0]); SELECT spoly '{(10d,0d),(10d,1d)}'; +SELECT spoly(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]); + +SELECT spoly(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]); + +SELECT spoly(ARRAY[]::float8[]); + +SELECT spoly(NULL::float8[]); + SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0]); +SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, NULL, 5.0, 6.0]); + SELECT spoly_deg(ARRAY[]::float8[]); SELECT spoly_deg(NULL::float8[]); diff --git a/src/polygon.c b/src/polygon.c index 57786b85..0ed61919 100644 --- a/src/polygon.c +++ b/src/polygon.c @@ -6,6 +6,7 @@ PG_FUNCTION_INFO_V1(spherepoly_in); PG_FUNCTION_INFO_V1(spherepoly_deg); +PG_FUNCTION_INFO_V1(spherepoly_rad); PG_FUNCTION_INFO_V1(spherepoly_equal); PG_FUNCTION_INFO_V1(spherepoly_equal_neg); PG_FUNCTION_INFO_V1(spherepoly_circ); @@ -906,6 +907,56 @@ spherepoly_in(PG_FUNCTION_ARGS) PG_RETURN_POINTER(poly); } +Datum +spherepoly_rad(PG_FUNCTION_ARGS) +{ + int i, + np; + ArrayType *float_vector = PG_GETARG_ARRAYTYPE_P(0); + float8 *array_data; + SPoint *points; + + np = ArrayGetNItems(ARR_NDIM(float_vector), ARR_DIMS(float_vector)); + + if (ARR_HASNULL(float_vector)) + { + elog(ERROR, + "spherepoly_rad: input array is invalid because it has null values" + ); + PG_RETURN_NULL(); + } + + if (np < 6 || np % 2 != 0) + { + elog(ERROR, + "spherepoly_rad: invalid number of arguments (must be even and >= 6)" + ); + PG_RETURN_NULL(); + } + + np /= 2; + + points = (SPoint *) palloc(np * sizeof(SPoint)); + if (points == NULL) + { + elog(ERROR, + "spherepoly_rad: failed to allocate memory for points array" + ); + PG_RETURN_NULL(); + } + + array_data = (float8 *) ARR_DATA_PTR(float_vector); + + for (i = 0; i < np; i++) + { + create_spherepoint_from_long_lat(&points[i], + array_data[2 * i], + array_data[2 * i + 1] + ); + } + PG_RETURN_POINTER(spherepoly_from_array(points, np)); +} + Datum spherepoly_deg(PG_FUNCTION_ARGS) { @@ -917,12 +968,19 @@ spherepoly_deg(PG_FUNCTION_ARGS) np = ArrayGetNItems(ARR_NDIM(float_vector), ARR_DIMS(float_vector)); + if (ARR_HASNULL(float_vector)) + { + elog(ERROR, + "spherepoly_deg: input array is invalid because it has null values" + ); + PG_RETURN_NULL(); + } + if (np < 6 || np % 2 != 0) { - elog( - ERROR, - "spherepoly_deg: invalid number of arguments (must be even and >= 6)" - ); + elog(ERROR, + "spherepoly_deg: invalid number of arguments (must be even and >= 6)" + ); PG_RETURN_NULL(); } @@ -931,10 +989,9 @@ spherepoly_deg(PG_FUNCTION_ARGS) points = (SPoint *) palloc(np * sizeof(SPoint)); if (points == NULL) { - elog( - ERROR, - "spherepoly_deg: failed for allocate memory for points array" - ); + elog(ERROR, + "spherepoly_deg: failed to allocate memory for points array" + ); PG_RETURN_NULL(); } @@ -942,11 +999,10 @@ spherepoly_deg(PG_FUNCTION_ARGS) for (i = 0; i < np; i++) { - create_spherepoint_from_long_lat( - &points[i], - deg_to_rad(array_data[2 * i]), - deg_to_rad(array_data[2 * i + 1]) - ); + create_spherepoint_from_long_lat(&points[i], + deg_to_rad(array_data[2 * i]), + deg_to_rad(array_data[2 * i + 1]) + ); } PG_RETURN_POINTER(spherepoly_from_array(points, np)); } diff --git a/src/polygon.h b/src/polygon.h index d52a9c61..e90b7c51 100644 --- a/src/polygon.h +++ b/src/polygon.h @@ -87,9 +87,14 @@ Datum spherepoly_get_point(PG_FUNCTION_ARGS); int8 poly_line_pos(const SPOLY *poly, const SLine *line); /* - * Input of a spherical from sequence of pairconsecutive numbers(lng, lat). + * Input of a spherical from array of pair-consecutive numbers (lng, lat), in radians. */ -Datum spherepoly_deg(PG_FUNCTION_ARGS); +Datum spherepoly_rad(PG_FUNCTION_ARGS); + +/* + * Input of a spherical from array of pair-consecutive numbers (lng, lat), in degrees. + */ +Datum spherepoly_deg(PG_FUNCTION_ARGS); /* * Input of a spherical polygon. diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in index bdad0c21..3a80bc7f 100644 --- a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -16,3 +16,20 @@ $$; -- remove legacy spellings of operators DROP OPERATOR IF EXISTS @(bigint, smoc); DROP OPERATOR IF EXISTS @(spoint, smoc); + +-- add spoly function that takes an array of float8 values in radians +CREATE FUNCTION spoly(float8[]) + RETURNS spoly + AS 'MODULE_PATHNAME', 'spherepoly_rad' + LANGUAGE 'c' + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoly(float8[]) IS + 'creates spoly from array of numbers in radians'; + +-- add PARALLEL SAFE to spoly_deg(float8[]) +ALTER FUNCTION spoly_deg(float8[]) IMMUTABLE STRICT PARALLEL SAFE; + +-- update comment on spoly_deg function +COMMENT ON FUNCTION spoly_deg(float8[]) IS + 'creates spoly from array of numbers in degrees'; From 9d5fa49c37206cc2cabea0bf85abf35a9c26a246 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 1 Nov 2023 16:30:35 +0300 Subject: [PATCH 33/40] Add spoly(spoint[]) constructor function --- expected/poly.out | 76 ++++++++++++------- pgs_polygon.sql.in | 10 ++- sql/poly.sql | 66 +++++++++------- src/polygon.c | 28 ++++++- .../pg_sphere--1.3.1--1.3.2.sql.in | 9 +++ 5 files changed, 135 insertions(+), 54 deletions(-) diff --git a/expected/poly.out b/expected/poly.out index 2d622b56..a6959156 100644 --- a/expected/poly.out +++ b/expected/poly.out @@ -12,25 +12,25 @@ SELECT spoint '(0.15,0.10)' @ :poly; -- point inside polygon t (1 row) -SELECT spoint '(0.20,0.00)' @ :poly; -- point contained polygon +SELECT spoint '(0.20,0.00)' @ :poly; -- point contained polygon ?column? ---------- t (1 row) -SELECT spoint '(0.10,0.10)' @ :poly; -- point contained polygon +SELECT spoint '(0.10,0.10)' @ :poly; -- point contained polygon ?column? ---------- t (1 row) -SELECT spoint '(0.25,0.50)' @ :poly; -- point outside polygon +SELECT spoint '(0.25,0.50)' @ :poly; -- point outside polygon ?column? ---------- f (1 row) -SELECT spoint '(0.25,0.00)' @ :poly; -- point outside polygon +SELECT spoint '(0.25,0.00)' @ :poly; -- point outside polygon ?column? ---------- f @@ -42,13 +42,13 @@ SELECT scircle '<(0.15,0.10),0.03>' @ :poly; -- circle inside polygon t (1 row) -SELECT scircle '<(0.20,0.00),0.00>' @ :poly; -- circle contained polygon +SELECT scircle '<(0.20,0.00),0.00>' @ :poly; -- circle contained polygon ?column? ---------- t (1 row) -SELECT scircle '<(0.20,0.30),0.05>' @ :poly; -- circle outside polygon +SELECT scircle '<(0.20,0.30),0.05>' @ :poly; -- circle outside polygon ?column? ---------- f @@ -72,13 +72,13 @@ SELECT scircle '<(0.15,0.10),0.03>' && :poly; -- circle inside polygon t (1 row) -SELECT scircle '<(0.20,0.00),0.00>' && :poly; -- circle contained polygon +SELECT scircle '<(0.20,0.00),0.00>' && :poly; -- circle contained polygon ?column? ---------- t (1 row) -SELECT scircle '<(0.20,0.30),0.05>' && :poly; -- circle outside polygon +SELECT scircle '<(0.20,0.30),0.05>' && :poly; -- circle outside polygon ?column? ---------- f @@ -96,13 +96,13 @@ SELECT scircle '<(0.25,0.00),0.10>' && :poly; -- circle overlaps polyg t (1 row) -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) @ :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) @ :poly; -- line touches polygon ?column? ---------- f (1 row) -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) @ :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) @ :poly; -- line touches polygon ?column? ---------- f @@ -114,7 +114,7 @@ SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) @ :poly; -- line f (1 row) -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) @ :poly; -- line touches and inside polygon +SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) @ :poly; -- line touches and inside polygon ?column? ---------- t @@ -138,13 +138,13 @@ SELECT sline ( spoint '(0.24, 0.17)', spoint '(0.25,0.14)' ) @ :poly; -- line t (1 row) -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) && :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) && :poly; -- line touches polygon ?column? ---------- t (1 row) -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) && :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) && :poly; -- line touches polygon ?column? ---------- t @@ -156,7 +156,7 @@ SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) && :poly; -- line t (1 row) -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) && :poly; -- line touches and inside polygon +SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) && :poly; -- line touches and inside polygon ?column? ---------- t @@ -342,7 +342,32 @@ SELECT spoly_deg(ARRAY[10.0, 0.0, 10.0, 1.0, 15.0, 0.0]); {(10d , 0d),(10d , 1d),(15d , 0d)} (1 row) --- incorrect input ----- +--- Constructors +SELECT spoly(NULL::spoint[]); + spoly +------- + +(1 row) + +SELECT spoly(ARRAY[]::spoint[]); +ERROR: spoly_deg: invalid number of arguments (must be >= 3) +SELECT spoly(ARRAY[spoint_deg(0, 0)]); +ERROR: spoly_deg: invalid number of arguments (must be >= 3) +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0)]); +ERROR: spoly_deg: invalid number of arguments (must be >= 3) +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10)]); + spoly +------------------------------------ + {(0d , 0d),(10d , 0d),(10d , 10d)} +(1 row) + +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10), spoint_deg(0, 10)]); + spoly +----------------------------------------------- + {(0d , 0d),(10d , 0d),(10d , 10d),(0d , 10d)} +(1 row) + +--- incorrect input ----- SELECT spoly '{(10d,0d),(10d,1d)}'; ERROR: spherepoly_in: more than two points needed LINE 1: SELECT spoly '{(10d,0d),(10d,1d)}'; @@ -1211,7 +1236,7 @@ SELECT spoly '{(0d,-88d),(90d,-88d),(180d,-88d),(270d,-88d)}' @ spoly '{(0d,89d) (1 row) --- spoly ~ spoly ---- should be true +--- should be true SELECT spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}' ~ spoly '{(0d,0d),(0d,0.5d),(0.5d,0.5d),(0.5d,0d)}'; ?column? ---------- @@ -1280,7 +1305,7 @@ SELECT spoly '{(0d,89d),(90d,89d),(180d,89d),(270d,89d)}' ~ spoly '{(0d,-88d),(9 (1 row) --- spoly && spoly ---- should be true +--- should be true SELECT spoly '{(0d,0d),(0d,0.5d),(0.5d,0.5d),(0.5d,0d)}' && spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}'; ?column? ---------- @@ -1417,7 +1442,6 @@ SELECT spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}' && spoly '{(179d,-1d),(179d -- -- ellipse and polygon -- - -- negators , commutator @,&& SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; ?column? @@ -1564,49 +1588,49 @@ SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d,-11d),(280d,-12 (1 row) -- ellipse is point -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; ?column? ---------- f (1 row) -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; ?column? ---------- f (1 row) -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; ?column? ---------- f (1 row) -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; ?column? ---------- t (1 row) -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; ?column? ---------- f (1 row) -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; ?column? ---------- t (1 row) -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; ?column? ---------- f (1 row) -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; ?column? ---------- t diff --git a/pgs_polygon.sql.in b/pgs_polygon.sql.in index 3a5d8018..0e73becf 100644 --- a/pgs_polygon.sql.in +++ b/pgs_polygon.sql.in @@ -948,6 +948,15 @@ CREATE FUNCTION spoly(float8[]) COMMENT ON FUNCTION spoly(float8[]) IS 'creates spoly from array of numbers in radians'; +CREATE FUNCTION spoly(spoint[]) + RETURNS spoly + AS 'MODULE_PATHNAME', 'spherepoly_from_point_array' + LANGUAGE 'c' + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoly(spoint[]) IS + 'creates spoly from an array of points'; + CREATE FUNCTION spoly_deg(float8[]) RETURNS spoly AS 'MODULE_PATHNAME', 'spherepoly_deg' @@ -987,7 +996,6 @@ CREATE AGGREGATE spoly ( finalfunc = spoly_add_points_fin_aggr ); - -- -- polygon is convex -- diff --git a/sql/poly.sql b/sql/poly.sql index a3f36d4b..0fb992bf 100644 --- a/sql/poly.sql +++ b/sql/poly.sql @@ -7,31 +7,31 @@ SET extra_float_digits = 0; \set poly 'spoly \'{(0.1,0),(0.2,0),(0.2,0.1),(0.3,0.1),(0.3,-0.1),(0.4,-0.1),(0.5,0.1),(0.4,0.2),(0.1,0.2)}\'' SELECT spoint '(0.15,0.10)' @ :poly; -- point inside polygon -SELECT spoint '(0.20,0.00)' @ :poly; -- point contained polygon -SELECT spoint '(0.10,0.10)' @ :poly; -- point contained polygon -SELECT spoint '(0.25,0.50)' @ :poly; -- point outside polygon -SELECT spoint '(0.25,0.00)' @ :poly; -- point outside polygon +SELECT spoint '(0.20,0.00)' @ :poly; -- point contained polygon +SELECT spoint '(0.10,0.10)' @ :poly; -- point contained polygon +SELECT spoint '(0.25,0.50)' @ :poly; -- point outside polygon +SELECT spoint '(0.25,0.00)' @ :poly; -- point outside polygon SELECT scircle '<(0.15,0.10),0.03>' @ :poly; -- circle inside polygon -SELECT scircle '<(0.20,0.00),0.00>' @ :poly; -- circle contained polygon -SELECT scircle '<(0.20,0.30),0.05>' @ :poly; -- circle outside polygon +SELECT scircle '<(0.20,0.00),0.00>' @ :poly; -- circle contained polygon +SELECT scircle '<(0.20,0.30),0.05>' @ :poly; -- circle outside polygon SELECT scircle '<(0.25,0.00),0.05>' @ :poly; -- circle overlaps polygon SELECT scircle '<(0.25,0.00),0.10>' @ :poly; -- circle overlaps polygon SELECT scircle '<(0.15,0.10),0.03>' && :poly; -- circle inside polygon -SELECT scircle '<(0.20,0.00),0.00>' && :poly; -- circle contained polygon -SELECT scircle '<(0.20,0.30),0.05>' && :poly; -- circle outside polygon +SELECT scircle '<(0.20,0.00),0.00>' && :poly; -- circle contained polygon +SELECT scircle '<(0.20,0.30),0.05>' && :poly; -- circle outside polygon SELECT scircle '<(0.25,0.00),0.05>' && :poly; -- circle overlaps polygon SELECT scircle '<(0.25,0.00),0.10>' && :poly; -- circle overlaps polygon -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) @ :poly; -- line touches polygon -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) @ :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) @ :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) @ :poly; -- line touches polygon SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) @ :poly; -- line touches polygon -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) @ :poly; -- line touches and inside polygon +SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) @ :poly; -- line touches and inside polygon SELECT sline ( spoint '(0.45,-0.20)', spoint '(0.45,0.20)' ) @ :poly; -- line overlaps polygon SELECT sline ( spoint '(0.45, 0.10)', spoint '(0.45,0.20)' ) @ :poly; -- line overlaps polygon SELECT sline ( spoint '(0.24, 0.17)', spoint '(0.25,0.14)' ) @ :poly; -- line inside polygon -SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) && :poly; -- line touches polygon -SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) && :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.00)', spoint '(0.10,0.20)' ) && :poly; -- line touches polygon +SELECT sline ( spoint '(0.00, 0.10)', spoint '(0.10,0.10)' ) && :poly; -- line touches polygon SELECT sline ( spoint '(0.50, 0.00)', spoint '(0.50,0.20)' ) && :poly; -- line touches polygon -SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) && :poly; -- line touches and inside polygon +SELECT sline ( spoint '(0.10, 0.20)', spoint '(0.20,0.00)' ) && :poly; -- line touches and inside polygon SELECT sline ( spoint '(0.45,-0.20)', spoint '(0.45,0.20)' ) && :poly; -- line overlaps polygon SELECT sline ( spoint '(0.45, 0.10)', spoint '(0.45,0.20)' ) && :poly; -- line overlaps polygon SELECT sline ( spoint '(0.24, 0.17)', spoint '(0.25,0.14)' ) && :poly; -- line inside polygon @@ -86,7 +86,21 @@ SELECT spoly_deg(ARRAY[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]); SELECT spoly_deg(ARRAY[10.0, 0.0, 10.0, 1.0, 15.0, 0.0]); --- incorrect input ----- +--- Constructors + +SELECT spoly(NULL::spoint[]); + +SELECT spoly(ARRAY[]::spoint[]); + +SELECT spoly(ARRAY[spoint_deg(0, 0)]); + +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0)]); + +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10)]); + +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10), spoint_deg(0, 10)]); + +--- incorrect input ----- SELECT spoly '{(10d,0d),(10d,1d)}'; @@ -457,7 +471,7 @@ SELECT spoly '{(0d,-88d),(90d,-88d),(180d,-88d),(270d,-88d)}' @ spoly '{(0d,89d) --- spoly ~ spoly ---- should be true +--- should be true SELECT spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}' ~ spoly '{(0d,0d),(0d,0.5d),(0.5d,0.5d),(0.5d,0d)}'; @@ -485,7 +499,7 @@ SELECT spoly '{(0d,89d),(90d,89d),(180d,89d),(270d,89d)}' ~ spoly '{(0d,-88d),(9 --- spoly && spoly ---- should be true +--- should be true SELECT spoly '{(0d,0d),(0d,0.5d),(0.5d,0.5d),(0.5d,0d)}' && spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}'; @@ -536,7 +550,7 @@ SELECT spoly '{(-1d,-1d),(-1d,1d),(1d,1d),(1d,-1d)}' && spoly '{(179d,-1d),(179d -- -- ellipse and polygon -- - + -- negators , commutator @,&& SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{10d,5d},(280d,-20d),90d>'; @@ -565,14 +579,14 @@ SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d, -9d),(280d,-12 SELECT sellipse '<{10d,5d},(280d,-20d),90d>' !&& spoly '{(280d,-11d),(280d,-12d),(279d, -12d)}'; -- ellipse is point -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; -SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; -SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; -SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; +SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' @ sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}' && sellipse '<{0d,0d},(280d,-20d),90d>'; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' @ spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' ; +SELECT sellipse '<{0d,0d},(280d,-20d),90d>' && spoly '{(280d,-11d),(280d,-20d),(279d, -12d)}'; -- ellipse is circle SELECT spoly '{(280d, -9d),(280d, -8d),(279d, -8d)}' @ sellipse '<{5d,5d},(280d,-20d),90d>'; diff --git a/src/polygon.c b/src/polygon.c index 0ed61919..98e8aa0c 100644 --- a/src/polygon.c +++ b/src/polygon.c @@ -61,7 +61,7 @@ PG_FUNCTION_INFO_V1(spheretrans_poly_inverse); PG_FUNCTION_INFO_V1(spherepoly_add_point); PG_FUNCTION_INFO_V1(spherepoly_add_points_finalize); PG_FUNCTION_INFO_V1(spherepoly_is_convex); - +PG_FUNCTION_INFO_V1(spherepoly_from_point_array); /* * Writes "center" of a polygon into 'v'. @@ -1007,6 +1007,32 @@ spherepoly_deg(PG_FUNCTION_ARGS) PG_RETURN_POINTER(spherepoly_from_array(points, np)); } +Datum +spherepoly_from_point_array(PG_FUNCTION_ARGS) +{ + int np; + ArrayType *inarr = PG_GETARG_ARRAYTYPE_P(0); + SPoint *points; + + np = ArrayGetNItems(ARR_NDIM(inarr), ARR_DIMS(inarr)); + + if (np < 3) + { + elog(ERROR, "spoly_deg: invalid number of arguments (must be >= 3)"); + PG_RETURN_NULL(); + } + + if (ARR_HASNULL(inarr)) + { + elog(ERROR, "spoly_deg: input array is invalid because if has null values"); + PG_RETURN_NULL(); + } + + points = (SPoint *) ARR_DATA_PTR(inarr); + + PG_RETURN_POINTER(spherepoly_from_array(points, np)); +} + Datum spherepoly_equal(PG_FUNCTION_ARGS) { diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in index 3a80bc7f..70f9506c 100644 --- a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in +++ b/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in @@ -27,6 +27,15 @@ CREATE FUNCTION spoly(float8[]) COMMENT ON FUNCTION spoly(float8[]) IS 'creates spoly from array of numbers in radians'; +CREATE FUNCTION spoly(spoint[]) + RETURNS spoly + AS 'MODULE_PATHNAME', 'spherepoly_from_point_array' + LANGUAGE 'c' + IMMUTABLE STRICT PARALLEL SAFE; + +COMMENT ON FUNCTION spoly(spoint[]) IS + 'creates spoly from an array of points'; + -- add PARALLEL SAFE to spoly_deg(float8[]) ALTER FUNCTION spoly_deg(float8[]) IMMUTABLE STRICT PARALLEL SAFE; From 595ecc9849675d29f36085ce489bc3eee43f0b5a Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Fri, 3 Nov 2023 15:05:00 +0300 Subject: [PATCH 34/40] Fix found problems after review --- expected/poly.out | 10 +++++----- sql/poly.sql | 4 ++-- src/polygon.c | 12 ++++++------ src/polygon.h | 11 +++++++++-- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/expected/poly.out b/expected/poly.out index a6959156..1ce3963f 100644 --- a/expected/poly.out +++ b/expected/poly.out @@ -350,18 +350,18 @@ SELECT spoly(NULL::spoint[]); (1 row) SELECT spoly(ARRAY[]::spoint[]); -ERROR: spoly_deg: invalid number of arguments (must be >= 3) +ERROR: spherepoly_from_point_array: invalid number of arguments (must be >= 3) SELECT spoly(ARRAY[spoint_deg(0, 0)]); -ERROR: spoly_deg: invalid number of arguments (must be >= 3) +ERROR: spherepoly_from_point_array: invalid number of arguments (must be >= 3) SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0)]); -ERROR: spoly_deg: invalid number of arguments (must be >= 3) -SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10)]); +ERROR: spherepoly_from_point_array: invalid number of arguments (must be >= 3) +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10, 10)]); spoly ------------------------------------ {(0d , 0d),(10d , 0d),(10d , 10d)} (1 row) -SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10), spoint_deg(0, 10)]); +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10, 10), spoint_deg(0, 10)]); spoly ----------------------------------------------- {(0d , 0d),(10d , 0d),(10d , 10d),(0d , 10d)} diff --git a/sql/poly.sql b/sql/poly.sql index 0fb992bf..972674e5 100644 --- a/sql/poly.sql +++ b/sql/poly.sql @@ -96,9 +96,9 @@ SELECT spoly(ARRAY[spoint_deg(0, 0)]); SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0)]); -SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10)]); +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10, 10)]); -SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10,10), spoint_deg(0, 10)]); +SELECT spoly(ARRAY[spoint_deg(0, 0), spoint_deg(10, 0), spoint_deg(10, 10), spoint_deg(0, 10)]); --- incorrect input ----- diff --git a/src/polygon.c b/src/polygon.c index 98e8aa0c..ac91c6e5 100644 --- a/src/polygon.c +++ b/src/polygon.c @@ -1010,21 +1010,21 @@ spherepoly_deg(PG_FUNCTION_ARGS) Datum spherepoly_from_point_array(PG_FUNCTION_ARGS) { - int np; - ArrayType *inarr = PG_GETARG_ARRAYTYPE_P(0); SPoint *points; - - np = ArrayGetNItems(ARR_NDIM(inarr), ARR_DIMS(inarr)); + ArrayType *inarr = PG_GETARG_ARRAYTYPE_P(0); + const int np = ArrayGetNItems(ARR_NDIM(inarr), ARR_DIMS(inarr)); if (np < 3) { - elog(ERROR, "spoly_deg: invalid number of arguments (must be >= 3)"); + elog(ERROR, "spherepoly_from_point_array: " + "invalid number of arguments (must be >= 3)"); PG_RETURN_NULL(); } if (ARR_HASNULL(inarr)) { - elog(ERROR, "spoly_deg: input array is invalid because if has null values"); + elog(ERROR, "spherepoly_from_point_array: " + "input array is invalid because it has null values"); PG_RETURN_NULL(); } diff --git a/src/polygon.h b/src/polygon.h index e90b7c51..b8c754d4 100644 --- a/src/polygon.h +++ b/src/polygon.h @@ -87,15 +87,22 @@ Datum spherepoly_get_point(PG_FUNCTION_ARGS); int8 poly_line_pos(const SPOLY *poly, const SLine *line); /* - * Input of a spherical from array of pair-consecutive numbers (lng, lat), in radians. + * Creates a spherical polygon (spoly) from an array of pair-consecutive + * numbers (lng, lat), in radians. */ Datum spherepoly_rad(PG_FUNCTION_ARGS); /* - * Input of a spherical from array of pair-consecutive numbers (lng, lat), in degrees. + * Creates a spherical polygon (spoly) from an array of pair-consecutive + * numbers (lng, lat), in degrees. */ Datum spherepoly_deg(PG_FUNCTION_ARGS); +/* + * Creates a spherical polygon (spoly) from an array of spoint elements. + */ +Datum spherepoly_from_point_array(PG_FUNCTION_ARGS); + /* * Input of a spherical polygon. */ From 4d8e97dfbd5f65c424a92c19e87a1a57f9c1bcc9 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Fri, 3 Nov 2023 20:58:09 +0300 Subject: [PATCH 35/40] Update the doc with spoly, spoly_deg function descriptions --- doc/constructors.sgm | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/doc/constructors.sgm b/doc/constructors.sgm index e14dd3f5..4f876513 100644 --- a/doc/constructors.sgm +++ b/doc/constructors.sgm @@ -268,22 +268,45 @@ Codestin Search App + - The aggregate function + The functions spoly and spoly_deg + can be used to create spherical polygons. Function spoly + is overloaded and can accept arrays of float8 or spoint elements. + There are the same restrictions as for using the input function of + spherical polygon (see ). - - - spoly - spoint edge - - + - can be used to create a polygon from a set of spherical points. - There are the same restrictions as for using the input function of - spherical polygon (see ). The function - returns - NULL, if the polygon couldn't be created. + Create a spherical polygon from an array of pair-consecutive + numbers (lng, lat). The coordinates are specified in radians. + + SELECT spoly(ARRAY[0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0])]]> + + + + Create a spherical polygon from an array of spoint elements. + + SELECT spoly(ARRAY[spoint(0, 0), spoint(0, 0.5), spoint(0.5, 0.5), spoint(0.5, 0)])]]> + + + + + Create a spherical polygon from an array of pair-consecutive + numbers (lng, lat). The coordinates are specified in degrees. + + SELECT spoly_deg(ARRAY[0, 0, 0, 10, 10, 10, 10, 0])]]> + + + + + The aggregate function spoly can be used to + create a polygon from a set of spherical points. The function + returns NULL, if the polygon could not be + created. + + Codestin Search App + + Values of type spoint can be indexed using a + HASH index, supporting the + = operator. + The spoint_hash_ops operator class also enables + DISTINCT queries on spoint. + + + Codestin Search App + + + + + + + + + + + + diff --git a/expected/index.out b/expected/index.out index eefa5c63..f63cff80 100644 --- a/expected/index.out +++ b/expected/index.out @@ -195,3 +195,39 @@ EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1 4 (1 row) +-- test hash opclass +CREATE TABLE spheretmp1c AS TABLE spheretmp1; +SELECT p FROM spheretmp1c WHERE p <@ scircle '<(1,1),0.2>' ORDER BY p::text; + p +--------------- + (0.67 , 0.97) + (0.67 , 0.97) + (0.67 , 0.97) + (0.67 , 0.97) + (1.07 , 1.09) + (1.07 , 1.09) + (1.07 , 1.09) + (1.07 , 1.09) + (1.24 , 0.95) + (1.24 , 0.95) + (1.24 , 0.95) + (1.24 , 0.95) +(12 rows) + +WITH points AS (SELECT DISTINCT p FROM spheretmp1c WHERE p <@ scircle '<(1,1),0.2>') + SELECT p FROM points ORDER BY p::text; + p +--------------- + (0.67 , 0.97) + (1.07 , 1.09) + (1.24 , 0.95) +(3 rows) + +CREATE INDEX spheretmp1c_hash_idx ON spheretmp1c USING hash(p); +EXPLAIN (COSTS OFF) SELECT * FROM spheretmp1c WHERE p = '(0.67 , 0.97)'; + QUERY PLAN +------------------------------------------------------ + Index Scan using spheretmp1c_hash_idx on spheretmp1c + Index Cond: (p = '(0.67 , 0.97)'::spoint) +(2 rows) + diff --git a/pgs_hash.sql.in b/pgs_hash.sql.in new file mode 100644 index 00000000..52fd1ed9 --- /dev/null +++ b/pgs_hash.sql.in @@ -0,0 +1,19 @@ +CREATE FUNCTION spoint_hash32 (spoint) + RETURNS int + IMMUTABLE STRICT + PARALLEL SAFE + LANGUAGE C + AS 'MODULE_PATHNAME', 'spherepoint_hash32'; + +UPDATE pg_operator + SET oprcanhash = true + WHERE oprname = '=' AND + oprleft = 'spoint'::regtype AND oprright = 'spoint'::regtype; + +/* PG17: ALTER OPERATOR = (spoint, spoint) SET (HASHES); */ + +CREATE OPERATOR CLASS spoint_hash_ops + DEFAULT FOR TYPE spoint USING hash + AS + OPERATOR 1 = (spoint, spoint), + FUNCTION 1 spoint_hash32(spoint); diff --git a/sql/index.sql b/sql/index.sql index 87131065..19d537b2 100644 --- a/sql/index.sql +++ b/sql/index.sql @@ -76,3 +76,14 @@ EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1), SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>'; EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)'; + +-- test hash opclass + +CREATE TABLE spheretmp1c AS TABLE spheretmp1; + +SELECT p FROM spheretmp1c WHERE p <@ scircle '<(1,1),0.2>' ORDER BY p::text; +WITH points AS (SELECT DISTINCT p FROM spheretmp1c WHERE p <@ scircle '<(1,1),0.2>') + SELECT p FROM points ORDER BY p::text; + +CREATE INDEX spheretmp1c_hash_idx ON spheretmp1c USING hash(p); +EXPLAIN (COSTS OFF) SELECT * FROM spheretmp1c WHERE p = '(0.67 , 0.97)'; diff --git a/src/point.c b/src/point.c index 498ee5e2..f4df15c0 100644 --- a/src/point.c +++ b/src/point.c @@ -16,6 +16,7 @@ PG_FUNCTION_INFO_V1(spherepoint_y); PG_FUNCTION_INFO_V1(spherepoint_z); PG_FUNCTION_INFO_V1(spherepoint_xyz); PG_FUNCTION_INFO_V1(spherepoint_equal); +PG_FUNCTION_INFO_V1(spherepoint_hash32); static Oid point_id = InvalidOid; @@ -309,3 +310,13 @@ spherepoint_equal(PG_FUNCTION_ARGS) PG_RETURN_BOOL(spoint_eq(p1, p2)); } + +Datum +spherepoint_hash32(PG_FUNCTION_ARGS) +{ + SPoint *p1 = (SPoint *) PG_GETARG_POINTER(0); + Datum h1 = DirectFunctionCall1(hashfloat8, p1->lat); + Datum h2 = DirectFunctionCall1(hashfloat8, p1->lng); + + PG_RETURN_INT32(DatumGetInt32(h1) ^ DatumGetInt32(h2)); +} diff --git a/src/point.h b/src/point.h index 9269cf78..d7af2281 100644 --- a/src/point.h +++ b/src/point.h @@ -102,4 +102,9 @@ Datum spherepoint_xyz(PG_FUNCTION_ARGS); */ Datum spherepoint_equal(PG_FUNCTION_ARGS); +/* + * Compute a 32-bit hash value of a point. + */ +Datum spherepoint_hash32(PG_FUNCTION_ARGS); + #endif From 1f0f8e4772c58e6e3ccf0e60d39b2bbe7cc38231 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Tue, 7 Nov 2023 20:58:16 +0300 Subject: [PATCH 37/40] Remove Travis-CI tests from the pipeline --- .travis.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d199cf3..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -# run the testsuite on travis-ci.com ---- -# versions to run on -env: - - PG_SUPPORTED_VERSIONS=10 - - PG_SUPPORTED_VERSIONS=11 - - PG_SUPPORTED_VERSIONS=12 - - PG_SUPPORTED_VERSIONS=13 - - PG_SUPPORTED_VERSIONS=14 - - PG_SUPPORTED_VERSIONS=15 - - PG_SUPPORTED_VERSIONS=16 - -language: C -dist: focal - -before_install: - # extra apt.pg.o.sh options added in version 204, travis currently has 199 (2019-11-27) - - sudo apt-get -qq update - - sudo apt-get -y install postgresql-common libhealpix-cxx-dev docbook-xml docbook-xsl libxml2-utils xsltproc fop - -install: - - sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -p -v $PG_SUPPORTED_VERSIONS -i - -script: - - make PROFILE="-Werror" - - sudo make install - - pg_virtualenv make installcheck - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - pg_virtualenv make test - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - pg_virtualenv make crushtest - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - make clean - - make PROFILE="-Werror" USE_HEALPIX=0 - - sudo make USE_HEALPIX=0 install - - pg_virtualenv make USE_HEALPIX=0 installcheck - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - pg_virtualenv make USE_HEALPIX=0 test - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - pg_virtualenv make USE_HEALPIX=0 crushtest - - if test -s regression.diffs; then cat regression.diffs; exit 1; fi - - make -C doc From fcf6b4a19ee012f5bcb32d5f456eccb703d76bc8 Mon Sep 17 00:00:00 2001 From: Vitaly Davydov Date: Wed, 8 Nov 2023 13:32:07 +0300 Subject: [PATCH 38/40] Update copyright file to present --- COPYRIGHT.pg_sphere | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/COPYRIGHT.pg_sphere b/COPYRIGHT.pg_sphere index 61a2e1f7..77532605 100644 --- a/COPYRIGHT.pg_sphere +++ b/COPYRIGHT.pg_sphere @@ -1,4 +1,4 @@ -Copyright (c) 2003-2017, pgSphere development team +Copyright (c) 2003-2023, pgSphere development team All rights reserved. Redistribution and use in source and binary forms, with or without @@ -24,4 +24,3 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - From c0f824b3b0791a7e396646a503c35c6254d739af Mon Sep 17 00:00:00 2001 From: Vitaly Date: Thu, 9 Nov 2023 11:12:59 +0300 Subject: [PATCH 39/40] Add "pgindent" rule for make to run pgindent (#71) Add "pgindent" rule for make to run pgindent --- Makefile | 28 ++++- pgindent-excludes.list | 1 + pgindent-typedefs.list | 236 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 pgindent-excludes.list create mode 100644 pgindent-typedefs.list diff --git a/Makefile b/Makefile index 20abe66c..b8aca358 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,9 @@ include Makefile.common.mk RELEASE_SQL = $(EXTENSION)--$(PGSPHERE_VERSION).sql USE_PGXS = 1 -USE_HEALPIX =? 1 +USE_HEALPIX ?= 1 +PGINDENT ?= pgindent +PGBSDINDENT ?= pg_bsd_indent # the base dir name may be changed depending on git clone command SRC_DIR = $(shell basename $(shell pwd)) @@ -223,3 +225,27 @@ endif dist : clean sparse.c sscan.c find . -name '*~' -type f -exec rm {} \; cd .. && tar --transform s/$(SRC_DIR)/pgsphere-$(PGSPHERE_VERSION)/ --exclude CVS --exclude .git -czf pgsphere-$(PGSPHERE_VERSION).tar.gz $(SRC_DIR) && cd - + +# To use pgindent, set the PATH environment variable to include the directories +# containing the binaries pgindent and pg_bsd_indent. It is important to +# utilize a specific version of pg_bsd_indent, which sources can be found +# in the /src/tools/pg_bsd_indent directory, where +# is the root directory of the PostgreSQL project source tree. +# +# The sources of the utilities can be found in the following directories: +# - /src/tools/pgindent +# - /src/tools/pg_bsd_indent +# +# pgindent-typedefs.list should be updated every time after implementing +# new types and introducing new typedefs in the code. For details how +# to update pgindent-typedefs.list and for other information about pgindent, +# please, read the doc: /src/tools/pgindent/README. +# +# pgindent-excludes.list is used to specify files to be ignored. +# +pgindent: + $(PGINDENT) \ + --typedefs=pgindent-typedefs.list \ + --excludes=pgindent-excludes.list \ + --indent=${PGBSDINDENT} \ + src diff --git a/pgindent-excludes.list b/pgindent-excludes.list new file mode 100644 index 00000000..c3add5cc --- /dev/null +++ b/pgindent-excludes.list @@ -0,0 +1 @@ +pgs_process_moc.h diff --git a/pgindent-typedefs.list b/pgindent-typedefs.list new file mode 100644 index 00000000..7f2c8fe7 --- /dev/null +++ b/pgindent-typedefs.list @@ -0,0 +1,236 @@ +align_val_t +allocator_type +__alloc_rebind +ArrayType +AttrDefault +AttrNumber +_Base_ptr +BlockNumber +Box3D +BpChar +bpoint +BrinDesc +BrinOpcInfo +brin_serialize_callback_type +BrinValues +__builtin_va_list +_Char_alloc_type +char_type +CommonEntry +__compar_fn_t +ConsiderSplitContext +_Const_Base_ptr +__const_iterator +const_iterator +_Const_Link_type +const_pointer +ConstrCheck +const_reference +const_reverse_iterator +const_void_pointer +coord_t +CPoint +Datum +difference_type +_DistanceType +div_t +DomainConstraintCache +double_t +__dso_handle +__enable_if_t +false> +false_type +__FILE +FILE +first_type +flex_int16_t +flex_uint8_t +float4 +float8 +float_t +FmgrInfo +fmNodePtr +FormData_pg_attribute +__fpos_t +fpos_t +FunctionCallInfo +GISTENTRY +GistEntryVector +GISTPageOpaque +GISTPageOpaqueData +GIST_SPLITVEC +GiSTSPointKey +__gnuc_va_list +Healpix_Base2 +hpint64 +insert_return_type +int16 +__int16_t +int16_t +int32 +__int32_t +int32_t +int64 +__int64_t +int64_t +int8 +__int8_t +int8_t +int_fast16_t +int_fast32_t +int_fast64_t +int_fast8_t +__int_least16_t +int_least16_t +__int_least32_t +int_least32_t +__int_least64_t +int_least64_t +__int_least8_t +int_least8_t +__intmax_t +intmax_t +intptr_t +int_type +_IO_lock_t +iostate +ItemIdData +iterator +iterator_category +iterator_type +key_compare +key_type +layout_vec +ldiv_t +_Link_type +lldiv_t +LocationIndex +__make_not_void +map_const_iter +map_iterator +mapped_type +map_rev_iter +max_align_t +__mbstate_t +mbstate_t +MemoryContext +moc_interval +moc_map +moc_map_entry +moc_out_data +moc_tree_entry +NameData +_Node_allocator +NodeTag +node_type +NullableDatum +nullptr_t +__off64_t +OffsetNumber +__off_t +Oid +ostream +__ostream_type +other +output_map +Page +PageGistNSN +PageHeader +PageHeaderData +PageXLogRecPtr +Pg_finfo_record +PGFunction +Pg_magic_struct +pgs_error_handler +phasevec +Point +Point3D +__pointer +pointer +Pointer +ptrdiff_t +__ptr_rebind +rebind +rebind_alloc +reference +Relation +_Rep_type +reverse_iterator +rintv_iter +rnode_iter +rtype +SBOX +SCIRCLE +second_type +_Self +SELLIPSE +SEuler +Size +size_t +size_type +SLine +Smoc +SPATH +SplitInterval +SPoint +SPOLY +StrategyNumber +streamsize +string +__sv_type +t_ang +tdiff +text +_Tp_alloc_type +TransactionId +true_type +tsize +TupleConstr +TupleDesc +__type +type +TypeCacheEntry +uchar +uint16 +__uint16_t +uint16_t +uint32 +__uint32_t +uint32_t +uint64 +__uint64_t +uint64_t +uint8 +__uint8_t +uint8_t +uint_fast16_t +uint_fast32_t +uint_fast64_t +uint_fast8_t +__uint_least16_t +uint_least16_t +__uint_least32_t +uint_least32_t +__uint_least64_t +uint_least64_t +__uint_least8_t +uint_least8_t +__uintmax_t +uintmax_t +uintptr_t +va_list +value_type +varattrib_4b +vec3 +Vector3D +wctrans_t +wctype_t +wint_t +YY_BUFFER_STATE +YY_CHAR +yy_size_t +yy_state_type +YYSTYPE +yytype_int16 +yytype_int8 +yytype_uint8 From 94e498dfa013d13f55155c8b26c2150de1f41e9d Mon Sep 17 00:00:00 2001 From: Vitaly Date: Thu, 9 Nov 2023 12:33:51 +0300 Subject: [PATCH 40/40] Adjust release version 1.3.2 to 1.4.0 (#105) --- Makefile | 8 ++++---- Makefile.common.mk | 2 +- expected/init.out | 2 +- pg_sphere.control | 2 +- ...1.3.1--1.3.2.sql.in => pg_sphere--1.3.1--1.4.0.sql.in} | 0 5 files changed, 7 insertions(+), 7 deletions(-) rename upgrade_scripts/{pg_sphere--1.3.1--1.3.2.sql.in => pg_sphere--1.3.1--1.4.0.sql.in} (100%) diff --git a/Makefile b/Makefile index b8aca358..5b1c4e26 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ DATA_built = $(RELEASE_SQL) \ pg_sphere--1.2.2--1.2.3.sql \ pg_sphere--1.2.3--1.3.0.sql \ pg_sphere--1.3.0--1.3.1.sql \ - pg_sphere--1.3.1--1.3.2.sql + pg_sphere--1.3.1--1.4.0.sql DOCS = README.pg_sphere COPYRIGHT.pg_sphere TESTS = tables points euler circle line ellipse poly path box \ @@ -194,14 +194,14 @@ pg_sphere--1.3.0--1.3.1.sql: cat upgrade_scripts/$@.in > $@ ifeq ($(has_support_functions),y) -pg_sphere--1.3.1--1.3.2.sql: pgs_gist_support.sql.in +pg_sphere--1.3.1--1.4.0.sql: pgs_gist_support.sql.in endif ifneq ($(USE_HEALPIX),0) ifeq ($(has_index_options),y) -pg_sphere--1.3.1--1.3.2.sql: pgs_moc_options.sql.in +pg_sphere--1.3.1--1.4.0.sql: pgs_moc_options.sql.in endif endif -pg_sphere--1.3.1--1.3.2.sql: pgs_circle_sel.sql.in pgs_hash.sql.in +pg_sphere--1.3.1--1.4.0.sql: pgs_circle_sel.sql.in pgs_hash.sql.in cat upgrade_scripts/$@.in $^ > $@ # end of local stuff diff --git a/Makefile.common.mk b/Makefile.common.mk index 6387bea9..aaaf096f 100644 --- a/Makefile.common.mk +++ b/Makefile.common.mk @@ -5,4 +5,4 @@ #---------------------------------------------------------------------------- EXTENSION := pg_sphere -PGSPHERE_VERSION := 1.3.2 +PGSPHERE_VERSION := 1.4.0 diff --git a/expected/init.out b/expected/init.out index f5e092bf..e4dcdfda 100644 --- a/expected/init.out +++ b/expected/init.out @@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere; select pg_sphere_version(); pg_sphere_version ------------------- - 1.3.2 + 1.4.0 (1 row) diff --git a/pg_sphere.control b/pg_sphere.control index d9f2ccc9..41ae5a7a 100644 --- a/pg_sphere.control +++ b/pg_sphere.control @@ -1,5 +1,5 @@ # pg_sphere extension comment = 'spherical objects with useful functions, operators and index support' -default_version = '1.3.2' +default_version = '1.4.0' module_pathname = '$libdir/pg_sphere' relocatable = true diff --git a/upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in b/upgrade_scripts/pg_sphere--1.3.1--1.4.0.sql.in similarity index 100% rename from upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in rename to upgrade_scripts/pg_sphere--1.3.1--1.4.0.sql.in