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
It checks for 'TRUE', 't', 'true', 'y', 'yes', 'on', and '1', and assumes anything else is false. This seems like overkill for interpreting fields from the server to me, since PostgreSQL only sends 't' and 'f' as text representations… but it’s not the right way to parse booleans in general the way PostgreSQL would either, since the latter
is case-insensitive ('True' is valid)
ignores surrounding whitespace (E' yes\t\n\f\r' is valid)
allows prefixes of words ('of', 'tru', 'fals' are valid)
In other words, there are strings PostgreSQL will parse as true that parseBool will parse as false with no warning.
So is 't' → true, 'f' → false, otherwise → throw a good direction? I’ll take a look at how it affects the performance of pg at some point.
The text was updated successfully, but these errors were encountered:
Take the boolean parser, for example:
node-pg-types/lib/textParsers.js
Lines 14 to 23 in fbe5b0e
It checks for
'TRUE'
,'t'
,'true'
,'y'
,'yes'
,'on'
, and'1'
, and assumes anything else isfalse
. This seems like overkill for interpreting fields from the server to me, since PostgreSQL only sends't'
and'f'
as text representations… but it’s not the right way to parse booleans in general the way PostgreSQL would either, since the latter'True'
is valid)E' yes\t\n\f\r'
is valid)'of'
,'tru'
,'fals'
are valid)In other words, there are strings PostgreSQL will parse as
true
thatparseBool
will parse asfalse
with no warning.So is
't'
→true
,'f'
→false
, otherwise → throw a good direction? I’ll take a look at how it affects the performance of pg at some point.The text was updated successfully, but these errors were encountered: