Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid segfaults on 1.5-upgraded installations before 10e6c71 [WiP]#212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
x4m wants to merge3 commits intopostgrespro:master
base:master
Choose a base branch
Loading
fromx4m:upgrade_fix
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionssrc/include/pathman.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,6 +46,7 @@
*/
#define PATHMAN_CONFIG"pathman_config"
#define Natts_pathman_config4
#define Natts_pathman_config_historic5
#define Anum_pathman_config_partrel1/* partitioned relation (regclass) */
#define Anum_pathman_config_expr2/* partition expression (original) */
#define Anum_pathman_config_parttype3/* partitioning type (1|2) */
Expand Down
9 changes: 6 additions & 3 deletionssrc/init.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -649,6 +649,7 @@ pathman_config_contains_relation(Oid relid, Datum *values, bool *isnull,
Snapshotsnapshot;
HeapTuplehtup;
boolcontains_rel = false;
TupleDesctupleDescr;

ScanKeyInit(&key[0],
Anum_pathman_config_partrel,
Expand All@@ -657,13 +658,15 @@ pathman_config_contains_relation(Oid relid, Datum *values, bool *isnull,

/* Open PATHMAN_CONFIG with latest snapshot available */
rel = heap_open_compat(get_pathman_config_relid(false), AccessShareLock);
tupleDescr = RelationGetDescr(rel);

/* Check that 'partrel' column is of regclass type */
Assert(TupleDescAttr(RelationGetDescr(rel),
Assert(TupleDescAttr(tupleDescr,
Anum_pathman_config_partrel - 1)->atttypid == REGCLASSOID);

/* Check that number of columns == Natts_pathman_config */
Assert(RelationGetDescr(rel)->natts == Natts_pathman_config);
Assert(tupleDescr->natts == Natts_pathman_config
|| tupleDescr->natts == Natts_pathman_config_historic);

snapshot = RegisterSnapshot(GetLatestSnapshot());
#if PG_VERSION_NUM >= 120000
Expand All@@ -680,7 +683,7 @@ pathman_config_contains_relation(Oid relid, Datum *values, bool *isnull,
if (values && isnull)
{
htup = heap_copytuple(htup);
heap_deform_tuple(htup,RelationGetDescr(rel), values, isnull);
heap_deform_tuple(htup,tupleDescr, values, isnull);

/* Perform checks for non-NULL columns */
Assert(!isnull[Anum_pathman_config_partrel - 1]);
Expand Down
12 changes: 6 additions & 6 deletionssrc/partition_creation.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -124,8 +124,8 @@ create_single_range_partition_internal(Oid parent_relid,
init_callback_paramscallback_params;
List *trigger_columns = NIL;
Node *expr;
Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];


/*
Expand DownExpand Up@@ -361,8 +361,8 @@ Oid
create_partitions_for_value_internal(Oid relid, Datum value, Oid value_type)
{
Oidpartid = InvalidOid; /* last created partition (or InvalidOid) */
Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];

/* Get both PartRelationInfo & PATHMAN_CONFIG contents for this relation */
if (pathman_config_contains_relation(relid, values, isnull, NULL, NULL))
Expand DownExpand Up@@ -2024,8 +2024,8 @@ build_partitioning_expression(Oid parent_relid,
List **columns)/* ret val #2 */
{
/* Values extracted from PATHMAN_CONFIG */
Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];
char *expr_cstr;
Node *expr;

Expand Down
12 changes: 10 additions & 2 deletionssrc/pl_funcs.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -794,8 +794,8 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
uint32children_count;

Relationpathman_config;
Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];
HeapTuplehtup;

Oidexpr_type;
Expand DownExpand Up@@ -895,6 +895,14 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
values[Anum_pathman_config_expr - 1]= CStringGetTextDatum(expression);
isnull[Anum_pathman_config_expr - 1]= false;

/*
* In case of 1.5 update before 10e6c71 there are actually 5 attributes in
* pathman_config description (including cooked expression). To avoid
* potential problems we allocate 5th attribute and initialize it with null.
*/
values[Natts_pathman_config_historic - 1]= (Datum) 0;
isnull[Natts_pathman_config_historic - 1]= true;

/* Insert new row into PATHMAN_CONFIG */
pathman_config = heap_open_compat(get_pathman_config_relid(false), RowExclusiveLock);

Expand Down
4 changes: 2 additions & 2 deletionssrc/pl_range_funcs.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,8 +110,8 @@ create_single_range_partition_pl(PG_FUNCTION_ARGS)
RangeVar *partition_name_rv;
char *tablespace;

Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];


/* Handle 'parent_relid' */
Expand Down
4 changes: 2 additions & 2 deletionssrc/relation_info.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -350,8 +350,8 @@ get_pathman_relation_info(Oid relid)
{
PartRelationInfo *prel = NULL;
ItemPointerDataiptr;
Datumvalues[Natts_pathman_config];
boolisnull[Natts_pathman_config];
Datumvalues[Natts_pathman_config_historic];
boolisnull[Natts_pathman_config_historic];
boolfound;

/*
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp