Skip to content

Commit b78e4a7

Browse files
committed
clean code, comments
1 parent 43fefff commit b78e4a7

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

init.sql

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,17 +646,20 @@ $$ LANGUAGE plpgsql STRICT;
646646
/*
647647
* Set new relname, schema and tablespace
648648
*/
649-
CREATE OR REPLACE FUNCTION @extschema@.alter_partition(relation REGCLASS,
650-
new_name TEXT,
651-
new_schema REGNAMESPACE,
652-
new_tablespace TEXT)
649+
CREATE OR REPLACE FUNCTION @extschema@.alter_partition(
650+
relation REGCLASS,
651+
new_name TEXT,
652+
new_schema REGNAMESPACE,
653+
new_tablespace TEXT)
653654
RETURNS VOID AS
654655
$$
655656
DECLARE
656-
orig_name TEXT;
657-
orig_schema OID;
657+
orig_name TEXT;
658+
orig_schema OID;
659+
658660
BEGIN
659-
SELECT relname, relnamespace FROM pg_class WHERE oid = relation
661+
SELECT relname, relnamespace FROM pg_class
662+
WHERE oid = relation
660663
INTO orig_name, orig_schema;
661664

662665
/* Alter table name */
@@ -680,7 +683,8 @@ $$ LANGUAGE plpgsql;
680683
/*
681684
* Partitioning key
682685
*/
683-
CREATE OR REPLACE FUNCTION @extschema@.get_partition_key(relid REGCLASS)
686+
CREATE OR REPLACE FUNCTION @extschema@.get_partition_key(
687+
relid REGCLASS)
684688
RETURNS TEXT AS
685689
$$
686690
SELECT attname FROM pathman_config WHERE partrel = relid;

src/partition_creation.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,12 +1136,12 @@ build_raw_range_check_tree(char *attname,
11361136
ColumnRef *col_ref = makeNode(ColumnRef);
11371137

11381138
/* Partitioned column */
1139-
col_ref->fields = list_make1(makeString(attname));
1139+
col_ref->fields = list_make1(makeString(attname));
11401140
col_ref->location = -1;
11411141

1142-
and_oper->boolop = AND_EXPR;
1143-
and_oper->args = NIL;
1144-
and_oper->location = -1;
1142+
and_oper->boolop = AND_EXPR;
1143+
and_oper->args = NIL;
1144+
and_oper->location = -1;
11451145

11461146
/* Left comparison (VAR >= start_value) */
11471147
if (!IsInfinite(start_value))
@@ -1156,6 +1156,7 @@ build_raw_range_check_tree(char *attname,
11561156
left_arg->lexpr = (Node *) col_ref;
11571157
left_arg->rexpr = (Node *) left_const;
11581158
left_arg->location = -1;
1159+
11591160
and_oper->args = lappend(and_oper->args, left_arg);
11601161
}
11611162

@@ -1172,9 +1173,11 @@ build_raw_range_check_tree(char *attname,
11721173
right_arg->lexpr = (Node *) col_ref;
11731174
right_arg->rexpr = (Node *) right_const;
11741175
right_arg->location = -1;
1176+
11751177
and_oper->args = lappend(and_oper->args, right_arg);
11761178
}
11771179

1180+
/* (-inf, +inf) */
11781181
if (and_oper->args == NIL)
11791182
elog(ERROR, "cannot create infinite range constraint");
11801183

0 commit comments

Comments
 (0)