Re: Title updation while documentation is generated using STYLE=website

2024-09-25 Thread Erik Wienhold
On 2024-09-25 07:23 +0200, vignesh C wrote:
> While building the documentation with make STYLE=website html, I
> noticed inconsistencies in the formatting of the starting letter of
> each word in the titles. For instance:
> "Obtaining Information about an Error" becomes "Obtaining Information
> About An Error" in html/plpgsql-control-structures.html.
> "Multiple Statements in a Simple Query" changes to "Multiple
> Statements In A Simple Query" in html/protocol-flow.html.
> "Returning from a Function" remains unchanged in
> html/plpgsql-control-structures.html.
> "Obtaining Information about an Error" is also unchanged in
> html/plpgsql-control-structures.html.
> "RETURN NEXT and RETURN QUERY" changes to "RETURN NEXT And RETURN
> QUERY" in html/plpgsql-control-structures.html.
> 
> There are many similar cases throughout the code.
> 
> I believe this might be related to the stylesheet, as the original
> text appears intact when I copy the generated HTML and paste it into
> Notepad. I could not get details about this from [1].
> How is the styling being applied for the titles? Please share the link
> to this if it is available.
> 
> [1] - https://www.postgresql.org/docs/current/docguide-build.html

I agree, it looks inconsistent.

The page loads stylesheet [1] which then loads [2].  See [3] for the
relevant rule.  As I understand it, this is the stylesheet for the
entire postgresql.org website, not just the docs.  I checked a couple of
non-docs pages but couldn't find any  elements.  So, not sure if the
text-transform property is even relevant to other pages.

[1] https://www.postgresql.org/media/css/docs-complete.css
[2] https://www.postgresql.org/media/css/main.css
[3] 
https://git.postgresql.org/gitweb/?p=pgweb.git;a=blob;f=media/css/main.css;h=cbfea862ed79fc338ee571265c28626dc38765ca;hb=HEAD#l301

-- 
Erik




Initcap works differently with different locale providers

2024-09-25 Thread Oleg Tselebrovskiy

Greetings, everyone!

One of our clients has found a difference in behaviour of initcap 
function when

using different locale providers, shown below

	postgres=# create database test_db_1 locale_provider=icu 
locale="ru_RU.UTF-8" template=template0;

NOTICE:  using standard form "ru-RU" for ICU locale "ru_RU.UTF-8"
CREATE DATABASE
postgres=# \c test_db_1;
You are now connected to database "test_db_1" as user "postgres".
test_db_1=# select initcap('ЧиЮ А.Ю.');
initcap
--
Чию А.ю.
(1 row)
test_db_1=# select initcap('joHn d.e.');
initcap
---
John D.e.
(1 row)
	postgres=# create database test_db_2 locale_provider=libc 
locale="ru_RU.UTF-8" template=template0;

CREATE DATABASE
postgres=# \c test_db_2
You are now connected to database "test_db_2" as user "postgres".
test_db_2=# select initcap('ЧиЮ А.Ю.');
initcap
--
Чию А.Ю.
(1 row)
test_db_2=# select initcap('joHn d.e.');
initcap
---
John D.E.
(1 row)

And an easier reproduction (should work for REL_12_STABLE and up)

postgres=# SELECT initcap('first.second' COLLATE "en-x-icu");
initcap
--
First.second
(1 row)
postgres=# SELECT initcap('first.second' COLLATE "en_US");
initcap
--
First.Second
(1 row)

This behaviour is reproducible on REL_12_STABLE and up to master

I don't believe that this is an erroneous behaviour, just a differing 
one, hence

just a documentation change proposition

I suggest adding a clarification that this function works differently 
with libc
and ICU providers because there is a difference in what a "word" is 
between them


In libc a word is a sequence of alphanumeric characters, separated by
non-alphanumeric characters (as it is written in documentation right 
now)

In ICU words are divided according to Unicode® Standard Annex #29 [1]

Similar issue was briefly discussed in [2]

The suggested documentation patch is attached (versions for 
REL_13_STABLE+ and

for REL_12_STABLE only)

[1]: https://www.unicode.org/reports/tr29/#Word_Boundaries
[2]: 
https://www.postgresql.org/message-id/CAEwbS1R8pwhRkwRo3XsPt24ErBNtFWuReAZhVPJwA3oqo148tA%40mail.gmail.com


Oleg Tselebrovskiy, Postgres Professionaldiff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 1bde4091ca6..3ce5ad1d1f1 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -3100,8 +3100,11 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in


 Converts the first letter of each word to upper case and the
-rest to lower case. Words are sequences of alphanumeric
-characters separated by non-alphanumeric characters.
+rest to lower case. When using the libc locale
+provider, words are sequences of alphanumeric characters separated
+by non-alphanumeric characters; when using the ICU locale provider,
+words are separated according to
+https://www.unicode.org/reports/tr29/#Word_Boundaries";>Unicode® Standard Annex #29.


 initcap('hi THOMAS')
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 487bb103637..1cd281dd90b 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1932,8 +1932,11 @@
text

 Convert the first letter of each word to upper case and the
-rest to lower case. Words are sequences of alphanumeric
-characters separated by non-alphanumeric characters.
+rest to lower case. When using the libc locale
+provider, words are sequences of alphanumeric characters separated
+		by non-alphanumeric characters; when using the ICU locale provider,
+		words are separated according to
+		https://www.unicode.org/reports/tr29/#Word_Boundaries";>Unicode® Standard Annex #29.

initcap('hi THOMAS')
Hi Thomas


Count parameter for cursor_to_xml

2024-09-25 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/functions-xml.html
Description:

cursor_to_xml ( cursor refcursor, count integer, nulls boolean,
tableforest boolean, targetns text ) → xml

There is not explanation what the count parameter do.


Re: Count parameter for cursor_to_xml

2024-09-25 Thread Daniel Gustafsson
> On 25 Sep 2024, at 10:50, PG Doc comments form  wrote:
> 
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/16/functions-xml.html
> Description:
> 
> cursor_to_xml ( cursor refcursor, count integer, nulls boolean,
>tableforest boolean, targetns text ) → xml
> 
> There is not explanation what the count parameter do.

It's described in the function text without the name of the parameter being
explicitly mentioned:

"cursor_to_xml fetches the indicated number of rows from the cursor
specified by the parameter cursor"

That could be rewritten to include the name of the parameter like: "fetches the
number of rows indicated by the parameter count from the cursor specified by
the parameter cursor".  We do mention every other parameter explicitly so it
would make sense to do so here as well.

--
Daniel Gustafsson