Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-22 Thread Tom Lane
Peter Eisentraut  writes:
> On 9/21/17 17:38, Tom Lane wrote:
>> Meanwhile, I see that Peter has posted a fix for the immediate problem.
>> I propose that Peter should apply his fix in HEAD and v10, and then

> done

>> I'll rip out the !USE_WIDE_UPPER_LOWER code paths in HEAD only.

And done.

regards, tom lane


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


Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-22 Thread Peter Eisentraut
On 9/21/17 17:38, Tom Lane wrote:
> Meanwhile, I see that Peter has posted a fix for the immediate problem.
> I propose that Peter should apply his fix in HEAD and v10, and then

done

> I'll rip out the !USE_WIDE_UPPER_LOWER code paths in HEAD only.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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


Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-21 Thread Noah Misch
On Thu, Sep 21, 2017 at 05:38:13PM -0400, Tom Lane wrote:
> I wrote:
> > Noah Misch  writes:
> >> Perhaps it is time to require HAVE_WCSTOMBS and HAVE_TOWLOWER, removing
> >> USE_WIDE_UPPER_LOWER?  Every buildfarm fossil has both.
> 
> > +1 ... if nothing else, there's the problem that untested code is likely
> > to be broken.  You just proved it *is* broken, of course, but my point
> > is that even if we repaired the immediate damage we could have little
> > confidence in it staying fixed.

That would be easy enough to ensure by adding ac_cv_func_towlower=no to some
buildfarm animal.  But the real-world need for said code is clearly dead and
gone.  Good riddance.

> Meanwhile, I see that Peter has posted a fix for the immediate problem.
> I propose that Peter should apply his fix in HEAD and v10, and then
> I'll rip out the !USE_WIDE_UPPER_LOWER code paths in HEAD only.

That works for me.


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


Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-21 Thread Tom Lane
I wrote:
> Noah Misch  writes:
>> Perhaps it is time to require HAVE_WCSTOMBS and HAVE_TOWLOWER, removing
>> USE_WIDE_UPPER_LOWER?  Every buildfarm fossil has both.

> +1 ... if nothing else, there's the problem that untested code is likely
> to be broken.  You just proved it *is* broken, of course, but my point
> is that even if we repaired the immediate damage we could have little
> confidence in it staying fixed.

Further notes about that:

* The Single Unix Spec v2 (a/k/a POSIX 1997), which has been our minimum
portability spec for quite awhile, requires wcstombs() and towlower(),
and further requires the latter to be declared in .

* Surveying the buildfarm, I agree with your conclusion that every active
member has wcstombs() and towlower().  gaur/pademelon is the lone member
that lacks ; it declares towlower() in  instead.  It's
not so surprising that that system adheres to a pre-1997 idea of where to
put that, because its /usr/include files mostly date from 1996 ...

Meanwhile, I see that Peter has posted a fix for the immediate problem.
I propose that Peter should apply his fix in HEAD and v10, and then
I'll rip out the !USE_WIDE_UPPER_LOWER code paths in HEAD only.

regards, tom lane


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


Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-21 Thread Peter Eisentraut
On 9/21/17 01:29, Noah Misch wrote:
> I checked !USE_WIDE_UPPER_LOWER by configuring v10 as follows:
> 
>   ./configure -C --prefix=$HOME/sw/nopath/pg10 --enable-debug \
>   --enable-cassert --enable-depend --enable-tap-tests --with-libxml \
>   --with-gssapi --with-openssl ac_cv_func_towlower=no
> 
> The result fails to compile:

Yeah, the placement of the ifdef blocks was pretty bogus.  This patch
fixes it.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 9e51e4e52ae565503934c97c84ee5a7d9bcb2dcc Mon Sep 17 00:00:00 2001
From: Peter Eisentraut 
Date: Thu, 21 Sep 2017 14:42:10 -0400
Subject: [PATCH] Fix build with !USE_WIDE_UPPER_LOWER

The placement of the ifdef blocks in formatting.c was pretty bogus, so
the code failed to compile if USE_WIDE_UPPER_LOWER was not defined.
---
 src/backend/utils/adt/formatting.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/utils/adt/formatting.c 
b/src/backend/utils/adt/formatting.c
index 46f45f6654..2bf484cda3 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1528,7 +1528,6 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
{
result = asc_tolower(buff, nbytes);
}
-#ifdef USE_WIDE_UPPER_LOWER
else
{
pg_locale_t mylocale = 0;
@@ -1566,6 +1565,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
else
 #endif
{
+#ifdef USE_WIDE_UPPER_LOWER
if (pg_database_encoding_max_length() > 1)
{
wchar_t*workspace;
@@ -1603,8 +1603,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
wchar2char(result, workspace, result_size, 
mylocale);
pfree(workspace);
}
-#endif /* USE_WIDE_UPPER_LOWER 
*/
else
+#endif /* USE_WIDE_UPPER_LOWER 
*/
{
char   *p;
 
@@ -1652,7 +1652,6 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
{
result = asc_toupper(buff, nbytes);
}
-#ifdef USE_WIDE_UPPER_LOWER
else
{
pg_locale_t mylocale = 0;
@@ -1690,6 +1689,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
else
 #endif
{
+#ifdef USE_WIDE_UPPER_LOWER
if (pg_database_encoding_max_length() > 1)
{
wchar_t*workspace;
@@ -1727,8 +1727,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
wchar2char(result, workspace, result_size, 
mylocale);
pfree(workspace);
}
-#endif /* USE_WIDE_UPPER_LOWER 
*/
else
+#endif /* USE_WIDE_UPPER_LOWER 
*/
{
char   *p;
 
@@ -1777,7 +1777,6 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
{
result = asc_initcap(buff, nbytes);
}
-#ifdef USE_WIDE_UPPER_LOWER
else
{
pg_locale_t mylocale = 0;
@@ -1815,6 +1814,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
else
 #endif
{
+#ifdef USE_WIDE_UPPER_LOWER
if (pg_database_encoding_max_length() > 1)
{
wchar_t*workspace;
@@ -1864,8 +1864,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
wchar2char(result, workspace, result_size, 
mylocale);
pfree(workspace);
}
-#endif /* USE_WIDE_UPPER_LOWER 
*/
else
+#endif /* USE_WIDE_UPPER_LOWER 
*/
{
char   *p;
 
-- 
2.14.1


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


Re: [HACKERS] !USE_WIDE_UPPER_LOWER compile errors in v10+

2017-09-21 Thread Tom Lane
Noah Misch  writes:
> Perhaps it is time to require HAVE_WCSTOMBS and HAVE_TOWLOWER, removing
> USE_WIDE_UPPER_LOWER?  Every buildfarm fossil has both.

+1 ... if nothing else, there's the problem that untested code is likely
to be broken.  You just proved it *is* broken, of course, but my point
is that even if we repaired the immediate damage we could have little
confidence in it staying fixed.

I think the USE_WIDE_UPPER_LOWER split was originally my code, so I'm
willing to take care of removing it if there's consensus that that's
what to do.

I'm not sure that we need to treat this as a v10 open item, though.
The premise of removing !USE_WIDE_UPPER_LOWER is that nobody cares
anymore, therefore it shouldn't matter to users whether we remove it in
v10.  There's an argument that having only two states of the relevant
code, not three, in the live back branches is worth something for
maintenance --- but should that outweigh the risk of breaking something
post-rc1?

regards, tom lane


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