An Overview of UNNEST() in PostgreSQL

In PostgreSQL, we can use the unnest() function to expand an array into a set of rows. We pass the array as an argument, and the function returns each element on a separate row.

We can use the function on multi dimensional arrays, and it’s also possible to use it to unnest multiple arrays by including it in the FROM clause of a query.

Read more

Fix Error “time field value out of range” when using make_time() in PostgreSQL

If you’re getting an error that reads ‘time field value out of range‘ in PostgreSQL while using the make_time() function, it’s probably because one or more of the time parts you’re providing is out of the accepted range for that time part.

To fix this issue, be sure that each time part you provide is within the valid range for that time part.

Read more

Understanding STRING_TO_ARRAY() in PostgreSQL

In PostgreSQL, string_to_array() is a string function that allows us to create an array from a string. It splits the string based on the specified delimiter and returns a text array as a result.

If we specify a null delimiter, then each character becomes an element in the array. If the delimiter string is empty, then the whole string becomes a single element in the array.

We also have the option of turning a specific substring into null if required.

Read more