diff --git a/src/common/backend/utils/adt/ruleutils.cpp b/src/common/backend/utils/adt/ruleutils.cpp index 1b0849a39..d89abda5b 100644 --- a/src/common/backend/utils/adt/ruleutils.cpp +++ b/src/common/backend/utils/adt/ruleutils.cpp @@ -1641,7 +1641,7 @@ static int get_table_attribute( find_nextval_seqoid_walker(adexpr, &tableinfo->autoinc_seqoid); tableinfo->autoinc_attnum = attrdef->adnum; appendStringInfo(buf, " %s", adsrc); - } else { + } else if (pg_strcasecmp(adsrc, "") != 0) { appendStringInfo(buf, " DEFAULT %s", adsrc); } if (isOnUpdate) { diff --git a/src/test/regress/expected/function_get_table_def.out b/src/test/regress/expected/function_get_table_def.out index b9251e628..6cc37c473 100644 --- a/src/test/regress/expected/function_get_table_def.out +++ b/src/test/regress/expected/function_get_table_def.out @@ -788,7 +788,7 @@ select * from pg_get_tabledef('test'); CREATE TABLE test ( + a integer, + b timestamp without time zone DEFAULT now() ON UPDATE CURRENT_TIMESTAMP,+ - c timestamp with time zone DEFAULT ON UPDATE CURRENT_TIMESTAMP(5) + + c timestamp with time zone ON UPDATE CURRENT_TIMESTAMP(5) + ) + WITH (orientation=row, compression=no); (1 row)