All Products
Search
Document Center

Hologres:Default values

Last Updated:Mar 26, 2026

This document describes how Hologres handles default values when writing data across different scenarios: SQL, Flink, and Data Integration of DataWorks.

Baseline rule: If no default value is configured for a field and no value is supplied during a write operation, the system fills NULL. The tables and sections below describe how this baseline changes depending on your write path and parameters.

Behavior summary

The following table summarizes default value behavior across all write paths. Use it to quickly identify the expected behavior before diving into the details.

Write pathField typeDefault value configured?Behavior
SQLNullableYesFills the default value (if field is omitted)
SQLNullableNoFills NULL
SQLNon-nullYesFills the default value (if field is omitted)
Flink — JDBC modeNullableNoFills NULL
Flink — JDBC modeNullableYesFills the default value if mutatetype=InsertOrUpdate; otherwise fills NULL
Flink — JDBC modeNon-nullNoReports an error if EnableDefaultForNotNullColumn=false; fills a data type-based default if true
Flink — JDBC modeNon-nullYesFills the default value (Hologres engine calculates it); in versions earlier than V2.0, this may prevent fixed plans from being used
Flink — Fixed copy modeNullableNoFills NULL
Flink — Fixed copy modeNullableYesFills the default value
Flink — Fixed copy modeNon-nullNoReports an error
Flink — Fixed copy modeNon-nullYesFills the default value
Flink — BulkLoad mode (HQEcopy)NullableNoFills NULL
Flink — BulkLoad mode (HQEcopy)NullableYesFills the default value
Flink — BulkLoad mode (HQEcopy)Non-nullNoReports an error
Flink — BulkLoad mode (HQEcopy)Non-nullYesFills the default value
DataWorks — DataX batchNullableNoFills NULL
DataWorks — DataX batchNullableYes, conflictMode=ReplaceFills NULL
DataWorks — DataX batchNullableYes, conflictMode=UpdateFills the default value
DataWorks — DataX batchNon-nullNo, default.enable=true (default)Fills a data type-based default (e.g., "" or 0)
DataWorks — DataX batchNon-nullNo, default.enable=falseReports an error
DataWorks — DataX batchNon-nullYes, default.enable=true (default)Fills the default value
DataWorks — DataX batchNon-nullYes, default.enable=falseFills the default value; in versions earlier than V2.0, fixed plans may fail
DataWorks — StreamX real-timeNullableNoFills NULL
DataWorks — StreamX real-timeNullableYes, conflictMode=Replace or IgnoreFills NULL
DataWorks — StreamX real-timeNullableYes, conflictMode=UpdateFills the default value
DataWorks — StreamX real-timeNon-nullNo, default.enable=true (default)Fills a data type-based default (e.g., "" or 0)
DataWorks — StreamX real-timeNon-nullNo, default.enable=falseReports an error
DataWorks — StreamX real-timeNon-nullYes, default.enable=true (default)Fills the default value
DataWorks — StreamX real-timeNon-nullYes, default.enable=falseFills the default value; in versions earlier than V2.0, fixed plans may fail

SQL scenarios

If a default value is configured for a field and no value is specified in a write or update operation, Hologres automatically fills the default value for that field.

The following examples use this table:

BEGIN;
CREATE TABLE default_test (
    a int NOT NULL DEFAULT 2023,
    b timestamptz DEFAULT '2023-11-17 10:11:33.276+08',
    PRIMARY KEY (a)
);
COMMIT;

Example 1: Specify values for both columns. The specified values overwrite the defaults.

-- Specify values for column a and column b.
INSERT INTO default_test VALUES (1, NULL);
-- Query the table.
SELECT * FROM default_test;

Result:

a    b
1    \N

Example 2: Omit column b. The system fills the default value for column b.

-- Omit column b.
INSERT INTO default_test (a) VALUES (2);
-- Query the table.
SELECT * FROM default_test;

Result:

a    b
1    \N
2    2023-11-17 10:11:33.276+08

Example 3: Run INSERT ON CONFLICT DO NOTHING without specifying column a (the primary key). The system writes the value for column b and fills the default value for column a.

-- Column a is omitted; the system fills the default value (2023).
INSERT INTO default_test (b) VALUES ('2023-11-18 10:11:33.276+08') ON CONFLICT (a) DO NOTHING;
-- Query the table.
SELECT * FROM default_test;

Result:

a       b
2       2023-11-17 10:11:33.276+08
2023    2023-11-18 10:11:33.276+08
1       \N

Example 4: Run INSERT ON CONFLICT DO UPDATE with explicit values for both columns. The specified values overwrite the defaults.

-- Specify values for both columns; specified values take precedence.
INSERT INTO default_test (a, b) VALUES (2, null) ON CONFLICT (a) DO UPDATE SET (a,b) = ROW(EXCLUDED.*);
-- Query the table.
SELECT * FROM default_test;

Result:

a       b
1       \N
2023    2023-11-18 10:11:33.276+08
2       \N

Example 5: Run INSERT ON CONFLICT DO UPDATE updating only column b. Column a is not updated.

-- Only column b is updated; column a remains unchanged.
INSERT INTO default_test (a, b) VALUES (2023, null) ON CONFLICT (a) DO UPDATE SET b = EXCLUDED.b;
-- Query the table.
SELECT * FROM default_test;

Result:

a       b
2       \N
1       \N
2023    \N

Write data using Flink

For more information about Flink write modes, see Hologres.

JDBC mode

The following rules apply to fields for which no values are specified.

Nullable fields

  • No default value configured: the system fills NULL.

  • Default value configured: the system fills the default value if mutatetype is set to InsertOrUpdate; otherwise, the system fills NULL.

Non-null fields

  • No default value configured:

    • EnableDefaultForNotNullColumn=false: the system reports an error.

    • EnableDefaultForNotNullColumn=true: Holo Client fills a data type-based default (for example, an empty string "").

  • Default value configured:

    • EnableDefaultForNotNullColumn=false: the Hologres engine calculates and writes the default value. In Hologres versions earlier than V2.0, this may prevent fixed plans from being used and cause performance issues.

    • EnableDefaultForNotNullColumn=true: Holo Client fills a data type-based default.

You can manually upgrade your Hologres instance or join the Hologres DingTalk group to apply for an upgrade. For more information, see the "Manual upgrade" section in Upgrade an instance. To get online support, see Obtain online support for Hologres.

Fixed copy mode

Only UPDATE and IGNORE operations are supported in this mode. When you update specific fields, only those fields are updated; all other fields remain unchanged. To achieve a REPLACE effect, declare all fields in the Flink DDL statement.

The following rules apply to fields for which no values are specified.

Nullable fields

  • No default value configured: the system fills NULL.

  • Default value configured: the system fills the default value.

Non-null fields

  • No default value configured: the system reports an error.

  • Default value configured: the system fills the default value.

BulkLoad mode (HQEcopy)

UPDATE operations are not supported in this mode. The following rules apply to fields for which no values are specified.

Nullable fields

  • No default value configured: the system fills NULL.

  • Default value configured: the system fills the default value.

Non-null fields

  • No default value configured: the system reports an error.

  • Default value configured: the system fills the default value.

Write data using Data Integration of DataWorks

DataX-based batch synchronization

DataX of Data Integration supports batch synchronization from a table or a database. For more information, see Hologres data source. JDBC mode is used automatically. The following rules apply to fields for which no values are specified.

Nullable fields

  • No default value configured: the system fills NULL.

  • Default value configured:

    • conflictMode=Replace: the system fills NULL.

    • conflictMode=Update: the system fills the default value.

Non-null fields

  • No default value configured:

    • default.enable=true (default): Holo Client fills a data type-based default (for example, an empty string "" or 0).

    • default.enable=false: the system reports an error.

  • Default value configured:

    • default.enable=true (default): the system fills the default value.

    • default.enable=false: the system also fills the default value. In Hologres versions earlier than V2.0, fixed plans may fail to be used, and performance issues may occur.

StreamX-based real-time synchronization

StreamX of Data Integration supports real-time synchronization from a table. For more information, see Hologres data source. JDBC mode is used automatically. The following rules apply to fields for which no values are specified.

Nullable fields

  • No default value configured: the system fills NULL.

  • Default value configured:

    • conflictMode=Replace or conflictMode=Ignore: the system fills NULL.

    • conflictMode=Update: the system fills the default value.

Non-null fields

  • No default value configured:

    • default.enable=true (default): Holo Client fills a data type-based default (for example, an empty string "" or 0).

    • default.enable=false: the system reports an error.

  • Default value configured:

    • default.enable=true (default): the system fills the default value.

    • default.enable=false: the system also fills the default value. In Hologres versions earlier than V2.0, fixed plans may fail to be used, and performance issues may occur.

You can manually upgrade your Hologres instance or join the Hologres DingTalk group to apply for an upgrade. For more information, see the "Manual upgrade" section in Upgrade an instance. To get online support, see Obtain online support for Hologres.

Holo Client default value mapping

When you use Flink or Data Integration of DataWorks to write data in JDBC mode, Holo Client handles the write layer. If you specify values for specific fields when you write data, the default.enable parameter is automatically set to true (equivalent to enableDefaultForNotNullColumn=true). If a field has no value and no configured default, Holo Client fills a data type-based default automatically. The following table lists these defaults.

TypeDefault filled by Holo Client
SMALLINT0
INTEGER0
BIGINT0
REAL0.0
DOUBLE PRECISION0.0
DECIMAL0
BOOLEANfalse
VARCHAR(n)"" (empty string)
CHAR(n)"" (empty string)
TEXT"" (empty string)
TIMESTAMPTZ1970-01-01 08:00:00
TIMESTAMP1970-01-01 08:00:00
DATE1970-01-01
TIMETZ08:00:00
TIME08:00:00
JSON and JSONBCannot write a default value
BYTEACannot write a default value
RoaringBitmapCannot write a default value
BIT(n)Cannot write a default value
VARBIT(n)Cannot write a default value
INTERVALCannot write a default value