6 Ways to Fix “nextval: reached minimum value of sequence” in PostgreSQL

If you’re getting an error that reads something like “nextval: reached minimum value of sequence “sequence1” (-3)” in PostgreSQL, it’s probably because you’re trying to generate a new value from a descending sequence, but the sequence has already reached its minimum value.

We have a number options when it comes to dealing with this issue.

Read more

Understanding the sys.ps_is_thread_instrumented() Function in MySQL

In MySQL, we can use the sys.ps_is_thread_instrumented() function to check whether Performance Schema instrumentation for a given connection ID is enabled.

The function returns YES or NO, depending on whether the instrumentation is enabled for the given connection. It can also return UNKNOWN if the connection ID is unknown, and NULL if the connection ID is NULL.

Read more

How to Select Rows Where a Column is NULL in SQL

When learning SQL, a common mistake when checking for NULL values is to use an equality operator. In SQL, a NULL value is treated a bit differently to other values.

In SQL we use IS NULL instead of = NULL. Likewise, we use IS NOT NULL instead of <> NULL or != NULL to select those columns that don’t have a NULL value.

Read more