You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ByteString returned is a textual error message that will be presented to the user if the stream can no longer produce all the data required for the copy. For example, maybe the stream is doing some parsing, and it encounters an invalid record - in this case it can terminate the stream early, and return Just "Invalid record". PostgreSQL will terminate the copy entirely (no partial data will be added), and the exception will be added to the PostgreSQL logs.
Does this help? I'm open to suggestions on better documentation for this function.
I think it was just the "If the stream terminates with 'Just' @error@, the error message will be logged." wording that confused me; maybe something like:
The copy is successful with 'Nothing' result; otherwise, the error (which is also logged on the server) is returned.
Also, Maybe is usually used to indicate a successful result; it may be worth defining data Result a = Err a | Success (which I've done in the past).
Both great points, and I think this library is new enough that I can afford to break the API in such a way. It's certainly confusing that Just actually signifies failure.
The
copyIn
function takes aStream
with a return type ofMaybe ByteString
, which seems to be used to determine if the copying was successful.Is this meant to be an upstream/source indicator of success as an error message rather than actual data that should have been in the Stream?
The text was updated successfully, but these errors were encountered: