That's just the JSON equivalent of "we have data, and it's null" vs "data is missing", and consistency could be enforced using a constraint or by making it non-NULL in the first place.
It's more common in string fields, which in many cases just get rendered on a web form that doesn't differentiate blank (empty string) from null state, therefore in the database we should in most cases set it up as follows:
- Value required: field should be non-NULL + at least length 1 (via check constraint)
- Value optional: either field is non-NULL, or field is nullable + at least length 1
I'm curious if you prefer to store optional strings as non-NULL and rely on the length, or as nullable and have a length constraint.
I have a power bank that is PD capable, but I cannot charge it from my MacBook even if the MacBook is plugged in to power. I get around it by using a USB-C/A dongle and corresponding USB-C/A cable. Presumably this "downgrades" the connection and since the MacBook doesn't support traditional USB charging it has to charge the power bank. Does USB-C not have a way to indicate that a potential power source is a battery so that the MacBook can charge it if it's plugged in to power, and reverse roles otherwise? Is this a fault how the power bank or macOS implements power negotiation, or is this scenario simply unaddressed in USB-C?
Funny enough, if I plug the USB-C/A dongle on the end of the power bank and the cable into the MacBook, it also won't charge.
I also have a Philips One toothbrush with a USB-C charging input. Similarly, I can't charge it with a USB-C cable directly from my MacBook but have to use A in between (I unsuccessfully tried using either a thinner "lower speed" or a thicker "higher speed" USB-C cable). I'm assuming the toothbrush doesn't support PD, so then why can't it fall back to traditional charging with a C-to-C cable?
> (by the way, by the time you have checked in and your boarding pass has been issued, a lot of companies just don't allow you to cancel anymore, so it's really a non-issue?)
Which companies have a cancellation policy that is contingent upon getting a boarding pass? I've cancelled checked-in tickets before. If the flight is operated by a different airline than the ticket issuer, you just have to call the operating airline first to undo the check-in (a few airline can even do this online). After that it should be possible to cancel the ticket by the ticket issuer without any problems.
It's more common in string fields, which in many cases just get rendered on a web form that doesn't differentiate blank (empty string) from null state, therefore in the database we should in most cases set it up as follows:
- Value required: field should be non-NULL + at least length 1 (via check constraint)
- Value optional: either field is non-NULL, or field is nullable + at least length 1
I'm curious if you prefer to store optional strings as non-NULL and rely on the length, or as nullable and have a length constraint.