pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Re: Missing documentation for FETCH FIRST in chapter 7.6 2+ messages / 2 participants [nested] [flat]
* Re: Missing documentation for FETCH FIRST in chapter 7.6 @ 2018-06-13 19:17 Euler Taveira <euler@timbira.com.br> 2023-11-17 21:48 ` Re: Missing documentation for FETCH FIRST in chapter 7.6 Bruce Momjian <bruce@momjian.us> 0 siblings, 1 reply; 2+ messages in thread From: Euler Taveira @ 2018-06-13 19:17 UTC (permalink / raw) To: spam_eater@gmx.net; pgsql-docs@lists.postgresql.org 2018-05-16 10:22 GMT-03:00 PG Doc comments form <noreply@postgresql.org>: > The documentation of the SELECT statement lists FETCH FIRST/OFFSET as an > alternative to the proprietary LIMIT clause. > > https://www.postgresql.org/docs/current/static/sql-select.html#SQL-LIMIT > > However, chapter 7.6 about LIMIT/OFFSET does not mention the alternative. > > https://www.postgresql.org/docs/current/static/queries-limit.html > Make sense. I propose the attached patch that adds a link to the LIMIT section in the SELECT reference page. I also renamed the "number" variables to the same names used in the SELECT reference page and put OFFSET in a new line (it looks visually better). -- Euler Taveira Timbira - http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento Attachments: [text/x-patch] 0001-Add-a-link-to-SELECT-reference-page.patch (1.6K, ../../CAHE3wgh-EYuAbLG1VS3QTHii1TgWS31h-fYEgrdda7oTOuskOQ@mail.gmail.com/2-0001-Add-a-link-to-SELECT-reference-page.patch) download | inline diff: From 433c22ffec27136f2867736075915ccfc9227cd0 Mon Sep 17 00:00:00 2001 From: Euler Taveira <euler@timbira.com.br> Date: Wed, 13 Jun 2018 18:56:19 +0000 Subject: [PATCH] Add a link to SELECT reference page Mention that Postgres also provides an alternative syntax to LIMIT and OFFSET (that conforms with SQL standard). --- doc/src/sgml/queries.sgml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index b72be9b..1e3825e 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -1787,7 +1787,8 @@ SELECT a + b AS sum, c FROM table1 ORDER BY sum + c; -- wrong SELECT <replaceable>select_list</replaceable> FROM <replaceable>table_expression</replaceable> <optional> ORDER BY ... </optional> - <optional> LIMIT { <replaceable>number</replaceable> | ALL } </optional> <optional> OFFSET <replaceable>number</replaceable> </optional> + <optional> LIMIT { <replaceable>count</replaceable> | ALL } </optional> + <optional> OFFSET <replaceable>start</replaceable></optional> </synopsis> </para> @@ -1812,6 +1813,11 @@ SELECT <replaceable>select_list</replaceable> </para> <para> + SQL:2008 adds a different syntax to achieve the same result. See <xref + linkend="sql-limit" endterm="sql-limit-title"/> for details. + </para> + + <para> When using <literal>LIMIT</literal>, it is important to use an <literal>ORDER BY</literal> clause that constrains the result rows into a unique order. Otherwise you will get an unpredictable subset of -- 2.7.4 ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Missing documentation for FETCH FIRST in chapter 7.6 2018-06-13 19:17 Re: Missing documentation for FETCH FIRST in chapter 7.6 Euler Taveira <euler@timbira.com.br> @ 2023-11-17 21:48 ` Bruce Momjian <bruce@momjian.us> 0 siblings, 0 replies; 2+ messages in thread From: Bruce Momjian @ 2023-11-17 21:48 UTC (permalink / raw) To: Euler Taveira <euler@timbira.com.br>; +Cc: spam_eater@gmx.net; pgsql-docs@lists.postgresql.org On Wed, Jun 13, 2018 at 04:17:55PM -0300, Euler Taveira wrote: > 2018-05-16 10:22 GMT-03:00 PG Doc comments form <noreply@postgresql.org>: > > The documentation of the SELECT statement lists FETCH FIRST/OFFSET as an > > alternative to the proprietary LIMIT clause. > > > > https://www.postgresql.org/docs/current/static/sql-select.html#SQL-LIMIT > > > > However, chapter 7.6 about LIMIT/OFFSET does not mention the alternative. > > > > https://www.postgresql.org/docs/current/static/queries-limit.html > > > Make sense. I propose the attached patch that adds a link to the LIMIT > section in the SELECT reference page. I also renamed the "number" > variables to the same names used in the SELECT reference page and put > OFFSET in a new line (it looks visually better). I applied the attached patch based on your patch to master. Thanks. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. Attachments: [text/x-diff] limit.diff (1.1K, ../../ZVffp7398eVsjZxj@momjian.us/2-limit.diff) download | inline diff: commit 8127e6e8ad Author: Bruce Momjian <bruce@momjian.us> Date: Fri Nov 17 16:46:43 2023 -0500 doc: update query section to show LIMIT/OFFSET like SELECT The parameter names were slightly better in SELECT, so make them match. Reported-by: Euler Taveira Discussion: https://postgr.es/m/CAHE3wgh-EYuAbLG1VS3QTHii1TgWS31h-fYEgrdda7oTOuskOQ@mail.gmail.com Backpatch-through: master diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index 8a4674e5f2..648b283b06 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -1912,7 +1912,8 @@ SELECT a + b AS sum, c FROM table1 ORDER BY sum + c; -- wrong SELECT <replaceable>select_list</replaceable> FROM <replaceable>table_expression</replaceable> <optional> ORDER BY ... </optional> - <optional> LIMIT { <replaceable>number</replaceable> | ALL } </optional> <optional> OFFSET <replaceable>number</replaceable> </optional> + <optional> LIMIT { <replaceable class="parameter">count</replaceable> | ALL } </optional> + <optional> OFFSET <replaceable class="parameter">start</replaceable> </optional> </synopsis> </para> ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-11-17 21:48 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-06-13 19:17 Re: Missing documentation for FETCH FIRST in chapter 7.6 Euler Taveira <euler@timbira.com.br> 2023-11-17 21:48 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox