Array wrapping with modulus

Recently came across a requirement that consisted of a list of items to display which is decorated by a smaller list of colours. The colours were to cycle through and wrap at the end of the list — starting over from the beginning. Mini Challenge 01: Changing Background Colors for Certificates Card Story for the… Continue reading Array wrapping with modulus

MySQL ROW_FORMAT in NextCloud

While upgrading Nextcloud from 28 to 31 recently, a warning was given on the Administration page: Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list: oc_talk_sessions. For more details see the documentation ↗. The list of tables was much more extensive… Continue reading MySQL ROW_FORMAT in NextCloud

PostgreSQL & JSON

Had some fun exploring JSON and JSONB features in PostgreSQL recently.

First task was to flatten two tables’ rows into a single field of JSON data. Nice intro to json_agg() and row_to_json().

Where it got real fun was extracting that data back out from JSON to rows & columns with the help of jsonb_path_query().

Numeric column names in PostgreSQL

In the Udemy PostgreSQL Bootcamp : Go From Beginner to Advanced, 60+hours course, there was a lesson where we wrote a function to output some SQL to enable dynamic pivot tables:pass the table_name, vertical_header_column, horizontal_header_column, value_column, and data_type and any table can be “pivoted”. Pretty nifty. But… it was hideously difficult to transcribe the code… Continue reading Numeric column names in PostgreSQL