diff --git a/c-deps/geos b/c-deps/geos index 6c5e20a1e597..385ac9b562c2 160000 --- a/c-deps/geos +++ b/c-deps/geos @@ -1 +1 @@ -Subproject commit 6c5e20a1e59714a719b1bba2463feb5888ca42fa +Subproject commit 385ac9b562c2847dc059109e0435a80e68a0c8b6 diff --git a/c-deps/geos-rebuild b/c-deps/geos-rebuild index cb267a9afe3b..e682bb627eae 100644 --- a/c-deps/geos-rebuild +++ b/c-deps/geos-rebuild @@ -1,4 +1,4 @@ Bump the version below when changing geos configure flags. Search for "BUILD ARTIFACT CACHING" in build/common.mk for rationale. -3 +4 diff --git a/cloud/kubernetes/bring-your-own-certs/client.yaml b/cloud/kubernetes/bring-your-own-certs/client.yaml index c3b94576b4e5..9fb69a45aad4 100644 --- a/cloud/kubernetes/bring-your-own-certs/client.yaml +++ b/cloud/kubernetes/bring-your-own-certs/client.yaml @@ -19,7 +19,7 @@ spec: serviceAccountName: cockroachdb containers: - name: cockroachdb-client - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 # Keep a pod open indefinitely so kubectl exec can be used to get a shell to it # and run cockroach client commands, such as cockroach sql, cockroach node status, etc. command: diff --git a/cloud/kubernetes/bring-your-own-certs/cockroachdb-statefulset.yaml b/cloud/kubernetes/bring-your-own-certs/cockroachdb-statefulset.yaml index 8196360116fd..eddeb1c84a88 100644 --- a/cloud/kubernetes/bring-your-own-certs/cockroachdb-statefulset.yaml +++ b/cloud/kubernetes/bring-your-own-certs/cockroachdb-statefulset.yaml @@ -152,7 +152,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/cloud/kubernetes/client-secure.yaml b/cloud/kubernetes/client-secure.yaml index f4a910a7277a..1c70986fa9c6 100644 --- a/cloud/kubernetes/client-secure.yaml +++ b/cloud/kubernetes/client-secure.yaml @@ -31,7 +31,7 @@ spec: mountPath: /cockroach-certs containers: - name: cockroachdb-client - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/cluster-init-secure.yaml b/cloud/kubernetes/cluster-init-secure.yaml index 6885a47b0a00..6ca7e10f49ca 100644 --- a/cloud/kubernetes/cluster-init-secure.yaml +++ b/cloud/kubernetes/cluster-init-secure.yaml @@ -33,7 +33,7 @@ spec: mountPath: /cockroach-certs containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/cluster-init.yaml b/cloud/kubernetes/cluster-init.yaml index b2aba7a57bf5..00da483a65a6 100644 --- a/cloud/kubernetes/cluster-init.yaml +++ b/cloud/kubernetes/cluster-init.yaml @@ -9,7 +9,7 @@ spec: spec: containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent command: - "/cockroach/cockroach" diff --git a/cloud/kubernetes/cockroachdb-statefulset-secure.yaml b/cloud/kubernetes/cockroachdb-statefulset-secure.yaml index 56deed0813da..841e7c6cec1b 100644 --- a/cloud/kubernetes/cockroachdb-statefulset-secure.yaml +++ b/cloud/kubernetes/cockroachdb-statefulset-secure.yaml @@ -194,7 +194,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: Change these to appropriate values for the hardware that you're running. You can see # the amount of allocatable resources on each of your Kubernetes nodes by running: diff --git a/cloud/kubernetes/cockroachdb-statefulset.yaml b/cloud/kubernetes/cockroachdb-statefulset.yaml index 43d4d03100e8..aa50d24f3d5b 100644 --- a/cloud/kubernetes/cockroachdb-statefulset.yaml +++ b/cloud/kubernetes/cockroachdb-statefulset.yaml @@ -97,7 +97,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: Change these to appropriate values for the hardware that you're running. You can see # the amount of allocatable resources on each of your Kubernetes nodes by running: diff --git a/cloud/kubernetes/multiregion/client-secure.yaml b/cloud/kubernetes/multiregion/client-secure.yaml index de356e60bb75..6eee2172c70e 100644 --- a/cloud/kubernetes/multiregion/client-secure.yaml +++ b/cloud/kubernetes/multiregion/client-secure.yaml @@ -8,7 +8,7 @@ spec: serviceAccountName: cockroachdb containers: - name: cockroachdb-client - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/multiregion/cluster-init-secure.yaml b/cloud/kubernetes/multiregion/cluster-init-secure.yaml index b21d6e3e22f3..767acd36a047 100644 --- a/cloud/kubernetes/multiregion/cluster-init-secure.yaml +++ b/cloud/kubernetes/multiregion/cluster-init-secure.yaml @@ -10,7 +10,7 @@ spec: serviceAccountName: cockroachdb containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/multiregion/cockroachdb-statefulset-secure.yaml b/cloud/kubernetes/multiregion/cockroachdb-statefulset-secure.yaml index a0fcb470c1d5..d08df3d49cc3 100644 --- a/cloud/kubernetes/multiregion/cockroachdb-statefulset-secure.yaml +++ b/cloud/kubernetes/multiregion/cockroachdb-statefulset-secure.yaml @@ -166,7 +166,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/cloud/kubernetes/multiregion/eks/dns-lb-eks.yaml b/cloud/kubernetes/multiregion/eks/dns-lb-eks.yaml index 773460299d49..e80c63f29d39 100644 --- a/cloud/kubernetes/multiregion/eks/dns-lb-eks.yaml +++ b/cloud/kubernetes/multiregion/eks/dns-lb-eks.yaml @@ -16,4 +16,4 @@ spec: selector: k8s-app: kube-dns type: LoadBalancer - loadBalancerSourceRanges: ["0.0.0.0/0"] \ No newline at end of file + loadBalancerSourceRanges: ["0.0.0.0/0"] diff --git a/cloud/kubernetes/performance/cockroachdb-daemonset-insecure.yaml b/cloud/kubernetes/performance/cockroachdb-daemonset-insecure.yaml index d19df8822a43..7a775e4f8113 100644 --- a/cloud/kubernetes/performance/cockroachdb-daemonset-insecure.yaml +++ b/cloud/kubernetes/performance/cockroachdb-daemonset-insecure.yaml @@ -81,7 +81,7 @@ spec: hostNetwork: true containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: If you configured taints to give CockroachDB exclusive access to nodes, feel free # to remove the requests and limits sections. If you didn't, you'll need to change these to diff --git a/cloud/kubernetes/performance/cockroachdb-daemonset-secure.yaml b/cloud/kubernetes/performance/cockroachdb-daemonset-secure.yaml index 9820a426ef5b..1d0fddb2611f 100644 --- a/cloud/kubernetes/performance/cockroachdb-daemonset-secure.yaml +++ b/cloud/kubernetes/performance/cockroachdb-daemonset-secure.yaml @@ -197,7 +197,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: If you configured taints to give CockroachDB exclusive access to nodes, feel free # to remove the requests and limits sections. If you didn't, you'll need to change these to diff --git a/cloud/kubernetes/performance/cockroachdb-statefulset-insecure.yaml b/cloud/kubernetes/performance/cockroachdb-statefulset-insecure.yaml index 5e06a399d8ba..72d6d12d5e2a 100644 --- a/cloud/kubernetes/performance/cockroachdb-statefulset-insecure.yaml +++ b/cloud/kubernetes/performance/cockroachdb-statefulset-insecure.yaml @@ -140,7 +140,7 @@ spec: - name: cockroachdb # NOTE: Always use the most recent version of CockroachDB for the best # performance and reliability. - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: Change these to appropriate values for the hardware that you're running. You can see # the amount of allocatable resources on each of your Kubernetes nodes by running: diff --git a/cloud/kubernetes/performance/cockroachdb-statefulset-secure.yaml b/cloud/kubernetes/performance/cockroachdb-statefulset-secure.yaml index 9a8483763ffa..1a6570364eb2 100644 --- a/cloud/kubernetes/performance/cockroachdb-statefulset-secure.yaml +++ b/cloud/kubernetes/performance/cockroachdb-statefulset-secure.yaml @@ -231,7 +231,7 @@ spec: - name: cockroachdb # NOTE: Always use the most recent version of CockroachDB for the best # performance and reliability. - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent # TODO: Change these to appropriate values for the hardware that you're running. You can see # the amount of allocatable resources on each of your Kubernetes nodes by running: diff --git a/cloud/kubernetes/v1.6/client-secure.yaml b/cloud/kubernetes/v1.6/client-secure.yaml index f4a910a7277a..1c70986fa9c6 100644 --- a/cloud/kubernetes/v1.6/client-secure.yaml +++ b/cloud/kubernetes/v1.6/client-secure.yaml @@ -31,7 +31,7 @@ spec: mountPath: /cockroach-certs containers: - name: cockroachdb-client - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/v1.6/cluster-init-secure.yaml b/cloud/kubernetes/v1.6/cluster-init-secure.yaml index 6885a47b0a00..6ca7e10f49ca 100644 --- a/cloud/kubernetes/v1.6/cluster-init-secure.yaml +++ b/cloud/kubernetes/v1.6/cluster-init-secure.yaml @@ -33,7 +33,7 @@ spec: mountPath: /cockroach-certs containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/v1.6/cluster-init.yaml b/cloud/kubernetes/v1.6/cluster-init.yaml index b2aba7a57bf5..00da483a65a6 100644 --- a/cloud/kubernetes/v1.6/cluster-init.yaml +++ b/cloud/kubernetes/v1.6/cluster-init.yaml @@ -9,7 +9,7 @@ spec: spec: containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent command: - "/cockroach/cockroach" diff --git a/cloud/kubernetes/v1.6/cockroachdb-statefulset-secure.yaml b/cloud/kubernetes/v1.6/cockroachdb-statefulset-secure.yaml index 44930c0c59fa..8a2f6ccbaa10 100644 --- a/cloud/kubernetes/v1.6/cockroachdb-statefulset-secure.yaml +++ b/cloud/kubernetes/v1.6/cockroachdb-statefulset-secure.yaml @@ -177,7 +177,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/cloud/kubernetes/v1.6/cockroachdb-statefulset.yaml b/cloud/kubernetes/v1.6/cockroachdb-statefulset.yaml index 0f5ae58567f0..a9b069d2f20c 100644 --- a/cloud/kubernetes/v1.6/cockroachdb-statefulset.yaml +++ b/cloud/kubernetes/v1.6/cockroachdb-statefulset.yaml @@ -80,7 +80,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/cloud/kubernetes/v1.7/client-secure.yaml b/cloud/kubernetes/v1.7/client-secure.yaml index f4a910a7277a..1c70986fa9c6 100644 --- a/cloud/kubernetes/v1.7/client-secure.yaml +++ b/cloud/kubernetes/v1.7/client-secure.yaml @@ -31,7 +31,7 @@ spec: mountPath: /cockroach-certs containers: - name: cockroachdb-client - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/v1.7/cluster-init-secure.yaml b/cloud/kubernetes/v1.7/cluster-init-secure.yaml index 6885a47b0a00..6ca7e10f49ca 100644 --- a/cloud/kubernetes/v1.7/cluster-init-secure.yaml +++ b/cloud/kubernetes/v1.7/cluster-init-secure.yaml @@ -33,7 +33,7 @@ spec: mountPath: /cockroach-certs containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent volumeMounts: - name: client-certs diff --git a/cloud/kubernetes/v1.7/cluster-init.yaml b/cloud/kubernetes/v1.7/cluster-init.yaml index b2aba7a57bf5..00da483a65a6 100644 --- a/cloud/kubernetes/v1.7/cluster-init.yaml +++ b/cloud/kubernetes/v1.7/cluster-init.yaml @@ -9,7 +9,7 @@ spec: spec: containers: - name: cluster-init - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent command: - "/cockroach/cockroach" diff --git a/cloud/kubernetes/v1.7/cockroachdb-statefulset-secure.yaml b/cloud/kubernetes/v1.7/cockroachdb-statefulset-secure.yaml index ab3c2fb8a6fc..f93edc0053d1 100644 --- a/cloud/kubernetes/v1.7/cockroachdb-statefulset-secure.yaml +++ b/cloud/kubernetes/v1.7/cockroachdb-statefulset-secure.yaml @@ -189,7 +189,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/cloud/kubernetes/v1.7/cockroachdb-statefulset.yaml b/cloud/kubernetes/v1.7/cockroachdb-statefulset.yaml index b2bdeb316314..249c40a7a8bd 100644 --- a/cloud/kubernetes/v1.7/cockroachdb-statefulset.yaml +++ b/cloud/kubernetes/v1.7/cockroachdb-statefulset.yaml @@ -92,7 +92,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: cockroachdb - image: cockroachdb/cockroach:v20.1.4 + image: cockroachdb/cockroach:v20.1.5 imagePullPolicy: IfNotPresent ports: - containerPort: 26257 diff --git a/docs/generated/sql/bnf/stmt_block.bnf b/docs/generated/sql/bnf/stmt_block.bnf index 5332184aa5bc..8d8c9efeb4bc 100644 --- a/docs/generated/sql/bnf/stmt_block.bnf +++ b/docs/generated/sql/bnf/stmt_block.bnf @@ -739,7 +739,6 @@ unreserved_keyword ::= | 'AT' | 'ATTRIBUTE' | 'AUTOMATIC' - | 'AUTHORIZATION' | 'BACKUP' | 'BACKUPS' | 'BEFORE' @@ -1215,6 +1214,8 @@ create_index_stmt ::= create_schema_stmt ::= 'CREATE' 'SCHEMA' schema_name | 'CREATE' 'SCHEMA' 'IF' 'NOT' 'EXISTS' schema_name + | 'CREATE' 'SCHEMA' opt_schema_name 'AUTHORIZATION' role_spec + | 'CREATE' 'SCHEMA' 'IF' 'NOT' 'EXISTS' opt_schema_name 'AUTHORIZATION' role_spec create_table_stmt ::= 'CREATE' opt_persistence_temp_table 'TABLE' table_name '(' opt_table_elem_list ')' opt_interleave opt_partition_by @@ -1690,6 +1691,9 @@ opt_partition_by ::= partition_by | +opt_schema_name ::= + opt_name + opt_persistence_temp_table ::= opt_temp | 'LOCAL' 'TEMPORARY' @@ -2217,7 +2221,8 @@ row_source_extension_stmt ::= | upsert_stmt type_func_name_no_crdb_extra_keyword ::= - 'COLLATION' + 'AUTHORIZATION' + | 'COLLATION' | 'CROSS' | 'FULL' | 'INNER' diff --git a/docs/generated/sql/functions.md b/docs/generated/sql/functions.md index 8d1ffd2bfaf4..f23aa1e20503 100644 --- a/docs/generated/sql/functions.md +++ b/docs/generated/sql/functions.md @@ -1643,6 +1643,9 @@ The paths themselves are given in the direction of the first geometry.
st_symdifference(geometry_a: geometry, geometry_b: geometry) → geometry
Returns the symmetric difference of both geometries.
This function utilizes the GEOS module.
st_symmetricdifference(geometry_a: geometry, geometry_b: geometry) → geometry
Returns the symmetric difference of both geometries.
+This function utilizes the GEOS module.
+st_touches(geometry_a: geometry, geometry_b: geometry) → bool
Returns true if the only points in common between geometry_a and geometry_b are on the boundary. Note points do not touch other points.
This function utilizes the GEOS module.
This function variant will attempt to utilize any available geospatial index.
diff --git a/go.mod b/go.mod index 670bdd0e551b..3b5cde065bab 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55 github.com/cockroachdb/gostdlib v1.13.0 github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f - github.com/cockroachdb/pebble v0.0.0-20200824180455-875ca32696b6 + github.com/cockroachdb/pebble v0.0.0-20200831143935-e6a9f9a3c936 github.com/cockroachdb/redact v1.0.2 github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 diff --git a/go.sum b/go.sum index a4f816d45cb5..63cce6d9483b 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,8 @@ github.com/cockroachdb/grpc-gateway v1.14.6-0.20200519165156-52697fc4a249 h1:pZu github.com/cockroachdb/grpc-gateway v1.14.6-0.20200519165156-52697fc4a249/go.mod h1:UJ0EZAp832vCd54Wev9N1BMKEyvcZ5+IM0AwDrnlkEc= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/cockroachdb/pebble v0.0.0-20200824180455-875ca32696b6 h1:erL/39EP/sn3v5oEwYHCPcewADqwQhgzXGRbaRilAjc= -github.com/cockroachdb/pebble v0.0.0-20200824180455-875ca32696b6/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ= +github.com/cockroachdb/pebble v0.0.0-20200831143935-e6a9f9a3c936 h1:MaPvrDBbbWMzmI3uuBMKvcpDfZDY/QHx22T1pb9J6YI= +github.com/cockroachdb/pebble v0.0.0-20200831143935-e6a9f9a3c936/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ= github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3 h1:2+dpIJzYMSbLi0587YXpi8tOJT52qCOI/1I0UNThc/I= github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/redact v1.0.2 h1:bRktqHBXPqI+9bkOx0ikn9RS09G9k83oAdLx6rXRVTQ= diff --git a/pkg/cmd/roachprod/install/install.go b/pkg/cmd/roachprod/install/install.go index afa8964ba293..6699189511bf 100644 --- a/pkg/cmd/roachprod/install/install.go +++ b/pkg/cmd/roachprod/install/install.go @@ -39,7 +39,7 @@ sudo service cassandra stop; sudo mkdir -p "${thrift_dir}" sudo chmod 777 "${thrift_dir}" cd "${thrift_dir}" - curl "https://downloads.apache.org/thrift/0.10.0/thrift-0.10.0.tar.gz" | sudo tar xvz --strip-components 1 + curl "https://downloads.apache.org/thrift/0.13.0/thrift-0.13.0.tar.gz" | sudo tar xvz --strip-components 1 sudo ./configure --prefix=/usr sudo make -j$(nproc) sudo make install @@ -54,7 +54,8 @@ sudo service cassandra stop; sudo rm -rf "${charybde_dir}" "${nemesis_path}" /usr/local/bin/charybdefs{,-nemesis} sudo mkdir -p "${charybde_dir}" sudo chmod 777 "${charybde_dir}" - git clone --depth 1 "https://github.com/scylladb/charybdefs.git" "${charybde_dir}" + # TODO(bilal): Change URL back to scylladb/charybdefs once https://github.com/scylladb/charybdefs/pull/21 is merged. + git clone --depth 1 "https://github.com/itsbilal/charybdefs.git" "${charybde_dir}" cd "${charybde_dir}" thrift -r --gen cpp server.thrift diff --git a/pkg/cmd/roachtest/acceptance.go b/pkg/cmd/roachtest/acceptance.go index 0a9ef885ee99..61f919347622 100644 --- a/pkg/cmd/roachtest/acceptance.go +++ b/pkg/cmd/roachtest/acceptance.go @@ -26,12 +26,8 @@ func registerAcceptance(r *testRegistry) { // Sorted. Please keep it that way. {name: "bank/cluster-recovery", fn: runBankClusterRecovery}, {name: "bank/node-restart", fn: runBankNodeRestart}, - { - name: "bank/zerosum-splits", fn: runBankNodeZeroSum, - skip: "https://github.com/cockroachdb/cockroach/issues/33683 (runs into " + - " various errors during its rebalances, see IsExpectedRelocateError)", - }, - // {"bank/zerosum-restart", runBankZeroSumRestart}, + {name: "bank/zerosum-splits", fn: runBankNodeZeroSum}, + {name: "bank/zerosum-restart", fn: runBankZeroSumRestart}, {name: "build-info", fn: runBuildInfo}, {name: "build-analyze", fn: runBuildAnalyze}, {name: "cli/node-status", fn: runCLINodeStatus}, diff --git a/pkg/cmd/roachtest/cli.go b/pkg/cmd/roachtest/cli.go index 4f05a95898c7..e569a3b0bbaa 100644 --- a/pkg/cmd/roachtest/cli.go +++ b/pkg/cmd/roachtest/cli.go @@ -28,13 +28,8 @@ func runCLINodeStatus(ctx context.Context, t *test, c *cluster) { lastWords := func(s string) []string { var result []string + s = elideInsecureDeprecationNotice(s) lines := strings.Split(s, "\n") - // v20.1 introduces a deprecation notice for --insecure. Skip over it. - // TODO(knz): Remove this when --insecure is dropped. - // See: https://github.com/cockroachdb/cockroach/issues/53404 - if len(lines) > 0 && strings.HasPrefix(lines[0], "Flag --insecure has been deprecated") { - lines = lines[2:] - } for _, line := range lines { words := strings.Fields(line) if n := len(words); n > 0 { diff --git a/pkg/cmd/roachtest/decommission.go b/pkg/cmd/roachtest/decommission.go index dd2485836e80..3617d0a4669c 100644 --- a/pkg/cmd/roachtest/decommission.go +++ b/pkg/cmd/roachtest/decommission.go @@ -902,8 +902,20 @@ func (h *decommTestHelper) recommission( return execCLI(ctx, h.t, h.c, runNode, args...) } +func elideInsecureDeprecationNotice(csvStr string) string { + // v20.1 introduces a deprecation notice for --insecure. Skip over it. + // TODO(knz): Remove this when --insecure is dropped. + // See: https://github.com/cockroachdb/cockroach/issues/53404 + lines := strings.SplitN(csvStr, "\n", 3) + if len(lines) > 0 && strings.HasPrefix(lines[0], "Flag --insecure has been deprecated") { + csvStr = lines[2] + } + return csvStr +} + // getCsvNumCols returns the number of columns in the given csv string. func (h *decommTestHelper) getCsvNumCols(csvStr string) (cols int) { + csvStr = elideInsecureDeprecationNotice(csvStr) reader := csv.NewReader(strings.NewReader(csvStr)) records, err := reader.Read() if err != nil { @@ -922,6 +934,7 @@ func (h *decommTestHelper) matchCSV(csvStr string, matchColRow [][]string) (err } }() + csvStr = elideInsecureDeprecationNotice(csvStr) reader := csv.NewReader(strings.NewReader(csvStr)) reader.FieldsPerRecord = -1 records, err := reader.ReadAll() diff --git a/pkg/cmd/roachtest/election.go b/pkg/cmd/roachtest/election.go index e243e89d1383..1d649371f96d 100644 --- a/pkg/cmd/roachtest/election.go +++ b/pkg/cmd/roachtest/election.go @@ -14,6 +14,7 @@ import ( "context" "time" + "github.com/cockroachdb/cockroach/pkg/testutils/skip" "github.com/cockroachdb/cockroach/pkg/util/timeutil" ) @@ -21,9 +22,10 @@ func registerElectionAfterRestart(r *testRegistry) { r.Add(testSpec{ Name: "election-after-restart", Owner: OwnerKV, - Skip: "https://github.com/cockroachdb/cockroach/issues/35047", Cluster: makeClusterSpec(3), Run: func(ctx context.Context, t *test, c *cluster) { + skip.UnderRace(t, "race builds make this test exceed its timeout") + t.Status("starting up") c.Put(ctx, cockroach, "./cockroach") c.Start(ctx, t) diff --git a/pkg/cmd/roachtest/kv.go b/pkg/cmd/roachtest/kv.go index 3a50bd3a078b..3d756c9748e2 100644 --- a/pkg/cmd/roachtest/kv.go +++ b/pkg/cmd/roachtest/kv.go @@ -23,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" + "github.com/cockroachdb/cockroach/pkg/testutils/skip" "github.com/cockroachdb/cockroach/pkg/ts/tspb" "github.com/cockroachdb/cockroach/pkg/util/httputil" "github.com/cockroachdb/cockroach/pkg/util/timeutil" @@ -349,11 +350,12 @@ func registerKVQuiescenceDead(r *testRegistry) { func registerKVGracefulDraining(r *testRegistry) { r.Add(testSpec{ - Skip: "https://github.com/cockroachdb/cockroach/issues/33501", Name: "kv/gracefuldraining/nodes=3", Owner: OwnerKV, Cluster: makeClusterSpec(4), Run: func(ctx context.Context, t *test, c *cluster) { + skip.UnderRace(t, "race builds make this test exceed its timeout") + nodes := c.spec.NodeCount - 1 c.Put(ctx, cockroach, "./cockroach", c.Range(1, nodes)) c.Put(ctx, workload, "./workload", c.Node(nodes+1)) diff --git a/pkg/cmd/roachtest/test.go b/pkg/cmd/roachtest/test.go index 98e317b5bfe0..8e6992176172 100644 --- a/pkg/cmd/roachtest/test.go +++ b/pkg/cmd/roachtest/test.go @@ -21,6 +21,7 @@ import ( "strings" "time" + "github.com/cockroachdb/cockroach/pkg/testutils/skip" "github.com/cockroachdb/cockroach/pkg/util/syncutil" "github.com/cockroachdb/cockroach/pkg/util/timeutil" "github.com/cockroachdb/cockroach/pkg/util/version" @@ -232,11 +233,24 @@ func (t *test) WorkerProgress(frac float64) { t.progress(goid.Get(), frac) } -// Skip records msg into t.spec.Skip and calls panic(errTestFatal) - thus -// interrupting the running of the test. -func (t *test) Skip(msg string, details string) { - t.spec.Skip = msg - t.spec.SkipDetails = details +var _ skip.SkippableTest = (*test)(nil) + +// Skip skips the test. The first argument if any is the main message. +// The remaining argument, if any, form the details. +// This implements the skip.SkippableTest interface. +func (t *test) Skip(args ...interface{}) { + if len(args) > 0 { + t.spec.Skip = fmt.Sprint(args[0]) + args = args[1:] + } + t.spec.SkipDetails = fmt.Sprint(args...) + panic(errTestFatal) +} + +// Skipf skips the test. The formatted message becomes the skip reason. +// This implements the skip.SkippableTest interface. +func (t *test) Skipf(format string, args ...interface{}) { + t.spec.Skip = fmt.Sprintf(format, args...) panic(errTestFatal) } diff --git a/pkg/security/ocsp.go b/pkg/security/ocsp.go index afd7173b7ddc..334116f150a1 100644 --- a/pkg/security/ocsp.go +++ b/pkg/security/ocsp.go @@ -18,6 +18,7 @@ import ( "io/ioutil" "net/http" + "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/util/contextutil" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/errors" @@ -39,6 +40,9 @@ func makeOCSPVerifier(settings TLSSettings) func([][]byte, [][]*x509.Certificate return contextutil.RunWithTimeout(context.Background(), "OCSP verification", settings.ocspTimeout(), func(ctx context.Context) error { + // Per-conn telemetry counter. + telemetry.Inc(ocspChecksCounter) + errG, gCtx := errgroup.WithContext(ctx) for _, chain := range verifiedChains { // Ignore the last cert in the chain; it's the root and if it @@ -60,10 +64,26 @@ func makeOCSPVerifier(settings TLSSettings) func([][]byte, [][]*x509.Certificate } } +// ocspChecksCounter counts the number of connections that are +// undergoing OCSP validations. This counter exists so that the value +// of ocspCheckWithOCSPServerInCertCounter can be interpreted as a +// percentage. +var ocspChecksCounter = telemetry.GetCounterOnce("server.ocsp.conn-verifications") + +// ocspCheckWithOCSPServerInCert counts the number of certificate +// verifications performed with a populated OCSPServer field in one of +// the certs in the validation chain. +var ocspCheckWithOCSPServerInCertCounter = telemetry.GetCounterOnce("server.ocsp.cert-verifications") + func verifyOCSP(ctx context.Context, settings TLSSettings, cert, issuer *x509.Certificate) error { if len(cert.OCSPServer) == 0 { return nil } + + // Per-cert telemetry counter. We only count requests when there is + // an OCSP server to check in the first place. + telemetry.Inc(ocspCheckWithOCSPServerInCertCounter) + var errs []error for _, url := range cert.OCSPServer { ok, err := queryOCSP(ctx, url, cert, issuer) diff --git a/pkg/sql/conn_executor_exec.go b/pkg/sql/conn_executor_exec.go index 9ced7c785ae6..2c441bd9c6da 100644 --- a/pkg/sql/conn_executor_exec.go +++ b/pkg/sql/conn_executor_exec.go @@ -244,7 +244,10 @@ func (ex *connExecutor) execStmtInOpenState( ex.incrementExecutedStmtCounter(stmt) } }() + + ex.state.mu.Lock() ex.state.mu.stmtCount++ + ex.state.mu.Unlock() os := ex.machine.CurState().(stateOpen) diff --git a/pkg/sql/create_schema.go b/pkg/sql/create_schema.go index 7e1ba5de4b9d..a8dd9c8c313d 100644 --- a/pkg/sql/create_schema.go +++ b/pkg/sql/create_schema.go @@ -50,8 +50,13 @@ func (p *planner) createUserDefinedSchema(params runParams, n *tree.CreateSchema return pgerror.New(pgcode.InvalidObjectDefinition, "cannot create schemas in the system database") } + schemaName := n.Schema + if n.Schema == "" { + schemaName = n.AuthRole + } + // Ensure there aren't any name collisions. - exists, err := p.schemaExists(params.ctx, db.ID, n.Schema) + exists, err := p.schemaExists(params.ctx, db.ID, schemaName) if err != nil { return err } @@ -60,11 +65,11 @@ func (p *planner) createUserDefinedSchema(params runParams, n *tree.CreateSchema if n.IfNotExists { return nil } - return pgerror.Newf(pgcode.DuplicateSchema, "schema %q already exists", n.Schema) + return pgerror.Newf(pgcode.DuplicateSchema, "schema %q already exists", schemaName) } // Check validity of the schema name. - if err := schemadesc.IsSchemaNameValid(n.Schema); err != nil { + if err := schemadesc.IsSchemaNameValid(schemaName); err != nil { return err } @@ -83,12 +88,24 @@ func (p *planner) createUserDefinedSchema(params runParams, n *tree.CreateSchema // Inherit the parent privileges. privs := db.GetPrivileges() - privs.SetOwner(params.SessionData().User) + + if n.AuthRole != "" { + exists, err := p.RoleExists(params.ctx, n.AuthRole) + if err != nil { + return err + } + if !exists { + return pgerror.Newf(pgcode.UndefinedObject, "role/user %q does not exist", n.AuthRole) + } + privs.SetOwner(n.AuthRole) + } else { + privs.SetOwner(params.SessionData().User) + } // Create the SchemaDescriptor. desc := schemadesc.NewCreatedMutable(descpb.SchemaDescriptor{ ParentID: db.ID, - Name: n.Schema, + Name: schemaName, ID: id, Privileges: privs, Version: 1, @@ -113,7 +130,7 @@ func (p *planner) createUserDefinedSchema(params runParams, n *tree.CreateSchema // Finally create the schema on disk. return p.createDescriptorWithID( params.ctx, - catalogkeys.NewSchemaKey(db.ID, n.Schema).Key(p.ExecCfg().Codec), + catalogkeys.NewSchemaKey(db.ID, schemaName).Key(p.ExecCfg().Codec), id, desc, params.ExecCfg().Settings, diff --git a/pkg/sql/faketreeeval/evalctx.go b/pkg/sql/faketreeeval/evalctx.go index 5b7eebdb800d..58db1900119f 100644 --- a/pkg/sql/faketreeeval/evalctx.go +++ b/pkg/sql/faketreeeval/evalctx.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" "github.com/cockroachdb/errors" + "github.com/lib/pq/oid" ) // DummySequenceOperators implements the tree.SequenceOperators interface by @@ -119,6 +120,18 @@ func (ep *DummyEvalPlanner) EvalSubquery(expr *tree.Subquery) (tree.Datum, error return nil, errors.WithStack(errEvalPlanner) } +// ResolveTypeByOID implements the tree.TypeReferenceResolver interface. +func (ep *DummyEvalPlanner) ResolveTypeByOID(_ context.Context, _ oid.Oid) (*types.T, error) { + return nil, errors.WithStack(errEvalPlanner) +} + +// ResolveType implements the tree.TypeReferenceResolver interface. +func (ep *DummyEvalPlanner) ResolveType( + _ context.Context, _ *tree.UnresolvedObjectName, +) (*types.T, error) { + return nil, errors.WithStack(errEvalPlanner) +} + // DummyPrivilegedAccessor implements the tree.PrivilegedAccessor interface by returning errors. type DummyPrivilegedAccessor struct{} diff --git a/pkg/sql/logictest/testdata/logic_test/geospatial b/pkg/sql/logictest/testdata/logic_test/geospatial index e7517d409cea..d0b891c8d699 100644 --- a/pkg/sql/logictest/testdata/logic_test/geospatial +++ b/pkg/sql/logictest/testdata/logic_test/geospatial @@ -1013,161 +1013,160 @@ SELECT ST_IsRing('POINT(0 0)') # Topology operators -query TTTBT +query TTTB SELECT a.dsc, b.dsc, ST_AsEWKT(ST_Intersection(a.geom, b.geom)), - ST_Intersection(a.geom, b.geom) = ST_Intersection(a.geom::string, b.geom::string), - ST_AsEWKT(ST_SymDifference(a.geom, b.geom)) + ST_Intersection(a.geom, b.geom) = ST_Intersection(a.geom::string, b.geom::string) FROM geom_operators_test a JOIN geom_operators_test b ON (1=1) ORDER BY a.dsc, b.dsc ---- -Empty GeometryCollection Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION EMPTY -Empty GeometryCollection Empty LineString GEOMETRYCOLLECTION EMPTY true LINESTRING EMPTY -Empty GeometryCollection Empty Point GEOMETRYCOLLECTION EMPTY true POINT EMPTY -Empty GeometryCollection Faraway point GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Empty GeometryCollection Line going through left and right square GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Empty GeometryCollection NULL NULL NULL NULL -Empty GeometryCollection Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Empty GeometryCollection Point middle of Left Square GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Empty GeometryCollection Point middle of Right Square GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Empty GeometryCollection Square (left) GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Empty GeometryCollection Square (right) GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Empty GeometryCollection Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Empty LineString Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION EMPTY -Empty LineString Empty LineString GEOMETRYCOLLECTION EMPTY true LINESTRING EMPTY -Empty LineString Empty Point GEOMETRYCOLLECTION EMPTY true POINT EMPTY -Empty LineString Faraway point GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Empty LineString Line going through left and right square GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Empty LineString NULL NULL NULL NULL -Empty LineString Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Empty LineString Point middle of Left Square GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Empty LineString Point middle of Right Square GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Empty LineString Square (left) GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Empty LineString Square (right) GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Empty LineString Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Empty Point Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION EMPTY -Empty Point Empty LineString GEOMETRYCOLLECTION EMPTY true LINESTRING EMPTY -Empty Point Empty Point GEOMETRYCOLLECTION EMPTY true POINT EMPTY -Empty Point Faraway point GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Empty Point Line going through left and right square GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Empty Point NULL NULL NULL NULL -Empty Point Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Empty Point Point middle of Left Square GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Empty Point Point middle of Right Square GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Empty Point Square (left) GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Empty Point Square (right) GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Empty Point Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Faraway point Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Faraway point Empty LineString GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Faraway point Empty Point GEOMETRYCOLLECTION EMPTY true POINT (5 5) -Faraway point Faraway point POINT (5 5) true POINT EMPTY -Faraway point Line going through left and right square POINT EMPTY true GEOMETRYCOLLECTION (POINT (5 5), LINESTRING (-0.5 0.5, 0.5 0.5)) -Faraway point NULL NULL NULL NULL -Faraway point Nested Geometry Collection POINT EMPTY true GEOMETRYCOLLECTION (POINT (5 5), GEOMETRYCOLLECTION (POINT (0 0))) -Faraway point Point middle of Left Square POINT EMPTY true MULTIPOINT (5 5, -0.5 0.5) -Faraway point Point middle of Right Square POINT EMPTY true MULTIPOINT (5 5, 0.5 0.5) -Faraway point Square (left) POINT EMPTY true GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) -Faraway point Square (right) POINT EMPTY true GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) -Faraway point Square overlapping left and right square POINT EMPTY true GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) -Line going through left and right square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Line going through left and right square Empty LineString GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Line going through left and right square Empty Point GEOMETRYCOLLECTION EMPTY true LINESTRING (-0.5 0.5, 0.5 0.5) -Line going through left and right square Faraway point POINT EMPTY true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), POINT (5 5)) -Line going through left and right square Line going through left and right square LINESTRING (-0.5 0.5, 0.5 0.5) true LINESTRING EMPTY -Line going through left and right square NULL NULL NULL NULL -Line going through left and right square Nested Geometry Collection POINT EMPTY true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) -Line going through left and right square Point middle of Left Square POINT (-0.5 0.5) true LINESTRING (-0.5 0.5, 0.5 0.5) -Line going through left and right square Point middle of Right Square POINT (0.5 0.5) true LINESTRING (-0.5 0.5, 0.5 0.5) -Line going through left and right square Square (left) LINESTRING (-0.5 0.5, 0 0.5) true GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) -Line going through left and right square Square (right) LINESTRING (0 0.5, 0.5 0.5) true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) -Line going through left and right square Square overlapping left and right square LINESTRING (-0.1 0.5, 0.5 0.5) true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) -NULL Empty GeometryCollection NULL NULL NULL -NULL Empty LineString NULL NULL NULL -NULL Empty Point NULL NULL NULL -NULL Faraway point NULL NULL NULL -NULL Line going through left and right square NULL NULL NULL -NULL NULL NULL NULL NULL -NULL Nested Geometry Collection NULL NULL NULL -NULL Point middle of Left Square NULL NULL NULL -NULL Point middle of Right Square NULL NULL NULL -NULL Square (left) NULL NULL NULL -NULL Square (right) NULL NULL NULL -NULL Square overlapping left and right square NULL NULL NULL -Nested Geometry Collection Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Nested Geometry Collection Empty LineString GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Nested Geometry Collection Empty Point GEOMETRYCOLLECTION EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) -Nested Geometry Collection Faraway point POINT EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (5 5)) -Nested Geometry Collection Line going through left and right square POINT EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), LINESTRING (-0.5 0.5, 0.5 0.5)) -Nested Geometry Collection NULL NULL NULL NULL -Nested Geometry Collection Nested Geometry Collection POINT (0 0) true POINT EMPTY -Nested Geometry Collection Point middle of Left Square POINT EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (-0.5 0.5)) -Nested Geometry Collection Point middle of Right Square POINT EMPTY true GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (0.5 0.5)) -Nested Geometry Collection Square (left) POINT (0 0) true POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) -Nested Geometry Collection Square (right) POINT (0 0) true POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) -Nested Geometry Collection Square overlapping left and right square POINT (0 0) true POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) -Point middle of Left Square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Point middle of Left Square Empty LineString GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Point middle of Left Square Empty Point GEOMETRYCOLLECTION EMPTY true POINT (-0.5 0.5) -Point middle of Left Square Faraway point POINT EMPTY true MULTIPOINT (-0.5 0.5, 5 5) -Point middle of Left Square Line going through left and right square POINT (-0.5 0.5) true LINESTRING (-0.5 0.5, 0.5 0.5) -Point middle of Left Square NULL NULL NULL NULL -Point middle of Left Square Nested Geometry Collection POINT EMPTY true GEOMETRYCOLLECTION (POINT (-0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) -Point middle of Left Square Point middle of Left Square POINT (-0.5 0.5) true POINT EMPTY -Point middle of Left Square Point middle of Right Square POINT EMPTY true MULTIPOINT (-0.5 0.5, 0.5 0.5) -Point middle of Left Square Square (left) POINT (-0.5 0.5) true POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) -Point middle of Left Square Square (right) POINT EMPTY true GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) -Point middle of Left Square Square overlapping left and right square POINT EMPTY true GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) -Point middle of Right Square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Point middle of Right Square Empty LineString GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Point middle of Right Square Empty Point GEOMETRYCOLLECTION EMPTY true POINT (0.5 0.5) -Point middle of Right Square Faraway point POINT EMPTY true MULTIPOINT (0.5 0.5, 5 5) -Point middle of Right Square Line going through left and right square POINT (0.5 0.5) true LINESTRING (-0.5 0.5, 0.5 0.5) -Point middle of Right Square NULL NULL NULL NULL -Point middle of Right Square Nested Geometry Collection POINT EMPTY true GEOMETRYCOLLECTION (POINT (0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) -Point middle of Right Square Point middle of Left Square POINT EMPTY true MULTIPOINT (0.5 0.5, -0.5 0.5) -Point middle of Right Square Point middle of Right Square POINT (0.5 0.5) true POINT EMPTY -Point middle of Right Square Square (left) POINT EMPTY true GEOMETRYCOLLECTION (POINT (0.5 0.5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) -Point middle of Right Square Square (right) POINT (0.5 0.5) true POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) -Point middle of Right Square Square overlapping left and right square POINT (0.5 0.5) true POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) -Square (left) Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Square (left) Empty LineString GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Square (left) Empty Point GEOMETRYCOLLECTION EMPTY true POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) -Square (left) Faraway point POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (5 5)) -Square (left) Line going through left and right square LINESTRING (-0.5 0.5, 0 0.5) true GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) -Square (left) NULL NULL NULL NULL -Square (left) Nested Geometry Collection POINT (0 0) true POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) -Square (left) Point middle of Left Square POINT (-0.5 0.5) true POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) -Square (left) Point middle of Right Square POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (0.5 0.5)) -Square (left) Square (left) POLYGON ((0 0, -1 0, -1 1, 0 1, 0 0)) true POLYGON EMPTY -Square (left) Square (right) LINESTRING (0 0, 0 1) true POLYGON ((0 0, -1 0, -1 1, 0 1, 1 1, 1 0, 0 0)) -Square (left) Square overlapping left and right square POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) true MULTIPOLYGON (((-0.1 0, -1 0, -1 1, -0.1 1, -0.1 0)), ((0 0, 0 1, 1 1, 1 0, 0 0))) -Square (right) Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Square (right) Empty LineString GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Square (right) Empty Point GEOMETRYCOLLECTION EMPTY true POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) -Square (right) Faraway point POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (5 5)) -Square (right) Line going through left and right square LINESTRING (0 0.5, 0.5 0.5) true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) -Square (right) NULL NULL NULL NULL -Square (right) Nested Geometry Collection POINT (0 0) true POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) -Square (right) Point middle of Left Square POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (-0.5 0.5)) -Square (right) Point middle of Right Square POINT (0.5 0.5) true POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) -Square (right) Square (left) LINESTRING (0 1, 0 0) true POLYGON ((0 1, 1 1, 1 0, 0 0, -1 0, -1 1, 0 1)) -Square (right) Square (right) POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true POLYGON EMPTY -Square (right) Square overlapping left and right square POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true POLYGON ((0 1, 0 0, -0.1 0, -0.1 1, 0 1)) -Square overlapping left and right square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Square overlapping left and right square Empty LineString GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Square overlapping left and right square Empty Point GEOMETRYCOLLECTION EMPTY true POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) -Square overlapping left and right square Faraway point POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (5 5)) -Square overlapping left and right square Line going through left and right square LINESTRING (-0.1 0.5, 0.5 0.5) true GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) -Square overlapping left and right square NULL NULL NULL NULL -Square overlapping left and right square Nested Geometry Collection POINT (0 0) true POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) -Square overlapping left and right square Point middle of Left Square POINT EMPTY true GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (-0.5 0.5)) -Square overlapping left and right square Point middle of Right Square POINT (0.5 0.5) true POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) -Square overlapping left and right square Square (left) POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) true MULTIPOLYGON (((0 1, 1 1, 1 0, 0 0, 0 1)), ((-0.1 1, -0.1 0, -1 0, -1 1, -0.1 1))) -Square overlapping left and right square Square (right) POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) -Square overlapping left and right square Square overlapping left and right square POLYGON ((1 0, -0.1 0, -0.1 1, 1 1, 1 0)) true POLYGON EMPTY +Empty GeometryCollection Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Empty LineString GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Empty Point GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Faraway point GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Line going through left and right square GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection NULL NULL NULL +Empty GeometryCollection Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Point middle of Left Square GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Point middle of Right Square GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Square (left) GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Square (right) GEOMETRYCOLLECTION EMPTY true +Empty GeometryCollection Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true +Empty LineString Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Empty LineString Empty LineString GEOMETRYCOLLECTION EMPTY true +Empty LineString Empty Point GEOMETRYCOLLECTION EMPTY true +Empty LineString Faraway point GEOMETRYCOLLECTION EMPTY true +Empty LineString Line going through left and right square GEOMETRYCOLLECTION EMPTY true +Empty LineString NULL NULL NULL +Empty LineString Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true +Empty LineString Point middle of Left Square GEOMETRYCOLLECTION EMPTY true +Empty LineString Point middle of Right Square GEOMETRYCOLLECTION EMPTY true +Empty LineString Square (left) GEOMETRYCOLLECTION EMPTY true +Empty LineString Square (right) GEOMETRYCOLLECTION EMPTY true +Empty LineString Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true +Empty Point Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Empty Point Empty LineString GEOMETRYCOLLECTION EMPTY true +Empty Point Empty Point GEOMETRYCOLLECTION EMPTY true +Empty Point Faraway point GEOMETRYCOLLECTION EMPTY true +Empty Point Line going through left and right square GEOMETRYCOLLECTION EMPTY true +Empty Point NULL NULL NULL +Empty Point Nested Geometry Collection GEOMETRYCOLLECTION EMPTY true +Empty Point Point middle of Left Square GEOMETRYCOLLECTION EMPTY true +Empty Point Point middle of Right Square GEOMETRYCOLLECTION EMPTY true +Empty Point Square (left) GEOMETRYCOLLECTION EMPTY true +Empty Point Square (right) GEOMETRYCOLLECTION EMPTY true +Empty Point Square overlapping left and right square GEOMETRYCOLLECTION EMPTY true +Faraway point Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Faraway point Empty LineString GEOMETRYCOLLECTION EMPTY true +Faraway point Empty Point GEOMETRYCOLLECTION EMPTY true +Faraway point Faraway point POINT (5 5) true +Faraway point Line going through left and right square POINT EMPTY true +Faraway point NULL NULL NULL +Faraway point Nested Geometry Collection POINT EMPTY true +Faraway point Point middle of Left Square POINT EMPTY true +Faraway point Point middle of Right Square POINT EMPTY true +Faraway point Square (left) POINT EMPTY true +Faraway point Square (right) POINT EMPTY true +Faraway point Square overlapping left and right square POINT EMPTY true +Line going through left and right square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Line going through left and right square Empty LineString GEOMETRYCOLLECTION EMPTY true +Line going through left and right square Empty Point GEOMETRYCOLLECTION EMPTY true +Line going through left and right square Faraway point POINT EMPTY true +Line going through left and right square Line going through left and right square LINESTRING (-0.5 0.5, 0.5 0.5) true +Line going through left and right square NULL NULL NULL +Line going through left and right square Nested Geometry Collection POINT EMPTY true +Line going through left and right square Point middle of Left Square POINT (-0.5 0.5) true +Line going through left and right square Point middle of Right Square POINT (0.5 0.5) true +Line going through left and right square Square (left) LINESTRING (-0.5 0.5, 0 0.5) true +Line going through left and right square Square (right) LINESTRING (0 0.5, 0.5 0.5) true +Line going through left and right square Square overlapping left and right square LINESTRING (-0.1 0.5, 0.5 0.5) true +NULL Empty GeometryCollection NULL NULL +NULL Empty LineString NULL NULL +NULL Empty Point NULL NULL +NULL Faraway point NULL NULL +NULL Line going through left and right square NULL NULL +NULL NULL NULL NULL +NULL Nested Geometry Collection NULL NULL +NULL Point middle of Left Square NULL NULL +NULL Point middle of Right Square NULL NULL +NULL Square (left) NULL NULL +NULL Square (right) NULL NULL +NULL Square overlapping left and right square NULL NULL +Nested Geometry Collection Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Nested Geometry Collection Empty LineString GEOMETRYCOLLECTION EMPTY true +Nested Geometry Collection Empty Point GEOMETRYCOLLECTION EMPTY true +Nested Geometry Collection Faraway point POINT EMPTY true +Nested Geometry Collection Line going through left and right square POINT EMPTY true +Nested Geometry Collection NULL NULL NULL +Nested Geometry Collection Nested Geometry Collection POINT (0 0) true +Nested Geometry Collection Point middle of Left Square POINT EMPTY true +Nested Geometry Collection Point middle of Right Square POINT EMPTY true +Nested Geometry Collection Square (left) POINT (0 0) true +Nested Geometry Collection Square (right) POINT (0 0) true +Nested Geometry Collection Square overlapping left and right square POINT (0 0) true +Point middle of Left Square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Point middle of Left Square Empty LineString GEOMETRYCOLLECTION EMPTY true +Point middle of Left Square Empty Point GEOMETRYCOLLECTION EMPTY true +Point middle of Left Square Faraway point POINT EMPTY true +Point middle of Left Square Line going through left and right square POINT (-0.5 0.5) true +Point middle of Left Square NULL NULL NULL +Point middle of Left Square Nested Geometry Collection POINT EMPTY true +Point middle of Left Square Point middle of Left Square POINT (-0.5 0.5) true +Point middle of Left Square Point middle of Right Square POINT EMPTY true +Point middle of Left Square Square (left) POINT (-0.5 0.5) true +Point middle of Left Square Square (right) POINT EMPTY true +Point middle of Left Square Square overlapping left and right square POINT EMPTY true +Point middle of Right Square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Point middle of Right Square Empty LineString GEOMETRYCOLLECTION EMPTY true +Point middle of Right Square Empty Point GEOMETRYCOLLECTION EMPTY true +Point middle of Right Square Faraway point POINT EMPTY true +Point middle of Right Square Line going through left and right square POINT (0.5 0.5) true +Point middle of Right Square NULL NULL NULL +Point middle of Right Square Nested Geometry Collection POINT EMPTY true +Point middle of Right Square Point middle of Left Square POINT EMPTY true +Point middle of Right Square Point middle of Right Square POINT (0.5 0.5) true +Point middle of Right Square Square (left) POINT EMPTY true +Point middle of Right Square Square (right) POINT (0.5 0.5) true +Point middle of Right Square Square overlapping left and right square POINT (0.5 0.5) true +Square (left) Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Square (left) Empty LineString GEOMETRYCOLLECTION EMPTY true +Square (left) Empty Point GEOMETRYCOLLECTION EMPTY true +Square (left) Faraway point POINT EMPTY true +Square (left) Line going through left and right square LINESTRING (-0.5 0.5, 0 0.5) true +Square (left) NULL NULL NULL +Square (left) Nested Geometry Collection POINT (0 0) true +Square (left) Point middle of Left Square POINT (-0.5 0.5) true +Square (left) Point middle of Right Square POINT EMPTY true +Square (left) Square (left) POLYGON ((0 0, -1 0, -1 1, 0 1, 0 0)) true +Square (left) Square (right) LINESTRING (0 0, 0 1) true +Square (left) Square overlapping left and right square POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) true +Square (right) Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Square (right) Empty LineString GEOMETRYCOLLECTION EMPTY true +Square (right) Empty Point GEOMETRYCOLLECTION EMPTY true +Square (right) Faraway point POINT EMPTY true +Square (right) Line going through left and right square LINESTRING (0 0.5, 0.5 0.5) true +Square (right) NULL NULL NULL +Square (right) Nested Geometry Collection POINT (0 0) true +Square (right) Point middle of Left Square POINT EMPTY true +Square (right) Point middle of Right Square POINT (0.5 0.5) true +Square (right) Square (left) LINESTRING (0 1, 0 0) true +Square (right) Square (right) POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true +Square (right) Square overlapping left and right square POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true +Square overlapping left and right square Empty GeometryCollection GEOMETRYCOLLECTION EMPTY true +Square overlapping left and right square Empty LineString GEOMETRYCOLLECTION EMPTY true +Square overlapping left and right square Empty Point GEOMETRYCOLLECTION EMPTY true +Square overlapping left and right square Faraway point POINT EMPTY true +Square overlapping left and right square Line going through left and right square LINESTRING (-0.1 0.5, 0.5 0.5) true +Square overlapping left and right square NULL NULL NULL +Square overlapping left and right square Nested Geometry Collection POINT (0 0) true +Square overlapping left and right square Point middle of Left Square POINT EMPTY true +Square overlapping left and right square Point middle of Right Square POINT (0.5 0.5) true +Square overlapping left and right square Square (left) POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) true +Square overlapping left and right square Square (right) POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0)) true +Square overlapping left and right square Square overlapping left and right square POLYGON ((1 0, -0.1 0, -0.1 1, 1 1, 1 0)) true query TTTT SELECT @@ -1211,6 +1210,159 @@ Square (left) GEOMETRYCOLLECTION EMPTY Square (right) POLYGON ((0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0)) Square overlapping left and right square POLYGON ((0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0)) +query TT +SELECT + ST_AsEWKT(ST_SymDifference(a.geom, b.geom)), + ST_AsEWKT(ST_SymmetricDifference(a.geom, b.geom)) +FROM geom_operators_test a +JOIN geom_operators_test b ON (1=1) +ORDER BY a.dsc, b.dsc +---- +GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY +LINESTRING EMPTY LINESTRING EMPTY +POINT EMPTY POINT EMPTY +POINT (5 5) POINT (5 5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +NULL NULL +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +POINT (-0.5 0.5) POINT (-0.5 0.5) +POINT (0.5 0.5) POINT (0.5 0.5) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY +LINESTRING EMPTY LINESTRING EMPTY +POINT EMPTY POINT EMPTY +POINT (5 5) POINT (5 5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +NULL NULL +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +POINT (-0.5 0.5) POINT (-0.5 0.5) +POINT (0.5 0.5) POINT (0.5 0.5) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +GEOMETRYCOLLECTION EMPTY GEOMETRYCOLLECTION EMPTY +LINESTRING EMPTY LINESTRING EMPTY +POINT EMPTY POINT EMPTY +POINT (5 5) POINT (5 5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +NULL NULL +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +POINT (-0.5 0.5) POINT (-0.5 0.5) +POINT (0.5 0.5) POINT (0.5 0.5) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +POINT (5 5) POINT (5 5) +POINT (5 5) POINT (5 5) +POINT (5 5) POINT (5 5) +POINT EMPTY POINT EMPTY +GEOMETRYCOLLECTION (POINT (5 5), LINESTRING (-0.5 0.5, 0.5 0.5)) GEOMETRYCOLLECTION (POINT (5 5), LINESTRING (-0.5 0.5, 0.5 0.5)) +NULL NULL +GEOMETRYCOLLECTION (POINT (5 5), GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (POINT (5 5), GEOMETRYCOLLECTION (POINT (0 0))) +MULTIPOINT (5 5, -0.5 0.5) MULTIPOINT (5 5, -0.5 0.5) +MULTIPOINT (5 5, 0.5 0.5) MULTIPOINT (5 5, 0.5 0.5) +GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) +GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) +GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) GEOMETRYCOLLECTION (POINT (5 5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), POINT (5 5)) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), POINT (5 5)) +LINESTRING EMPTY LINESTRING EMPTY +NULL NULL +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +NULL NULL +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (5 5)) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (5 5)) +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), LINESTRING (-0.5 0.5, 0.5 0.5)) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), LINESTRING (-0.5 0.5, 0.5 0.5)) +NULL NULL +POINT EMPTY POINT EMPTY +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (-0.5 0.5)) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (-0.5 0.5)) +GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (0.5 0.5)) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)), POINT (0.5 0.5)) +POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) +POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) +POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) +POINT (-0.5 0.5) POINT (-0.5 0.5) +POINT (-0.5 0.5) POINT (-0.5 0.5) +POINT (-0.5 0.5) POINT (-0.5 0.5) +MULTIPOINT (-0.5 0.5, 5 5) MULTIPOINT (-0.5 0.5, 5 5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +NULL NULL +GEOMETRYCOLLECTION (POINT (-0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (POINT (-0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) +POINT EMPTY POINT EMPTY +MULTIPOINT (-0.5 0.5, 0.5 0.5) MULTIPOINT (-0.5 0.5, 0.5 0.5) +POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) +GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))) +GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) GEOMETRYCOLLECTION (POINT (-0.5 0.5), POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0))) +POINT (0.5 0.5) POINT (0.5 0.5) +POINT (0.5 0.5) POINT (0.5 0.5) +POINT (0.5 0.5) POINT (0.5 0.5) +MULTIPOINT (0.5 0.5, 5 5) MULTIPOINT (0.5 0.5, 5 5) +LINESTRING (-0.5 0.5, 0.5 0.5) LINESTRING (-0.5 0.5, 0.5 0.5) +NULL NULL +GEOMETRYCOLLECTION (POINT (0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (POINT (0.5 0.5), GEOMETRYCOLLECTION (POINT (0 0))) +MULTIPOINT (0.5 0.5, -0.5 0.5) MULTIPOINT (0.5 0.5, -0.5 0.5) +POINT EMPTY POINT EMPTY +GEOMETRYCOLLECTION (POINT (0.5 0.5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) GEOMETRYCOLLECTION (POINT (0.5 0.5), POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0))) +POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) +POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) +GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (5 5)) GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (5 5)) +GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) GEOMETRYCOLLECTION (LINESTRING (0 0.5, 0.5 0.5), POLYGON ((0 0.5, 0 0, -1 0, -1 1, 0 1, 0 0.5))) +NULL NULL +POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) +POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) POLYGON ((-1 0, -1 1, 0 1, 0 0, -1 0)) +GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (0.5 0.5)) GEOMETRYCOLLECTION (POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)), POINT (0.5 0.5)) +POLYGON EMPTY POLYGON EMPTY +POLYGON ((0 0, -1 0, -1 1, 0 1, 1 1, 1 0, 0 0)) POLYGON ((0 0, -1 0, -1 1, 0 1, 1 1, 1 0, 0 0)) +MULTIPOLYGON (((-0.1 0, -1 0, -1 1, -0.1 1, -0.1 0)), ((0 0, 0 1, 1 1, 1 0, 0 0))) MULTIPOLYGON (((-0.1 0, -1 0, -1 1, -0.1 1, -0.1 0)), ((0 0, 0 1, 1 1, 1 0, 0 0))) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) +GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (5 5)) GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (5 5)) +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, 0 0.5), POLYGON ((0 0.5, 0 1, 1 1, 1 0, 0 0, 0 0.5))) +NULL NULL +POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) +GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (-0.5 0.5)) GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POINT (-0.5 0.5)) +POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)) +POLYGON ((0 1, 1 1, 1 0, 0 0, -1 0, -1 1, 0 1)) POLYGON ((0 1, 1 1, 1 0, 0 0, -1 0, -1 1, 0 1)) +POLYGON EMPTY POLYGON EMPTY +POLYGON ((0 1, 0 0, -0.1 0, -0.1 1, 0 1)) POLYGON ((0 1, 0 0, -0.1 0, -0.1 1, 0 1)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) +GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (5 5)) GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (5 5)) +GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) GEOMETRYCOLLECTION (LINESTRING (-0.5 0.5, -0.1 0.5), POLYGON ((-0.1 0.5, -0.1 1, 1 1, 1 0, -0.1 0, -0.1 0.5))) +NULL NULL +POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) +GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (-0.5 0.5)) GEOMETRYCOLLECTION (POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)), POINT (-0.5 0.5)) +POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) POLYGON ((-0.1 0, -0.1 1, 1 1, 1 0, -0.1 0)) +MULTIPOLYGON (((0 1, 1 1, 1 0, 0 0, 0 1)), ((-0.1 1, -0.1 0, -1 0, -1 1, -0.1 1))) MULTIPOLYGON (((0 1, 1 1, 1 0, 0 0, 0 1)), ((-0.1 1, -0.1 0, -1 0, -1 1, -0.1 1))) +POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) POLYGON ((0 0, -0.1 0, -0.1 1, 0 1, 0 0)) +POLYGON EMPTY POLYGON EMPTY + # CW/CCW predicates. query TBBTT SELECT diff --git a/pkg/sql/logictest/testdata/logic_test/pg_builtins b/pkg/sql/logictest/testdata/logic_test/pg_builtins index e2f4b966e1f0..f441ff9cdfe7 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_builtins +++ b/pkg/sql/logictest/testdata/logic_test/pg_builtins @@ -18,3 +18,18 @@ SELECT pg_my_temp_schema() # Regression test for #49072. statement ok SELECT has_table_privilege('root'::NAME, 0, 'select') + +# Regression test for #53684. +statement ok +CREATE TYPE typ AS ENUM ('hello') + +query T +SELECT format_type(oid, 0) FROM pg_catalog.pg_type WHERE typname = 'typ' +---- +typ + +# Nothing breaks if we put a non-existing oid into format_type. +query T +SELECT format_type(152100, 0) +---- +unknown (OID=152100) diff --git a/pkg/sql/logictest/testdata/logic_test/schema b/pkg/sql/logictest/testdata/logic_test/schema index 067e71068ce4..d7bf84909a78 100644 --- a/pkg/sql/logictest/testdata/logic_test/schema +++ b/pkg/sql/logictest/testdata/logic_test/schema @@ -347,3 +347,38 @@ COMMENT ON COLUMN privs.usage_tbl.x IS 'foo' statement error pq: user testuser does not have USAGE privilege on schema privs ALTER TYPE privs.usage_typ ADD VALUE 'denied' + +subtest authorization + +user root +# Test the AUTHORIZATION argument to CREATE SCHEMA. + +# Create a user to create a schema for. +statement ok +CREATE USER user1; + +# Creates a schema for named with user1 as the owner. +statement ok +CREATE SCHEMA AUTHORIZATION user1 + +statement error pq: schema "user1" already exists +CREATE SCHEMA AUTHORIZATION user1 + +statement ok +CREATE SCHEMA IF NOT EXISTS AUTHORIZATION user1 + +statement ok +CREATE SCHEMA user1_schema AUTHORIZATION user1 + +# The created schemas should both be owned by user1. +query TT +SELECT + nspname, usename +FROM + pg_catalog.pg_namespace + LEFT JOIN pg_catalog.pg_user ON pg_namespace.nspowner = pg_user.usesysid +WHERE + nspname LIKE 'user1%'; +---- +user1 user1 +user1_schema user1 diff --git a/pkg/sql/parser/parse_test.go b/pkg/sql/parser/parse_test.go index 929f8f353f78..f1c78b1c3b49 100644 --- a/pkg/sql/parser/parse_test.go +++ b/pkg/sql/parser/parse_test.go @@ -81,6 +81,10 @@ func TestParse(t *testing.T) { {`CREATE DATABASE IF NOT EXISTS a TEMPLATE = 'template0' ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'INVALID'`}, {`CREATE SCHEMA IF NOT EXISTS foo`}, {`CREATE SCHEMA foo`}, + {`CREATE SCHEMA IF NOT EXISTS foo AUTHORIZATION foobar`}, + {`CREATE SCHEMA foo AUTHORIZATION foobar`}, + {`CREATE SCHEMA IF NOT EXISTS AUTHORIZATION foobar`}, + {`CREATE SCHEMA AUTHORIZATION foobar`}, {`CREATE INDEX a ON b (c)`}, {`CREATE INDEX CONCURRENTLY a ON b (c)`}, diff --git a/pkg/sql/parser/sql.y b/pkg/sql/parser/sql.y index 68396b09b463..36f55ba049b6 100644 --- a/pkg/sql/parser/sql.y +++ b/pkg/sql/parser/sql.y @@ -934,7 +934,7 @@ func (u *sqlSymUnion) refreshDataOption() tree.RefreshDataOption { %type