Re: patch: to_string, to_array functions - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: patch: to_string, to_array functions
Date
Msg-id AANLkTilvxw6aagT_8JG5XsHNs3FpzJwPjLARA_4IAJo1@mail.gmail.com
Whole thread Raw
In response to Re: patch: to_string, to_array functions  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: patch: to_string, to_array functions
Re: patch: to_string, to_array functions
List pgsql-hackers
2010/7/12 Itagaki Takahiro <itagaki.takahiro@gmail.com>:
> https://commitfest.postgresql.org/action/patch_view?id=300
>
> Why did you add to_string() and to_array() functions though we already
> have string_to_array() and array_to_string() functions?  I prefer adding
> three arguments version of string_to_array() instead of to_array().
> Please notice me if you think to_string() and to_array() are better names
> for the feature. For example, compatibility for other databases.
>

I prefere a new names  - because there are a new behave - with little
bit better default handling of NULL values. string_to_array and
array_to_string just ignore NULL values - what isn't correct behave.
Later we can mark these functions as deprecated and remove it. If I
use current function, then we have to continue in current behave.

> * string_to_array( str text, sep text, nullstr text DEFAULT NULL )
> is compatible with the existing  string_to_array( str, sep ), and
> "nullstr => 'NULL'" will be same as your to_array().
>
> * array_to_string( arr anyarray, sep text, nullstr text DEFAULT NULL )
> is compatible with the existing  array_to_string(); separator also ignored
> when nullstr is NULL. "nullstr => ''" (an empty string) will be same as
> your to_array().
>

so reason for these new names are different default behave. And we
can't to change of default behave of existing functions.

Regards

Pavel Stehule



> --
> Itagaki Takahiro
>


pgsql-hackers by date:

Previous
From: KaiGai Kohei
Date:
Subject: Re: [COMMITTERS] pgsql: Add a hook in ExecCheckRTPerms().
Next
From: Pavel Stehule
Date:
Subject: Re: patch: preload dictionary new version