Conversation
Note that this does allow the serialization/deserialization between empty string and a Null struct. It does NOT permit invalid addresses or masks. See jackc#79
c7106ba to
3a5618b
Compare
|
Nowhere else in pgtype is an empty string conflated with See |
|
null is expressible in JSON, but it is not valid under any json-schema that would specify a document with this type, therefore should not be produced as output. Either the JSON representation is a string or it isn't, but it cannot be sometimes a string and sometimes a null (and still work under json-schema). Outside of the psql DB, I'm not sure what perspective would suggest that there is any difference between two different states where there is no address. Attempting to insert an empty string will fail with: Whereas attempting to insert a null will succeed (if the field allows null values, obviously). AFAICT, the options for incoming json empty string are:
|
|
I don't know about anything about "json-schema" but if I have a SQL An incoming JSON empty string should be an error. |
|
I'm OK w/ returning error. I think having two different serialization types in JSON (a string type and a null type) is fundamentally incorrect, but as long as |
Note that this does allow the serialization/deserialization between empty string and a Null struct. It does NOT permit invalid addresses or masks.
If this is workable, then I would pursue similar approach for Cidr and Macaddr types.
See #79