mirror of https://github.com/citusdata/citus.git
Merge eead8ccad2
into 711aec80fa
commit
68fac8573e
|
@ -71,7 +71,7 @@ BEGIN
|
||||||
-- from version 12 and up we have support for tableam's if installed on pg11 we can't
|
-- from version 12 and up we have support for tableam's if installed on pg11 we can't
|
||||||
-- create the objects here. Instead we rely on citus_finish_pg_upgrade to be called by the
|
-- create the objects here. Instead we rely on citus_finish_pg_upgrade to be called by the
|
||||||
-- user instead to add the missing objects
|
-- user instead to add the missing objects
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
--#include "udfs/columnar_handler/10.0-1.sql"
|
--#include "udfs/columnar_handler/10.0-1.sql"
|
||||||
CREATE OR REPLACE FUNCTION columnar.columnar_handler(internal)
|
CREATE OR REPLACE FUNCTION columnar.columnar_handler(internal)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
-- Postgres assigns different names to those foreign keys in PG11, so act accordingly.
|
-- Postgres assigns different names to those foreign keys in PG11, so act accordingly.
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
ALTER TABLE columnar.chunk DROP CONSTRAINT chunk_storage_id_stripe_num_chunk_group_num_fkey;
|
ALTER TABLE columnar.chunk DROP CONSTRAINT chunk_storage_id_stripe_num_chunk_group_num_fkey;
|
||||||
ALTER TABLE columnar.chunk_group DROP CONSTRAINT chunk_group_storage_id_stripe_num_fkey;
|
ALTER TABLE columnar.chunk_group DROP CONSTRAINT chunk_group_storage_id_stripe_num_fkey;
|
||||||
|
|
|
@ -67,7 +67,7 @@ BEGIN
|
||||||
-- from version 12 and up we have support for tableam's if installed on pg11 we can't
|
-- from version 12 and up we have support for tableam's if installed on pg11 we can't
|
||||||
-- create the objects here. Instead we rely on citus_finish_pg_upgrade to be called by the
|
-- create the objects here. Instead we rely on citus_finish_pg_upgrade to be called by the
|
||||||
-- user instead to add the missing objects
|
-- user instead to add the missing objects
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
#include "udfs/columnar_handler/10.0-1.sql"
|
#include "udfs/columnar_handler/10.0-1.sql"
|
||||||
#include "udfs/alter_columnar_table_set/10.0-1.sql"
|
#include "udfs/alter_columnar_table_set/10.0-1.sql"
|
||||||
|
|
|
@ -5,7 +5,7 @@ SET search_path TO columnar;
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
DROP FUNCTION pg_catalog.alter_columnar_table_reset(
|
DROP FUNCTION pg_catalog.alter_columnar_table_reset(
|
||||||
table_name regclass,
|
table_name regclass,
|
||||||
|
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
|
|
||||||
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||||
-- exist we assume all objects have been created.
|
-- exist we assume all objects have been created.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||||
|
|
||||||
#include "../columnar_handler/10.0-1.sql"
|
#include "../columnar_handler/10.0-1.sql"
|
||||||
|
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
|
|
||||||
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
-- when postgres is version 12 or above we need to create the tableam. If the tableam
|
||||||
-- exist we assume all objects have been created.
|
-- exist we assume all objects have been created.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 12 THEN
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
|
||||||
|
|
||||||
#include "../columnar_handler/10.0-1.sql"
|
#include "../columnar_handler/10.0-1.sql"
|
||||||
|
|
|
@ -323,7 +323,7 @@ CREATE TRIGGER dist_shard_cache_invalidate
|
||||||
|
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
||||||
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
-- PG16 has its own any_value, so only create it pre PG16.
|
-- PG16 has its own any_value, so only create it pre PG16.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int < 16 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.any_value_agg ( anyelement, anyelement )
|
CREATE OR REPLACE FUNCTION pg_catalog.any_value_agg ( anyelement, anyelement )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
-- PG16 has its own any_value, so only create it pre PG16.
|
-- PG16 has its own any_value, so only create it pre PG16.
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int < 16 THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.any_value_agg ( anyelement, anyelement )
|
CREATE OR REPLACE FUNCTION pg_catalog.any_value_agg ( anyelement, anyelement )
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
FROM pg_dist_node_metadata;
|
FROM pg_dist_node_metadata;
|
||||||
|
|
||||||
SELECT r[1], r[2], r[3]
|
SELECT r[1], r[2], r[3]
|
||||||
FROM regexp_matches(last_upgrade_version_string,'([0-9]+)\.([0-9]+)-([0-9]+)','') r
|
FROM regexp_matches(last_upgrade_version_string,'([0-9]+)[.]([0-9]+)-([0-9]+)','') r
|
||||||
INTO last_upgrade_major_version, last_upgrade_minor_version, last_upgrade_sqlpatch_version;
|
INTO last_upgrade_major_version, last_upgrade_minor_version, last_upgrade_sqlpatch_version;
|
||||||
|
|
||||||
IF last_upgrade_major_version IS NULL OR last_upgrade_minor_version IS NULL OR last_upgrade_sqlpatch_version IS NULL THEN
|
IF last_upgrade_major_version IS NULL OR last_upgrade_minor_version IS NULL OR last_upgrade_sqlpatch_version IS NULL THEN
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
FROM pg_dist_node_metadata;
|
FROM pg_dist_node_metadata;
|
||||||
|
|
||||||
SELECT r[1], r[2], r[3]
|
SELECT r[1], r[2], r[3]
|
||||||
FROM regexp_matches(last_upgrade_version_string,'([0-9]+)\.([0-9]+)-([0-9]+)','') r
|
FROM regexp_matches(last_upgrade_version_string,'([0-9]+)[.]([0-9]+)-([0-9]+)','') r
|
||||||
INTO last_upgrade_major_version, last_upgrade_minor_version, last_upgrade_sqlpatch_version;
|
INTO last_upgrade_major_version, last_upgrade_minor_version, last_upgrade_sqlpatch_version;
|
||||||
|
|
||||||
IF last_upgrade_major_version IS NULL OR last_upgrade_minor_version IS NULL OR last_upgrade_sqlpatch_version IS NULL THEN
|
IF last_upgrade_major_version IS NULL OR last_upgrade_minor_version IS NULL OR last_upgrade_sqlpatch_version IS NULL THEN
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
||||||
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
||||||
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
CREATE AGGREGATE array_cat_agg(anycompatiblearray) (SFUNC = array_cat, STYPE = anycompatiblearray);
|
||||||
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
COMMENT ON AGGREGATE array_cat_agg(anycompatiblearray)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
@ -53,7 +53,7 @@ BEGIN
|
||||||
|
|
||||||
-- PG16 has its own any_value, so only create it pre PG16.
|
-- PG16 has its own any_value, so only create it pre PG16.
|
||||||
-- We can remove this part when we drop support for PG16
|
-- We can remove this part when we drop support for PG16
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int < 16 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
@ -53,7 +53,7 @@ BEGIN
|
||||||
|
|
||||||
-- PG16 has its own any_value, so only create it pre PG16.
|
-- PG16 has its own any_value, so only create it pre PG16.
|
||||||
-- We can remove this part when we drop support for PG16
|
-- We can remove this part when we drop support for PG16
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int < 16 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -10,7 +10,7 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int >= 14 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int >= 14 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
@ -53,7 +53,7 @@ BEGIN
|
||||||
|
|
||||||
-- PG16 has its own any_value, so only create it pre PG16.
|
-- PG16 has its own any_value, so only create it pre PG16.
|
||||||
-- We can remove this part when we drop support for PG16
|
-- We can remove this part when we drop support for PG16
|
||||||
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
|
IF substring(current_Setting('server_version'), '[0-9]+')::int < 16 THEN
|
||||||
EXECUTE $cmd$
|
EXECUTE $cmd$
|
||||||
-- disable propagation to prevent EnsureCoordinator errors
|
-- disable propagation to prevent EnsureCoordinator errors
|
||||||
-- the aggregate created here does not depend on Citus extension (yet)
|
-- the aggregate created here does not depend on Citus extension (yet)
|
||||||
|
|
|
@ -23,7 +23,7 @@ JOIN
|
||||||
ON
|
ON
|
||||||
pg_dist_partition.logicalrelid = pg_dist_shard.logicalrelid
|
pg_dist_partition.logicalrelid = pg_dist_shard.logicalrelid
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(SELECT (regexp_matches(table_name,'_(\d+)$'))[1]::int as shard_id, max(size) as size from citus_shard_sizes() GROUP BY shard_id) as shard_sizes
|
(SELECT (regexp_matches(table_name,'_([0-9]+)$'))[1]::int as shard_id, max(size) as size from citus_shard_sizes() GROUP BY shard_id) as shard_sizes
|
||||||
ON
|
ON
|
||||||
pg_dist_shard.shardid = shard_sizes.shard_id
|
pg_dist_shard.shardid = shard_sizes.shard_id
|
||||||
WHERE
|
WHERE
|
||||||
|
|
|
@ -23,7 +23,7 @@ JOIN
|
||||||
ON
|
ON
|
||||||
pg_dist_partition.logicalrelid = pg_dist_shard.logicalrelid
|
pg_dist_partition.logicalrelid = pg_dist_shard.logicalrelid
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(SELECT (regexp_matches(table_name,'_(\d+)$'))[1]::int as shard_id, max(size) as size from citus_shard_sizes() GROUP BY shard_id) as shard_sizes
|
(SELECT (regexp_matches(table_name,'_([0-9]+)$'))[1]::int as shard_id, max(size) as size from citus_shard_sizes() GROUP BY shard_id) as shard_sizes
|
||||||
ON
|
ON
|
||||||
pg_dist_shard.shardid = shard_sizes.shard_id
|
pg_dist_shard.shardid = shard_sizes.shard_id
|
||||||
WHERE
|
WHERE
|
||||||
|
|
|
@ -474,7 +474,7 @@ PendingWorkerTransactionList(MultiConnection *connection)
|
||||||
int32 coordinatorId = GetLocalGroupId();
|
int32 coordinatorId = GetLocalGroupId();
|
||||||
|
|
||||||
appendStringInfo(command, "SELECT gid FROM pg_prepared_xacts "
|
appendStringInfo(command, "SELECT gid FROM pg_prepared_xacts "
|
||||||
"WHERE gid LIKE 'citus\\_%d\\_%%' and database = current_database()",
|
"WHERE gid LIKE 'citus/_%d/_%%' ESCAPE '/' and database = current_database()",
|
||||||
coordinatorId);
|
coordinatorId);
|
||||||
|
|
||||||
int querySent = SendRemoteCommand(connection, command->data);
|
int querySent = SendRemoteCommand(connection, command->data);
|
||||||
|
|
Loading…
Reference in New Issue