extra_window_functions
Extra Window Functions for PostgreSQL
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
extra_window_functions | 1.0 | FUNC | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4720 | extra_window_functions | No | Yes | No | Yes | No | Yes | - |
no pg14 on el8/9
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.0 | 1817161514 | extra_window_functions | - |
| RPM | PGDG | 1.0 | 1817161514 | extra_window_functions_$v | - |
| DEB | PGDG | 1.0 | 1817161514 | postgresql-$v-extra-window-functions | - |
Install
You can install extra_window_functions directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
extra_window_functions: additional window functions for PostgreSQL
Provides window functions that simulate SQL Standard features not available in PostgreSQL syntax, plus novel functions like flip_flop.
Functions Simulating SQL Standard
| Function | Description |
|---|---|
lag_ignore_nulls(expr [, offset [, default]]) | LAG that skips NULL values |
lead_ignore_nulls(expr [, offset [, default]]) | LEAD that skips NULL values |
first_value_ignore_nulls(expr) | FIRST_VALUE skipping NULLs |
last_value_ignore_nulls(expr) | LAST_VALUE skipping NULLs |
nth_value_from_last(expr, offset) | NTH_VALUE counting from end of frame |
nth_value_ignore_nulls(expr, offset) | NTH_VALUE skipping NULLs |
nth_value_from_last_ignore_nulls(expr, offset) | NTH_VALUE from last, skipping NULLs |
Functions Extending SQL Standard (with default values)
| Function | Description |
|---|---|
first_value_ignore_nulls(expr, default) | FIRST_VALUE with default when out of frame |
last_value_ignore_nulls(expr, default) | LAST_VALUE with default when out of frame |
nth_value_from_last(expr, offset, default) | NTH_VALUE from last with default |
nth_value_ignore_nulls(expr, offset, default) | NTH_VALUE with default, skipping NULLs |
nth_value_from_last_ignore_nulls(expr, offset, default) | Combined from-last, ignore-nulls, with default |
Non-Standard Functions
| Function | Description |
|---|---|
flip_flop(expr [, expr]) | Flip-flop operator: returns false until first expr is true, then true until second expr matches |
Examples
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)