Prevent C-style comments in all directories (#5250)

pull/5234/head
Hanefi Onaldi 2021-09-09 11:54:58 +03:00 committed by GitHub
parent e3e0a028c7
commit 9ae912a8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 55 additions and 51 deletions

View File

@ -1,6 +1,10 @@
#! /bin/bash
set -euo pipefail
# make ** match all directories and subdirectories
shopt -s globstar
# shellcheck disable=SC1091
source ci/ci_helpers.sh
@ -12,17 +16,17 @@ source ci/ci_helpers.sh
# and reusing them if needed. GNU sed unfortunately does not support lookaround assertions.
# /* -> --
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#/\*#--#g'
find src/backend/{distributed,columnar}/sql/**/*.sql -print0 | xargs -0 sed -i 's#/\*#--#g'
# */ -> `` (empty string)
# remove all whitespaces immediately before the match
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#\s*\*/\s*##g'
find src/backend/{distributed,columnar}/sql/**/*.sql -print0 | xargs -0 sed -i 's#\s*\*/\s*##g'
# * -> --
# keep the indentation
# allow only whitespaces before the match
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\) \*#\1--#g'
find src/backend/{distributed,columnar}/sql/**/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\) \*#\1--#g'
# // -> --
# do not touch http:// or similar by allowing only whitespaces before //
find src/backend/distributed/sql/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\)//#\1--#g'
find src/backend/{distributed,columnar}/sql/**/*.sql -print0 | xargs -0 sed -i 's#^\(\s*\)//#\1--#g'

View File

@ -1,4 +1,4 @@
/* columnar--10.0-1--10.0-2.sql */
-- columnar--10.0-1--10.0-2.sql
-- grant read access for columnar metadata tables to unprivileged user
GRANT USAGE ON SCHEMA columnar TO PUBLIC;

View File

@ -1,4 +1,4 @@
/* columnar--10.0-3--10.1-1.sql */
-- columnar--10.0-3--10.1-1.sql
-- Drop foreign keys between columnar metadata tables.
-- Postgres assigns different names to those foreign keys in PG11, so act accordingly.

View File

@ -1,4 +1,4 @@
/* columnar--10.1-1--10.2-1.sql */
-- columnar--10.1-1--10.2-1.sql
-- For a proper mapping between tid & (stripe, row_num), add a new column to
-- columnar.stripe and define a BTREE index on this column.

View File

@ -1,4 +1,4 @@
/* columnar--9.5-1--10.0-1.sql */
-- columnar--9.5-1--10.0-1.sql
CREATE SCHEMA columnar;
SET search_path TO columnar;

View File

@ -1,4 +1,4 @@
/* columnar--10.0-1--9.5-1.sql */
-- columnar--10.0-1--9.5-1.sql
SET search_path TO columnar;

View File

@ -1,4 +1,4 @@
/* columnar--10.0-2--10.0-1.sql */
-- columnar--10.0-2--10.0-1.sql
-- revoke read access for columnar metadata tables from unprivileged user
REVOKE USAGE ON SCHEMA columnar FROM PUBLIC;

View File

@ -1,4 +1,4 @@
/* columnar--10.1-1--10.0-3.sql */
-- columnar--10.1-1--10.0-3.sql
-- define foreign keys between columnar metadata tables
ALTER TABLE columnar.chunk

View File

@ -1,4 +1,4 @@
/* columnar--10.2-1--10.1-1.sql */
-- columnar--10.2-1--10.1-1.sql
-- downgrade storage for all columnar relations
SELECT citus_internal.downgrade_columnar_storage(c.oid) FROM pg_class c, pg_am a

View File

@ -42,7 +42,7 @@ COMMENT ON FUNCTION master_update_table_statistics(regclass)
IS 'updates shard statistics of the given table and its colocated tables';
DROP FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT text, OUT bigint);
/* copy of citus--10.0-2--10.0-1.sql */
-- copy of citus--10.0-2--10.0-1.sql
#include "../../../columnar/sql/downgrades/columnar--10.0-2--10.0-1.sql"
-- copy of citus--10.0-1--9.5-1

View File

@ -7,7 +7,7 @@ AS $$
DECLARE
r record;
BEGIN
/* first check whether we can convert all the to_value's to timestamptz */
-- first check whether we can convert all the to_value's to timestamptz
BEGIN
PERFORM
FROM pg_catalog.time_partitions
@ -19,7 +19,7 @@ BEGIN
RAISE 'partition column of % cannot be cast to a timestamptz', parent_table_name;
END;
/* now convert the partitions in separate transactions */
-- now convert the partitions in separate transactions
FOR r IN
SELECT partition, from_value, to_value
FROM pg_catalog.time_partitions

View File

@ -7,7 +7,7 @@ AS $$
DECLARE
r record;
BEGIN
/* first check whether we can convert all the to_value's to timestamptz */
-- first check whether we can convert all the to_value's to timestamptz
BEGIN
PERFORM
FROM pg_catalog.time_partitions
@ -19,7 +19,7 @@ BEGIN
RAISE 'partition column of % cannot be cast to a timestamptz', parent_table_name;
END;
/* now convert the partitions in separate transactions */
-- now convert the partitions in separate transactions
FOR r IN
SELECT partition, from_value, to_value
FROM pg_catalog.time_partitions

View File

@ -24,16 +24,16 @@ BEGIN
$cmd$;
END IF;
/*
* Citus creates the array_cat_agg but because of a compatibility
* issue between pg13-pg14, we drop and create it during upgrade.
* And as Citus creates it, there needs to be a dependency to the
* Citus extension, so we create that dependency here.
* We are not using:
* ALTER EXENSION citus DROP/CREATE AGGREGATE array_cat_agg
* because we don't have an easy way to check if the aggregate
* exists with anyarray type or anycompatiblearray type.
*/
--
-- Citus creates the array_cat_agg but because of a compatibility
-- issue between pg13-pg14, we drop and create it during upgrade.
-- And as Citus creates it, there needs to be a dependency to the
-- Citus extension, so we create that dependency here.
-- We are not using:
-- ALTER EXENSION citus DROP/CREATE AGGREGATE array_cat_agg
-- because we don't have an easy way to check if the aggregate
-- exists with anyarray type or anycompatiblearray type.
INSERT INTO pg_depend
SELECT
'pg_proc'::regclass::oid as classid,

View File

@ -24,16 +24,16 @@ BEGIN
$cmd$;
END IF;
/*
* Citus creates the array_cat_agg but because of a compatibility
* issue between pg13-pg14, we drop and create it during upgrade.
* And as Citus creates it, there needs to be a dependency to the
* Citus extension, so we create that dependency here.
* We are not using:
* ALTER EXENSION citus DROP/CREATE AGGREGATE array_cat_agg
* because we don't have an easy way to check if the aggregate
* exists with anyarray type or anycompatiblearray type.
*/
--
-- Citus creates the array_cat_agg but because of a compatibility
-- issue between pg13-pg14, we drop and create it during upgrade.
-- And as Citus creates it, there needs to be a dependency to the
-- Citus extension, so we create that dependency here.
-- We are not using:
-- ALTER EXENSION citus DROP/CREATE AGGREGATE array_cat_agg
-- because we don't have an easy way to check if the aggregate
-- exists with anyarray type or anycompatiblearray type.
INSERT INTO pg_depend
SELECT
'pg_proc'::regclass::oid as classid,

View File

@ -8,13 +8,13 @@ BEGIN
DELETE FROM pg_depend WHERE
objid IN (SELECT oid FROM pg_proc WHERE proname = 'array_cat_agg') AND
refobjid IN (select oid from pg_extension where extname = 'citus');
/*
* We are dropping the aggregates because postgres 14 changed
* array_cat type from anyarray to anycompatiblearray. When
* upgrading to pg14, spegifically when running pg_restore on
* array_cat_agg we would get an error. So we drop the aggregate
* and create the right one on citus_finish_pg_upgrade.
*/
--
-- We are dropping the aggregates because postgres 14 changed
-- array_cat type from anyarray to anycompatiblearray. When
-- upgrading to pg14, spegifically when running pg_restore on
-- array_cat_agg we would get an error. So we drop the aggregate
-- and create the right one on citus_finish_pg_upgrade.
DROP AGGREGATE IF EXISTS array_cat_agg(anyarray);
DROP AGGREGATE IF EXISTS array_cat_agg(anycompatiblearray);
--

View File

@ -8,13 +8,13 @@ BEGIN
DELETE FROM pg_depend WHERE
objid IN (SELECT oid FROM pg_proc WHERE proname = 'array_cat_agg') AND
refobjid IN (select oid from pg_extension where extname = 'citus');
/*
* We are dropping the aggregates because postgres 14 changed
* array_cat type from anyarray to anycompatiblearray. When
* upgrading to pg14, spegifically when running pg_restore on
* array_cat_agg we would get an error. So we drop the aggregate
* and create the right one on citus_finish_pg_upgrade.
*/
--
-- We are dropping the aggregates because postgres 14 changed
-- array_cat type from anyarray to anycompatiblearray. When
-- upgrading to pg14, spegifically when running pg_restore on
-- array_cat_agg we would get an error. So we drop the aggregate
-- and create the right one on citus_finish_pg_upgrade.
DROP AGGREGATE IF EXISTS array_cat_agg(anyarray);
DROP AGGREGATE IF EXISTS array_cat_agg(anycompatiblearray);
--