↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 函数百科 / 窗口函数

FUNCTION窗口函数

last_value

返回在窗口帧的最后一行求得的value。

Returns value evaluated at the row that is the last row of the window frame.

窗口函数 引入 9.0(基线) 现存至 20 devel 1 条签名 1 次签名变更

分组
窗口函数
签名数
1 条
引入版本
9.0(基线)
状态
现存
签名变更
1 次
本版来源
本站译文

PostgreSQL 18 手册 · 9.22 窗口函数 官方文档

版本轨迹

相对 PostgreSQL 17 无变化。

签名

PostgreSQL 18 里 last_value 的 1 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。说明取自本站手册译文:标「沿用」的借用了另一版的译文,标「EN」的本站暂无译文、按英文原文显示。

  1. last_value ( value anyelement ) → anyelement

    返回在窗口帧的最后一行求得的value。

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。

  1. PostgreSQL 19 ← 18 签名变更

    last_value ( value anyelement ) [ null treatment ] → anyelement last_value ( value anyelement ) → anyelement

  2. PostgreSQL 13 ← 12 手册重排

    这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。

签名矩阵

每条签名在给出了签名的 18 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。

存在 不存在

签名 9.09.19.29.39.49.59.61011121314151617181920
last_value ( value any ) → same type as value 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
last_value ( value anyelement ) → anyelement 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 不存在 不存在
last_value ( value anyelement ) [ null treatment ] → anyelement 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在

同组函数

函数 签名 主签名 版本变动 最近变更
WINDOW FUNCTIONS 窗口函数 7 个 ↗
first_value基线 1 first_value ( value anyelement ) [null treatment] → anyelement 191 次
返回在窗口帧的第一行求得的value。 现存
lag基线 1 lag ( value anycompatible [, offset integer [, default anycompatible]] ) [null treatment] → anycompatible 192 次
返回在分区内当前行之前offset行处计算的value;如果没有这样的行,则返回default(其类型必须与value兼容)。 现存
last_value基线 1 last_value ( value anyelement ) [null treatment] → anyelement 191 次
返回在窗口帧的最后一行求得的value。 现存
lead基线 1 lead ( value anycompatible [, offset integer [, default anycompatible]] ) [null treatment] → anycompatible 192 次
返回在分区内当前行之后offset行处计算的value;如果没有这样的行,则返回default(其类型必须与value兼容)。 现存
nth_value基线 1 nth_value ( value anyelement, n integer ) [null treatment] → anyelement 191 次
返回在窗口帧的第n行求得的value(从1开始计数);如果没有这样的行,则返回NULL。 现存
ntile基线 1 ntile ( num_buckets integer ) → integer —
返回从 1 到参数值的整数,将分区尽可能均等地划分。 现存
row_number基线 1 row_number () → bigint —
返回当前行在其分区内的编号,从 1 开始计数。 现存