Backend Notes AUG 10, 2024 • 02 MIN READ

UPDATE
ID SEQUENCE
TO HIGHEST

Abstract technical background

Updating a PostgreSQL ID sequence to match the highest value — a tiny step, but one that’s worth keeping in my backend notes.

Steps

SELECT MAX(id) FROM table_name;

then

SELECT setval('"table_name_id_seq"', (SELECT MAX(id) FROM table_name)+1);

Sample:

SELECT setval('configuration.config_shared_property_id_seq', (SELECT MAX(id) FROM "configuration".config_shared_property)+1);

READ BEYOND THE VOID

Technical blueprint background
Backend Notes

Difference between throw and throws and parent class of exceptions

I still remember the moment I realized I had been “half understanding” Java exception...

Read Entry
Abstract digital network
Backend Notes

Difference between AtomicLong and Long

When I was early in my Java career, I thought Long was enough for everything...

Read Entry
Circuit board macro
Backend Notes

Difference Between == Operator and Equals Method

If you are a Java developer, you have definitely compared objects or strings...

Read Entry