Fix error checks and messages

velioglu/create_timeseries_table
Burak Velioglu 2021-08-24 16:02:52 +03:00
parent c6705ebbd1
commit aad741a2e2
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 7 additions and 7 deletions

View File

@ -52,8 +52,8 @@ static void ErrorIfNotSuitableToConvertTimeseriesTable(Oid relationId,
/*
* create_timeseries_table gets a table name, partition interval
* optional pre and post make partition counts, compression and retention threshold
* then it creates a timeseries table.
* optional post and pre make interval count, start_from time,
* compression and retention threshold then it creates a timeseries table.
*/
Datum
create_timeseries_table(PG_FUNCTION_ARGS)
@ -69,8 +69,10 @@ create_timeseries_table(PG_FUNCTION_ARGS)
if (!PG_ARGISNULL(3) && !PG_ARGISNULL(4))
{
ereport(ERROR, (errmsg("either premakeintervalcount or startfrom "
ereport(ERROR, (errmsg("either premake_interval_count or start_from "
"should be provided")));
PG_RETURN_VOID();
}
Oid relationId = PG_GETARG_OID(0);
@ -135,8 +137,8 @@ ErrorIfNotSuitableToConvertTimeseriesTable(Oid relationId, Interval *partitionIn
PartitionKey partitionKey = RelationGetPartitionKey(pgPartitionedTableRelation);
/* Table related checks */
if (!PartitionedTable(relationId) || partitionKey->strategy !=
PARTITION_STRATEGY_RANGE)
if (!PartitionedTable(relationId) ||
partitionKey->strategy != PARTITION_STRATEGY_RANGE)
{
ereport(ERROR, (errmsg("table must be partitioned by range to convert "
"it to timeseries table")));
@ -225,8 +227,6 @@ InitiateTimeseriesTablePartitions(Oid relationId, bool useStartFrom)
SPI_finish();
}
/* TODO: If result is not true, error out! (Check metadata tables after erroring out!) */
SPI_execute(initiateTimeseriesPartitionsCommand->data, readOnly, 0);
SPI_finish();
}