All Products
Search
Document Center

Hologres:Set returning functions

Last Updated:Jul 12, 2024

Hologres is compatible with PostgreSQL and allows you to use the standard PostgreSQL syntax for data development.

The following table describes the set returning functions supported by Hologres. The functions supported by Hologres are only a subset of the PostgreSQL functions. For more information about how to use these functions, see Set Returning Functions in the PostgreSQL documentation.

Function

Description

Use case

Result

Remarks

generate_series(start, stop)

Generates a numeric sequence with a step size of 1 from the value specified by start to the value specified by stop.

generate_series(2,4)

2

3

4

(3 rows)

This function is supported by Hologres Query Engine (HQE) in Hologres V2.0 or later. You need to configure the Grand Unified Configuration (GUC) parameters.

set hg_experimental_enable_hqe_table_function = on;

generate_series(start, stop, step)

Generates a numeric sequence with a specified step size from the value specified by start to the value specified by stop.

Note

The parameters are of the INT, BIGINT, or NUMERIC data type.

generate_series(5,1,-2)

5

3

1

(3 rows)

This function is supported by HQE in Hologres V2.0 or later. You need to configure the GUC parameters.

set hg_experimental_enable_hqe_table_function = on;

generate_series(start, stop, step interval)

Generates a numeric sequence with a specified step size from the value specified by start to the value specified by stop.

Note

The parameters are of the TIMESTAMP or TIMESTAMP WITH TIME ZONE data type.

generate_series('2008-03-01 00:00'::timestamp, '2008-03-04 12:00', '10 hours')

2008-03-01 00:00:00

2008-03-01 10:00:00

2008-03-01 20:00:00

2008-03-02 06:00:00

2008-03-02 16:00:00

2008-03-03 02:00:00

2008-03-03 12:00:00

2008-03-03 22:00:00

2008-03-04 08:00:00

(9 rows)

N/A.

generate_subscripts(array anyarray, dim int)

Generates a set of valid subscripts for the specified dimension of a given array.

generate_subscripts('{NULL,1,NULL,2}'::int[], 1)

1

2

3

4

(4 rows)

N/A.