In PostgreSQL, the array_lower()
function returns the lower bound of the specified array dimension. We pass the array and the relevant dimension, and it returns the lower bound for that dimension.
Tag: functions
A Quick Overview of ARRAY_NDIMS() in PostgreSQL
In PostgreSQL the array_ndims()
function returns the number of dimensions of an array. We pass the array to the function, and it returns an integer of the number of dimensions in the array.
This function is not to be confused with the array_dims()
function, which returns a more detailed text representation of the dimensions in the array.
Understanding ARRAY_DIMS() in PostgreSQL
In PostgreSQL we can use the array_dims()
function to return information about the dimensions in an array. The function accepts the array in question, and it returns a text representation of the array’s dimensions.
This function is not to be confused with the array_ndims()
function, which simply returns the number of dimensions in an array.
PostgreSQL RANDOM_NORMAL() Function Explained
In PostgreSQL we can use the random_normal()
function to generate a normally-distributed random number.
A normally-distributed random number is a random variable with a Gaussian distribution. This is said to be normally distributed, and is referred to as a normal deviate.
Continue readingA Quick Overview of ARRAY_AGG() in PostgreSQL
PostgreSQL has an aggregate function called array_agg()
that allows us to generate an array from the result set of a query.
The function accepts an argument which is used to generate the array. This argument is typically the column that we want to use in order to populate the array.
Continue readingAn Overview of the GENERATE_SUBSCRIPTS() Function in PostgreSQL
PostgreSQL has a generate_subscripts()
function that generates a series comprising the valid subscripts of a given array.
We pass the array to the function, along with the dimension that we want to use. We also have the option of returning the series in reverse order.
Continue readingA Quick Overview of the ARRAY_SHUFFLE() Function in PostgreSQL
In PostgreSQL array_shuffle()
is a system function that randomly shuffles the first dimension of a given array.
The array_shuffle()
function was introduced in PostgreSQL 16, which was released on September 14th 2023.
An Introduction to the ARRAY_SAMPLE() Function in PostgreSQL
In PostgreSQL array_sample()
is a system function that returns an array of a specified number of items randomly selected from the given array.
The array_sample()
function was introduced in PostgreSQL 16, which was released on September 14th 2023.
An Overview of the DATE_SUBTRACT() Function in PostgreSQL
PostgreSQL 16 introduced the date_subtract()
function that allows us to subtract an interval from a timestamp with time zone.
It computes times of day and daylight-savings adjustments according to the time zone named by the third argument, or the current TimeZone
setting if that is omitted.
PostgreSQL DATE_ADD() Function Explained
PostgreSQL 16 introduced the date_add()
function that allows us to add an interval to a timestamp with time zone.
It computes times of day and daylight-savings adjustments according to the time zone named by the third argument, or the current TimeZone
setting if that is omitted.