3

I'm wondering if there is a commonly used term similar to "upsert" or "merge" but for the case of "find or create". Ideally with a single word, something shorter that "find or create" itself and more specific.

I have tried to find it but I couldn't find anything like it. I don't care if it's a made up word, just like "upsert". I just want to know if there is a commonly used word at least in specific software domains. It doesn't necessarily have to be specific to databases.

UPDATE: I don't want people to come up with new terms, I'm actually looking for currently used terminology backed by facts, just like the upsert term.

3
  • 1
    I don't think there is, but it might be worth looking at cache APIs, since that's a domain where this get or create value paradigm is common. Sep 13 '20 at 23:54
  • In light of your update, there's definitely no term firmly established like "upsert"
    – Steve
    Sep 14 '20 at 17:43
  • In SQL, replace as an alias for insert or replace is used for this case.
    – Murphy
    Sep 25 '20 at 14:57
6

I have seen (and used) "Ensure" for cases similar to this, eg. EnsureRecord or EnsureClient. The implication is that the item has to exist, if it doesn't it will be created .

-1

Is the relevant sense that of "get existing or create"? For example, someone who would search the stores for you for a part, and if not present would machine one up for you? You could use something like provide, order, prepare, or requisition.

On the other hand, if the emphasis is upon you actively getting or creating the part for yourself, I'm not sure there is a specific word for it. Perhaps produce, because that has a general sense of bringing something forth, either by finding and showing something already possessed, or by making.

A third sense, which is more adminstrative in nature, is where you are either getting a copy of some existing information, or generating the information and then taking away a copy of it - but in either case, there is some sort of master list or cache being maintained. This differs from the upsert in that there is no updating of existing information if it already exists, and the emphasis is more on what is retrieved in either case (perhaps an identifier, or a voucher, or similar). You could possibly use words like register, audit, affirm, attest, or book out. I think none of these words quite meet the sense head-on though.

If the emphasis is strongest on the "getting", rather than on the "checking and creating", I might fall back on produce again. If the emphasis is on the "checking and creating", I'd probably plump for attest.

For example, a method which gets a birth certificate from details submitted, would be "ProduceBirthCertificate", or "AttestBirth", depending on whether the emphasis is on what is taken away, or what is being given and checked (potentially not for the first time).

4
  • Based on your answer, I think the answer is "no".
    – user253751
    Sep 14 '20 at 13:25
  • @user253751, indeed. It's an interesting case because it doesn't seem like an operation that should be uncommon in the real world (and thus lacking a word). I suspect the word "get" has acquired a stronger sense amongst coders of referring to an existing thing (a bit like the connotations of the word "fetch" or "retrieve"), whereas in everyday language "get" often has the same connotations of "produce", or words like "bring about" or "beget", a much stronger sense that "getting" might involve work to create or arrange the thing being got, rather than strictly retrieval.
    – Steve
    Sep 14 '20 at 14:42
  • I normally call it getOrCreate
    – user253751
    Sep 14 '20 at 16:40
  • 1
    @user253751, that would certainly leave little room for confusion, although I share the OP's distaste for method names like ThisOrThat.
    – Steve
    Sep 14 '20 at 17:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.