eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

223
active users

#postgresql

12 posts11 participants1 post today

Django: Deferred constrain enforcement

Another Friday, another Django related post. I guess this blog is becoming a bit monothematic. I promise the next ones will bring the much-needed diversity of contents, but today let’s explore a very useful feature of the Django’s ORM.

Ok… Ok… it’s more of a feature of PostgreSQL that Django supports, and it isn’t available on the other database backend. But let’s dive in any way. […]

https://blog.ovalerio.net/archives/3160

blog.ovalerio.netDjango: Deferred constrain enforcement – Gonçalo Valério
More from Gonçalo Valério

Also, important PSA if you're working with #Rails, (and this may actually be a #Ruby thing, or maybe a #PostgreSQL thing, or combination):

I was trying to run a seeds.rb file to load data into my test env db. That script references an external (local) file with a bunch of items, each line being correctly formed data for an ltree path.

I kept getting errors on line one. I tried a bunch of things, and none worked.

Turns out my text file had a UTF-8 BOM, and script no likey.

3+h of madness.

Any database wizards out there?

I have a table with an ID column. The ID column is unique together with a valid date, so the ID itself is not unique.

However, I also need a name column that is unique under the condition that any given name can only correspond to one specific ID (but not necessarily the other way around).

The database is PostgreSQL. Is it possible to formulate, for instance, a UNIQUE INDEX to achieve this?

Edit: Solved 🥳

Linux Schulungen im Juni & Juli 2025: Das sind die Kurse vor der Sommerpause unserer Akademie 🎓 – jetzt noch Schulungsplatz sichern!

➡️ Du möchtest kurzfristig ein Wissens-Update in Sachen #Ansible, #Checkmk, #PostgreSQL oder #systemd? Dann melde dich jetzt an und hol dir von unseren Experten das Know-how, das du brauchst! 😀

➡️ Unsere #Linux #Admin Grundlagen Schulung gibt dir den roten Faden für das Verständnis des gesamten Systems an die Hand – jetzt anmelden. 🎟️

👉 heinlein-support.de/news/ansib

Guess you *can* hack your way up in PostgreSQL for using `MIN(uuid)` and `MAX(uuid)`.

This involves:
1. Creating a function to compare UUID as binary.
2. Create MIN and MAX aggregates uses the function.
3. Create a function to transform UUID into binary.
4. Create additional indexes that use the UUID as binary.

Or you can just install Microsoft SQL Server and invoke the antichrist.