Posts

Showing posts from February, 2020

SQL; Unique constraint across tables

Recently I encountered several different data objects that all have a property akin to an 'id assigned by the company'. This field is a human readable string with a prescribed format, incremented by one shared sequence. Using a highly unique property like a UUID was sadly ruled out. In the legacy data there seemed to be clear problems with keeping data consistent even within tables, so the database design is being implemented defensively. It's possible to implement such a field as a One to One relationship from an ' id_from_company ' table to the other tables. But this does not prevent the same id_from_company to be used twice, by using it in two different tables. To uphold uniqueness across multiple tables, each table sadly needed to have a check constraint added, that checks for this uniqueness. I wouldn't soon recommend such a "unique over multiple columns" property, because of the overhead I imagine it creates. But it already existed, and

Jargon: postfix

As a guild of craftsmen, we software developers, should be aware of our jargon when talking to others. The jargon can distract from the intention you're trying to convey. One term that I accidentally stumbled upon was 'postfix'. I was creating a method that concatenated  prefix + term + postfix. While writing the code I started wondering if I should have used the term 'suffix' instead of 'postfix'. [JARGON++] Probably I used the term post(fix), because it's a great contrast to pre. Still I was dumbfounded to discover that postfix is a term specifically originating from our field of computer programming (e.g. postfix operators: expr++ and expr-- ). Suffix on the other hand originated in linguistics, a long time ago. So long story short; don't start an argument with that linguist machine learning colleague of yours, you probably both mean the same thing. Sources: https://english.stackexchange.com/questions/81263/postfix-or-suffix https://w