Skip to content

Commit

Permalink
Style fixes for last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Euler Taveira committed Mar 27, 2018
1 parent ce82d73 commit d86a13b
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions wal2json.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef struct
bool include_type_oids; /* include data type oids */
bool include_typmod; /* include typmod in types */
bool include_not_null; /* include not-null constraints */
bool include_unchanged_toast; /* include unchanged TOAST field values in output */
bool include_unchanged_toast; /* include unchanged TOAST field values in output */

bool pretty_print; /* pretty-print JSON? */
bool write_in_chunks; /* write in chunks? */
Expand Down Expand Up @@ -287,6 +287,19 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, bool is
errmsg("could not parse value \"%s\" for parameter \"%s\"",
strVal(elem->arg), elem->defname)));
}
else if (strcmp(elem->defname, "include-unchanged-toast") == 0)
{
if (elem->arg == NULL)
{
elog(LOG, "include-unchanged-toast is null");
data->include_unchanged_toast = true;
}
else if (!parse_bool(strVal(elem->arg), &data->include_unchanged_toast))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"",
strVal(elem->arg), elem->defname)));
}
else if (strcmp(elem->defname, "filter-tables") == 0)
{
char *rawstr;
Expand Down Expand Up @@ -338,19 +351,6 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, bool is
pfree(rawstr);
}
}
else if (strcmp(elem->defname, "include-unchanged-toast") == 0)
{
if (elem->arg == NULL)
{
elog(LOG, "include-unchanged-toast is null");
data->include_unchanged_toast = true;
}
else if (!parse_bool(strVal(elem->arg), &data->include_unchanged_toast))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"",
strVal(elem->arg), elem->defname)));
}
else
{
ereport(ERROR,
Expand Down Expand Up @@ -613,10 +613,10 @@ tuple_to_stringinfo(LogicalDecodingContext *ctx, TupleDesc tupdesc, HeapTuple tu
if (isnull && replident)
continue;

if (!isnull && typisvarlena && VARATT_IS_EXTERNAL_ONDISK(origval) && !(data->include_unchanged_toast))
if (!isnull && typisvarlena && VARATT_IS_EXTERNAL_ONDISK(origval) && !data->include_unchanged_toast)
{
/* With include-unchanged-toast=0, unchanged TOAST Datum do not need to be output */
elog(DEBUG1, "column \"%s\" has an unchanged TOAST - excluding", NameStr(attr->attname));
/* TOAST value is not returned if include-unchanged-toast is specified */
elog(DEBUG2, "column \"%s\" has an unchanged TOAST - excluding", NameStr(attr->attname));
continue;
}

Expand Down

0 comments on commit d86a13b

Please sign in to comment.