lower case unquoted identifiers to reduce confusion(postgres doesn't differentiate) store online / physical explicit prefix all id columns with TABLENAME_ to make foreign keys in queries more intuitive for new devs and `using` keyword fix a bug where show is nullable(three valued logic is not applicable here!) portions default to 1 instead of null(no such thing as "unknown" number of portions) rename user_account to usr finally figure out a name ('active') for the initial state of a cart instead of null todo: update all the queries... In doing so, might as well move all queries out of js. regarding the highly debated `insert on conflict do nothing returning id`, fuck it. why is doing it in one statement so important? > You could check the row count of the output and repeat the statement if it does not match the row count of the input. May be good enough for the rare case. The point is to start a new query (can be in the same transaction), which will then see the newly committed rows. Or check for missing result rows within the same query and overwrite those with the brute force trick demonstrated in Alextoni's answer. can't emphasize, but instead of doing what "Or" suggests, just do another query. it's not like I've implemented the necessary locks to benefit from a single query anyways. I probably wouldn't want to, since scraping is a long operation and I don't want to ever force update (which will hit triggers). I guess the one benefit of one query method is can be pure sql? but now that I'm embracing plpgsql that's a moot point https://stackoverflow.com/a/42217872 https://dba.stackexchange.com/q/212580/

Created by  boogerlad  on March 16, 2020
5XHBBUBSPTNNPEZZVELCS5AEAKQVHEMLAI2URKBMMBUGWTPARFVQC
Change contents