From: Itagaki Takahiro on
2010/7/9 Pavel Stehule <pavel.stehule(a)gmail.com>:
> I am sending a actualised patch
> * removed concat_json
> * renamed function rvsr to reverse
> * functions format, sprintf and concat* are stable now (as to_char for example)

I'd like to move all proposed functions into the core, and not to add
contrib/stringfunc.
I think those functions are very useful and worth adding in core.
* concat(), concat_ws(), reverse(), left() and right() are ready to commit.
* format() is almost ready, except consensus of NULL representation.
* sprintf() is also useful, but we cannot use swprintf() in it because
there are many problems in converting to wide chars. We should
develop mbchar-aware version of %s formatter.
* IMHO, concat_sql() has very limited use cases. Boolean and numeric
values are not quoted, but still need product-specific conversions because
some DBs prefer 1/0 instead of true/false.
Also, dblink_build_sql_insert() provides similar functionality. Will
we have both?


> it worked on my station :( - Fedora 64bit
Still failed :-( I used UTF8 database with *locale=C* on 64bit Linux.
char2wchar() doesn't seem to work on C locale. We should avoid
using the function and converting mb chars to wide chars.

select sprintf('>>>%10s %10d<<<', 'hello', 10);
! server closed the connection unexpectedly
TRAP: FailedAssertion("!(!lc_ctype_is_c())", File: "mbutils.c", Line: 715)

#0 0x00000038c0c332f5 in raise () from /lib64/libc.so.6
#1 0x00000038c0c34b20 in abort () from /lib64/libc.so.6
#2 0x00000000006e951d in ExceptionalCondition (conditionName=<value
optimized out>, errorType=<value optimized out>, fileName=<value
optimized out>,
lineNumber=<value optimized out>) at assert.c:57
#3 0x00000000006fa8bf in char2wchar (to=0x1daf188 L"", tolen=16,
from=0x1da95b0 "%*s", fromlen=3) at mbutils.c:715
#4 0x00007f8e8c436d37 in stringfunc_sprintf (fcinfo=0x7fff9bdcd4b0)
at stringfunc.c:463

--
Itagaki Takahiro

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Robert Haas on
On Sun, Jul 11, 2010 at 10:30 PM, Itagaki Takahiro
<itagaki.takahiro(a)gmail.com> wrote:
> 2010/7/9 Pavel Stehule <pavel.stehule(a)gmail.com>:
>> I am sending a actualised patch
>> * removed concat_json
>> * renamed function rvsr to reverse
>> * functions format, sprintf and concat* are stable now (as to_char for example)
>
> I'd like to move all proposed functions into the core, and not to add
> contrib/stringfunc.
> I think those functions are very useful and worth adding in core.
> * concat(), concat_ws(), reverse(), left() and right() are ready to commit.
> * format() is almost ready, except consensus of NULL representation.
> * sprintf() is also useful, but we cannot use swprintf() in it because
> �there are many problems in converting to wide chars. We should
> �develop mbchar-aware version of %s formatter.
> * IMHO, concat_sql() has very limited use cases. Boolean �and numeric
> �values are not quoted, but still need product-specific conversions because
> �some DBs prefer 1/0 instead of true/false.
> �Also, dblink_build_sql_insert() provides similar functionality. Will
> we have both?

I'm all in favor of putting such things in core as are supported by
multiple competing products, but is that really true for all of these?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Itagaki Takahiro on
2010/7/12 Robert Haas <robertmhaas(a)gmail.com>:
> I'm all in favor of putting such things in core as are supported by
> multiple competing products, but is that really true for all of these?

- concat() : MySQL, Oracle, DB2
- concat_ws() : MySQL,
- left(), right() : MySQL, SQL Server, DB2
- reverse() : MySQL, SQL Server, Oracle (as utl_raw.reverse)

concat_sql(), format(), and sprintf() will be our unique features.

--
Itagaki Takahiro

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Pavel Stehule on
Hello

2010/7/12 Robert Haas <robertmhaas(a)gmail.com>:
> On Sun, Jul 11, 2010 at 10:30 PM, Itagaki Takahiro
> <itagaki.takahiro(a)gmail.com> wrote:
>> 2010/7/9 Pavel Stehule <pavel.stehule(a)gmail.com>:
>>> I am sending a actualised patch
>>> * removed concat_json
>>> * renamed function rvsr to reverse
>>> * functions format, sprintf and concat* are stable now (as to_char for example)
>>
>> I'd like to move all proposed functions into the core, and not to add
>> contrib/stringfunc.
>> I think those functions are very useful and worth adding in core.
>> * concat(), concat_ws(), reverse(), left() and right() are ready to commit.
>> * format() is almost ready, except consensus of NULL representation.

what solution for this moment - be a consistent with RAISE statement ???

>> * sprintf() is also useful, but we cannot use swprintf() in it because
>>  there are many problems in converting to wide chars. We should
>>  develop mbchar-aware version of %s formatter.

ook I'll work on this - but there is same problem with NULL like a
format function

>> * IMHO, concat_sql() has very limited use cases. Boolean  and numeric
>>  values are not quoted, but still need product-specific conversions because
>>  some DBs prefer 1/0 instead of true/false.
>>  Also, dblink_build_sql_insert() provides similar functionality. Will
>> we have both?
>

I can remove it - when I checked it I found so it doesn't well
serialize PostgreSQL specific types as array or record, so I am not
against to remove it now.

> I'm all in favor of putting such things in core as are supported by
> multiple competing products, but is that really true for all of these?
>

I have not a strong opinion on this - I would to like see reverse and
format in core. But I think, so contrib is enought. Can somebody from
commiters to decide it, please? Any sprintf implemenation needs lots
of code - minimally for this function I prefer contrib for this
function.

Regards

Pavel Stehule


> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Robert Haas on
On Jul 11, 2010, at 10:32 PM, Itagaki Takahiro <itagaki.takahiro(a)gmail.com> wrote:
> 2010/7/12 Robert Haas <robertmhaas(a)gmail.com>:
>> I'm all in favor of putting such things in core as are supported by
>> multiple competing products, but is that really true for all of these?
>
> - concat() : MySQL, Oracle, DB2
> - concat_ws() : MySQL,
> - left(), right() : MySQL, SQL Server, DB2
> - reverse() : MySQL, SQL Server, Oracle (as utl_raw.reverse)
>
> concat_sql(), format(), and sprintf() will be our unique features.

I think concat, left, right, and reverse should go into core, and perhaps format also. The rest sound like contrib material to me.

....Robert
--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers