DEV Community

Qing
Qing

Posted on

Data Types(9)

Pseudo-Types

openGauss type system contains a number of special-purpose entries that are collectively called pseudo-types. A pseudo-type cannot be used as a column data type, but it can be used to declare a function's argument or result type.

Each of the available pseudo-types is useful in situations where a function's behavior does not correspond to simply taking or returning a value of a specific SQL data type. Table 16 lists all pseudo-types.

Table 16 Pseudo-types

Image description

Functions coded in C (whether built in or dynamically loaded) can be declared to accept or return any of these pseudo-types. It is up to the user to ensure that the function will behave safely when a pseudo-type is used as an argument type.

Functions coded in procedural languages can use pseudo-types only as allowed by their implementation languages. At present, the procedural languages all forbid use of a pseudo-type as argument type, and allow only void and record as a result type. Some also support polymorphic functions using the anyelement, anyarray, anynonarray, anyenum, and anyrange types.

The internal pseudo-type is used to declare functions that are meant only to be called internally by the database system, and not by direct invocation in an SQL query. If a function has at least one internal-type argument then it cannot be called from SQL. You are advised not to create any function that is declared to return internal unless it has at least one internal argument.

Example:

Image description

Data Types Supported by Column-store Tables

Table 17 lists the data types supported by column-store tables.

Table 17 Data types supported by column-store tables

Image description
Image description

XML Types

openGauss supports the XML types. The following is an example:

Image description

Image description

Top comments (0)