mirror of https://github.com/citusdata/citus.git
Add columns to pg_dist_object for distributed functions
This PR simply adds the columns to pg_dist_object and implements the necessary metadata changes to keep track of distribution argument of the functions/procedures.pull/2979/head
parent
af9fb9f785
commit
cde6b02858
|
@ -38,6 +38,11 @@ CREATE TABLE citus.pg_dist_object (
|
||||||
object_names text[] DEFAULT NULL,
|
object_names text[] DEFAULT NULL,
|
||||||
object_args text[] DEFAULT NULL,
|
object_args text[] DEFAULT NULL,
|
||||||
|
|
||||||
|
-- fields that are only valid for distributed
|
||||||
|
-- functions/procedures
|
||||||
|
distribution_argument_index int,
|
||||||
|
colocationid int,
|
||||||
|
|
||||||
CONSTRAINT pg_dist_object_pkey PRIMARY KEY (classid, objid, objsubid)
|
CONSTRAINT pg_dist_object_pkey PRIMARY KEY (classid, objid, objsubid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -79,13 +79,17 @@ BEGIN
|
||||||
RETURNING
|
RETURNING
|
||||||
type,
|
type,
|
||||||
object_names,
|
object_names,
|
||||||
object_args
|
object_args,
|
||||||
|
distribution_argument_index,
|
||||||
|
colocationid
|
||||||
)
|
)
|
||||||
INSERT INTO citus.pg_dist_object (classid, objid, objsubid)
|
INSERT INTO citus.pg_dist_object (classid, objid, objsubid, distribution_argument_index, colocationid)
|
||||||
SELECT
|
SELECT
|
||||||
address.classid,
|
address.classid,
|
||||||
address.objid,
|
address.objid,
|
||||||
address.objsubid
|
address.objsubid,
|
||||||
|
naming.distribution_argument_index,
|
||||||
|
naming.colocationid
|
||||||
FROM
|
FROM
|
||||||
old_records naming,
|
old_records naming,
|
||||||
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
||||||
|
|
|
@ -79,13 +79,17 @@ BEGIN
|
||||||
RETURNING
|
RETURNING
|
||||||
type,
|
type,
|
||||||
object_names,
|
object_names,
|
||||||
object_args
|
object_args,
|
||||||
|
distribution_argument_index,
|
||||||
|
colocationid
|
||||||
)
|
)
|
||||||
INSERT INTO citus.pg_dist_object (classid, objid, objsubid)
|
INSERT INTO citus.pg_dist_object (classid, objid, objsubid, distribution_argument_index, colocationid)
|
||||||
SELECT
|
SELECT
|
||||||
address.classid,
|
address.classid,
|
||||||
address.objid,
|
address.objid,
|
||||||
address.objsubid
|
address.objsubid,
|
||||||
|
naming.distribution_argument_index,
|
||||||
|
naming.colocationid
|
||||||
FROM
|
FROM
|
||||||
old_records naming,
|
old_records naming,
|
||||||
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
||||||
|
|
|
@ -28,6 +28,9 @@ typedef struct FormData_pg_dist_object
|
||||||
Oid objid; /* object id of the distributed object */
|
Oid objid; /* object id of the distributed object */
|
||||||
int32 objsubid; /* object sub id of the distributed object, eg. attnum */
|
int32 objsubid; /* object sub id of the distributed object, eg. attnum */
|
||||||
|
|
||||||
|
uint32 distribution_argument_index; /* only valid for distributed functions/procedures */
|
||||||
|
uint32 colocationid; /* only valid for distributed functions/procedures */
|
||||||
|
|
||||||
#ifdef CATALOG_VARLEN /* variable-length fields start here */
|
#ifdef CATALOG_VARLEN /* variable-length fields start here */
|
||||||
text type;
|
text type;
|
||||||
text[] object_names;
|
text[] object_names;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* pg_dist_object.h
|
||||||
|
* definition of the relation that holds the object information on the
|
||||||
|
* cluster (pg_dist_object).
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019, Citus Data, Inc.
|
||||||
|
*
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PG_DIST_OBJECT_H
|
||||||
|
#define PG_DIST_OBJECT_H
|
||||||
|
|
||||||
|
/* ----------------
|
||||||
|
* compiler constants for pg_dist_object
|
||||||
|
* ----------------
|
||||||
|
*/
|
||||||
|
#define Natts_pg_dist_object 8
|
||||||
|
#define Anum_pg_dist_object_classid 1
|
||||||
|
#define Anum_pg_dist_object_objid 2
|
||||||
|
#define Anum_pg_dist_object_objsubid 3
|
||||||
|
#define Anum_pg_dist_object_type 4
|
||||||
|
#define Anum_pg_dist_object_object_names 5
|
||||||
|
#define Anum_pg_dist_object_object_args 6
|
||||||
|
#define Anum_pg_dist_object_distribution_arg_index 7
|
||||||
|
#define Anum_pg_dist_object_colocation_id 8
|
||||||
|
|
||||||
|
#endif /* PG_DIST_OBJECT_H */
|
Loading…
Reference in New Issue