mirror of https://github.com/citusdata/citus.git
Merge pull request #1042 from citusdata/feature/column_name
Expose the column_to_column_name UDFpull/1027/head
commit
b3593442c4
|
@ -9,7 +9,7 @@ EXTVERSIONS = 5.0 5.0-1 5.0-2 \
|
||||||
5.1-1 5.1-2 5.1-3 5.1-4 5.1-5 5.1-6 5.1-7 5.1-8 \
|
5.1-1 5.1-2 5.1-3 5.1-4 5.1-5 5.1-6 5.1-7 5.1-8 \
|
||||||
5.2-1 5.2-2 5.2-3 5.2-4 \
|
5.2-1 5.2-2 5.2-3 5.2-4 \
|
||||||
6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16 6.0-17 6.0-18 \
|
6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16 6.0-17 6.0-18 \
|
||||||
6.1-1 6.1-2 6.1-3
|
6.1-1 6.1-2 6.1-3 6.1-4
|
||||||
|
|
||||||
# All citus--*.sql files in the source directory
|
# All citus--*.sql files in the source directory
|
||||||
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
||||||
|
@ -101,6 +101,8 @@ $(EXTENSION)--6.1-2.sql: $(EXTENSION)--6.1-1.sql $(EXTENSION)--6.1-1--6.1-2.sql
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
$(EXTENSION)--6.1-3.sql: $(EXTENSION)--6.1-2.sql $(EXTENSION)--6.1-2--6.1-3.sql
|
$(EXTENSION)--6.1-3.sql: $(EXTENSION)--6.1-2.sql $(EXTENSION)--6.1-2--6.1-3.sql
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
|
$(EXTENSION)--6.1-4.sql: $(EXTENSION)--6.1-3.sql $(EXTENSION)--6.1-3--6.1-4.sql
|
||||||
|
cat $^ > $@
|
||||||
|
|
||||||
NO_PGXS = 1
|
NO_PGXS = 1
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* citus--6.1-3--6.1-4.sql */
|
||||||
|
|
||||||
|
SET search_path = 'pg_catalog';
|
||||||
|
|
||||||
|
CREATE FUNCTION column_to_column_name(table_name regclass, column_var_text text)
|
||||||
|
RETURNS text
|
||||||
|
LANGUAGE C STRICT
|
||||||
|
AS 'MODULE_PATHNAME', $$column_to_column_name$$;
|
||||||
|
COMMENT ON FUNCTION column_to_column_name(table_name regclass, column_var_text text)
|
||||||
|
IS 'convert the textual Var representation to a column name';
|
||||||
|
|
||||||
|
RESET search_path;
|
|
@ -1,6 +1,6 @@
|
||||||
# Citus extension
|
# Citus extension
|
||||||
comment = 'Citus distributed database'
|
comment = 'Citus distributed database'
|
||||||
default_version = '6.1-3'
|
default_version = '6.1-4'
|
||||||
module_pathname = '$libdir/citus'
|
module_pathname = '$libdir/citus'
|
||||||
relocatable = false
|
relocatable = false
|
||||||
schema = pg_catalog
|
schema = pg_catalog
|
||||||
|
|
|
@ -211,11 +211,11 @@ CREATE TABLE customers (
|
||||||
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey)
|
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey)
|
||||||
VALUES
|
VALUES
|
||||||
('customers'::regclass, 'h', column_name_to_column('customers'::regclass, 'id'));
|
('customers'::regclass, 'h', column_name_to_column('customers'::regclass, 'id'));
|
||||||
SELECT partmethod, partkey FROM pg_dist_partition
|
SELECT partmethod, column_to_column_name(logicalrelid, partkey) FROM pg_dist_partition
|
||||||
WHERE logicalrelid = 'customers'::regclass;
|
WHERE logicalrelid = 'customers'::regclass;
|
||||||
partmethod | partkey
|
partmethod | column_to_column_name
|
||||||
------------+------------------------------------------------------------------------------------------------------------------------
|
------------+-----------------------
|
||||||
h | {VAR :varno 1 :varattno 1 :vartype 20 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1}
|
h | id
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- make one huge shard and manually inspect shard row
|
-- make one huge shard and manually inspect shard row
|
||||||
|
|
|
@ -61,6 +61,7 @@ ALTER EXTENSION citus UPDATE TO '6.0-18';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-1';
|
ALTER EXTENSION citus UPDATE TO '6.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-2';
|
ALTER EXTENSION citus UPDATE TO '6.1-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-3';
|
ALTER EXTENSION citus UPDATE TO '6.1-3';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '6.1-4';
|
||||||
-- ensure no objects were created outside pg_catalog
|
-- ensure no objects were created outside pg_catalog
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM pg_depend AS pgd,
|
FROM pg_depend AS pgd,
|
||||||
|
|
|
@ -160,7 +160,7 @@ CREATE TABLE customers (
|
||||||
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey)
|
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey)
|
||||||
VALUES
|
VALUES
|
||||||
('customers'::regclass, 'h', column_name_to_column('customers'::regclass, 'id'));
|
('customers'::regclass, 'h', column_name_to_column('customers'::regclass, 'id'));
|
||||||
SELECT partmethod, partkey FROM pg_dist_partition
|
SELECT partmethod, column_to_column_name(logicalrelid, partkey) FROM pg_dist_partition
|
||||||
WHERE logicalrelid = 'customers'::regclass;
|
WHERE logicalrelid = 'customers'::regclass;
|
||||||
|
|
||||||
-- make one huge shard and manually inspect shard row
|
-- make one huge shard and manually inspect shard row
|
||||||
|
|
|
@ -61,6 +61,7 @@ ALTER EXTENSION citus UPDATE TO '6.0-18';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-1';
|
ALTER EXTENSION citus UPDATE TO '6.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-2';
|
ALTER EXTENSION citus UPDATE TO '6.1-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.1-3';
|
ALTER EXTENSION citus UPDATE TO '6.1-3';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '6.1-4';
|
||||||
|
|
||||||
-- ensure no objects were created outside pg_catalog
|
-- ensure no objects were created outside pg_catalog
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
|
|
Loading…
Reference in New Issue