Skip to content

Fix text conversions of a space char, Convert.ToString(bool) and a null string.Join separator - #4137

Open
efeesrefinal wants to merge 1 commit into
npgsql:mainfrom
efeesrefinal:fix/text-conversions
Open

efeesrefinal wants to merge 1 commit into
npgsql:mainfrom
efeesrefinal:fix/text-conversions

Conversation

@efeesrefinal

Copy link
Copy Markdown
Contributor

Fixes #4096

  • A char column or parameter is character(1), and converting it to text strips a space. string.Join, PadLeft/PadRight and char.ToString() now go through the same rpad(x, 1) handling that Translate string methods with char arguments #4001 added for IndexOf.
  • Convert.ToString(bool) returned true/false; it now returns True/False like bool.ToString(), and stays NULL for a NULL argument.
  • string.Join treats a null separator as empty, so the separator is wrapped in COALESCE(separator, '') unless it is a non-null constant or a non-nullable column.

The six new tests fail on main. Compare_timestamp_column_to_local_DateTime_parameter fails in my Linux container on main as well and is unrelated.

…), match Convert.ToString(bool) and a null string.Join separator

Fixes npgsql#4096

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversions to text: a char space is lost, Convert.ToString(bool) gives true, and string.Join with a null separator returns NULL

1 participant