4 ms·
I dig it! I prefer defining tables like this: CREATE TABLE category ( id int GENERATED ALWAYS AS IDENTITY, name text ); CREAT
by torgard 5y ago
I dig it!
I prefer defining tables like this:
CREATE TABLE category (
id int GENERATED ALWAYS AS IDENTITY,
name text
);
CREATE TABLE post (
id int GENERATED ALWAYS AS IDENTITY,
category_id int
REFERENCES category (id)
ON DELETE CASCADE
);
That is, category.id rather than category.category_id.
But the USING clause doesn't work with that style, as far as I understand.
This would make my queries nicer.
- thom 5y agoI've been quite happy having fully prefixed column names for a long time now. Makes joins easier, big views clearer, and random exports more readable out of the box. Also in my case it's also easier to line up unique column names with things like Clojure specs but I accept that's a niche concern.
- JoelJacobson 5y agoMuch cleaner, I agree, that's a big win. Will add that to the list of benefits. Will also add a "Drawbacks / Remaining issues" section to the Gist, from all the valuable comments so far in this thread, thank you all, positive as well as negative comments, all very helpful.