IntervalStyle 是一个 配置参数,它决定了时间间隔值的显示格式。它还决定了解释模糊时间间隔输入值的规则。
IntervalStyle 在 PostgreSQL 8.4 中被添加。
默认值
IntervalStyle 的默认值是: postgres。
用法
IntervalStyle 可以设置为以下四种值之一:
postgrespostgres_verboseiso_8601sql_standard
有关每个选项输出的不同样式的详细信息,请参阅下面的 示例 部分。
按 PostgreSQL 版本详细信息
IntervalStyle (PostgreSQL 19)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 18)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 17)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 16)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 15)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 14)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 13)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 12)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 11)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 10)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.6)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.5)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 | |
| 需要重启 | false |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.4)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.3)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.2)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.1)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
IntervalStyle (PostgreSQL 9.0)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
IntervalStyle (PostgreSQL 8.4)
| 设置 | postgres |
| 单位 | |
| 类别 | 客户端连接默认值 / 区域设置和格式 |
| 简短描述 | 设置时间间隔值的显示格式。 |
| 扩展描述 | |
| 上下文 | user |
| 变量类型 | enum |
| 来源 | 默认 |
| 最小值 | |
| 最大值 | |
| 枚举值 | postgres, postgres_verbose, sql_standard, iso_8601 |
| 启动值 | postgres |
| 重置值 | postgres |
| 源文件 | |
| 源行 |
文档: IntervalStyle
变更历史
- PostgreSQL 8.4
- 添加于(提交 df7641e2)
示例
IntervalStyle 的用法示例
postgres=# SHOW datestyle; DateStyle ----------- ISO, YMD (1 row) postgres=# SHOW intervalstyle; IntervalStyle --------------- postgres (1 row) postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- 01:00:00 | 1 day (1 row) postgres=# SET intervalstyle TO postgres_verbose; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- @ 1 hour | @ 1 day (1 row) postgres=# SET intervalstyle TO sql_standard; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+----------- 1:00:00 | 1 0:00:00 (1 row) postgres=# SET intervalstyle TO iso_8601; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- PT1H | P1D (1 row)
参考资料
- PostgreSQL 文档: IntervalStyle
另请参阅
反馈
请在此处 提交关于“IntervalStyle”的任何评论、建议或更正。