第八章 資料型別

丹心明月發表於2021-01-02

Chapter 8. Data Types

第八章.資料型別

PostgreSQL has a rich set of native data types available to users. Users can add new types to PostgreSQL using the CREATE TYPE command.

PostgreSQL有豐富的原生支援的資料型別。使用者也可以使用 CREATE TYPE命令自定義資料型別。

 

Table 8.1 shows all the built-in general-purpose data types. Most of the alternative names listed in the “Aliases” column are the names used internally by PostgreSQL for historical reasons. In addition,some internally used or deprecated types are available, but are not listed here.

表8.1中為內建支援的資料型別。在ALIASES列中列出的名字,大部分都是出於歷史原因而被PostgreSQL內部使用的。 此外,還提供了一些內部使用或不推薦使用的型別,但此處未列出。

Compatibility

相容性

The following types (or spellings thereof) are specified by SQL: bigint, bit, bit varying, boolean, char, character varying, character, varchar,date, double precision, integer, interval, numeric, decimal, real,smallint, time (with or without time zone), timestamp (with or without time zone), xml.

SQL指定了以下型別(或其拼寫):bigint, bit, bit varying, boolean, char, character varying, character, varchar,date, double precision, integer, interval, numeric, decimal, real,smallint, time (帶或不帶時區), timestamp (帶或不帶時區), xml.

 

Each data type has an external representation determined by its input and output functions. Many of the built-in types have obvious external formats. However, several types are either unique to PostgreSQL,such as geometric paths, or have several possible formats, such as the date and time types. Some of the input and output functions are not invertible, i.e., the result of an output function might lose accuracy when compared to the original input.

每種資料型別都有一個由其輸入和輸出函式確定的外部表示形式。許多內建型別具有明顯的外部格式。但是,有幾種型別對於PostgreSQL是唯一的,例如幾何路徑,或者有幾種可能的格式,例如日期和時間型別。一些輸入和輸出函式不可逆,即,與原始輸入相比,輸出函式的結果可能會失去準確性。

相關文章