pg.ddx.io pgsql-www@postgresql.org mailing list archive
help / color / mirror / Atom feedRelease Notes Archive Patch
25+ messages / 4 participants
[nested] [flat]
* Release Notes Archive Patch
@ 2019-02-13 01:12 Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
0 siblings, 2 replies; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 01:12 UTC (permalink / raw)
To: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
Hi,
Attached is a proposed patch for archiving the release notes on the
website. The patch builds the release note archive without modifying the
schema and works with old and new releases.
It works as such:
- Find all release notes that have been loaded into pgweb (a process
that occurs each release when we load the documentation)
- Find the last modified release notes for each version. This accounts
for the old docs, e.g. there is a copy of the 9.2.8 notes in the 9.3.9
release, so we will render those
- There is a list of all release notes. If you click into it, you will
see the version specific release notes
Known adjustments to be made:
- The URLs on each release note page are broken. I have to figure out
how the best way to change the relative path in the URLs that are on the
page as it is going from the page root (/docs/release) instead of the
site root. This _should_ be easy
- Even with above fix, some URLs will be broken in them, i.e. references
to other release notes
- PostgreSQL v1 + v0: I need to relabel this for Postgres95
- Also, some of the earlier versions do not have the proper release
numbering (e.g. 1.03)
I'm hoping we can put this out with the upcoming release, but am ok with
doing this shortly thereafter.
Comments on patch and approach welcome.
Thanks,
Jonathan
From d91204225b16c2636e57161c08cad112a8ce333d Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 51 ++++++++++++++++++++++++
5 files changed, 145 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index 6c93c8b7..915c4a29 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..1da162fd 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ sql = """
+ SELECT
+ docs.*,
+ r.major_version,
+ r.minor_version
+ FROM (
+ SELECT DISTINCT
+ r.major_version,
+ r.minor_version,
+ first_value(r.id) OVER (
+ PARTITION BY (r.major_version, r.minor_version)
+ ORDER BY r.tree DESC
+ ) AS id
+ FROM (
+ SELECT
+ r.id,
+ r.tree,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN versions[1]
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[1]
+ ELSE (versions[1] || '.' || versions[2])
+ END
+ )
+ ELSE (versions[1] || '.' || versions[2])
+ END::numeric AS major_version,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN '0'
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[2]
+ ELSE '0'
+ END
+ )
+ ELSE versions[3]
+ END::int AS minor_version
+ FROM (
+ SELECT
+ d.id,
+ v.tree,
+ regexp_split_to_array(
+ regexp_replace(d.file, 'release-|.html?', '', 'g'),
+ '-') AS versions
+ FROM docs d
+ JOIN core_version v ON
+ v.tree = d.version AND
+ v.testing = 0
+ WHERE file ~ '^release-'
+ ) r
+ ) r
+ ) r
+ JOIN docs ON docs.id = r.id
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version and minor_version:
+ sql += """
+ WHERE major_version = %s AND minor_version = %s;
+ """
+ params += [major_version, minor_version]
+ else:
+ sql += """
+ ORDER BY r.major_version DESC, r.minor_version DESC;
+ """
+ # execute the query to get the full queryset
+ queryset = DocPage.objects.raw(sql, params)
+ # if major + minor version are provided, we want to render something similar
+ # to the docs page
+ # otherwise, load the page that lists all of the versions
+ if major_version and minor_version:
+ docs = [d for d in queryset]
+ if not docs:
+ raise Http404()
+ context = { 'd': docs[0] }
+ else:
+ context = { 'versions': [d for d in queryset], }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d40673fc..9382975a 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 43f6c3e2..8f0b047b 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..c9a9bfd1
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,51 @@
+{% extends "base/page.html" %}
+{%block title%}Release Notes{%endblock%}
+{% block contents %}
+{% regroup versions by major_version as version_groups %}
+
+<div id="release-notes" class="row">
+ {% if d %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>PostgreSQL {{ d.major_version }}.{{ d.minor_version }}</h2>
+ </section>
+ <div id="docContent">
+ {{ d.content|safe }}
+ </div>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ {% for version_group in version_groups %}
+ <h2 id="release-{{ version_group.grouper }}">PostgreSQL {{ version_group.grouper }}</h2>
+ <ul>
+ {% for d in version_group.list %}
+ <li>
+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">
+ {{ version_group.grouper }}.{{ d.minor_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endfor %}
+ </div>
+ <div class="col-md-3">
+ <section>
+ <h2>Jump to...</h2>
+ </section>
+ <ul>
+ {% for version_group in version_groups %}
+ <li>
+ <a href="#release-{{ version_group.grouper }}">PostgreSQL {{ version_group.grouper }}</a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Create-Release-Notes-archive-in-the-Documentation-se.patch (7.8K, ../../e0f09c9a-bd2b-862a-d379-601dfabc8969@postgresql.org/2-0001-Create-Release-Notes-archive-in-the-Documentation-se.patch)
download | inline diff:
From d91204225b16c2636e57161c08cad112a8ce333d Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 51 ++++++++++++++++++++++++
5 files changed, 145 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index 6c93c8b7..915c4a29 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..1da162fd 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ sql = """
+ SELECT
+ docs.*,
+ r.major_version,
+ r.minor_version
+ FROM (
+ SELECT DISTINCT
+ r.major_version,
+ r.minor_version,
+ first_value(r.id) OVER (
+ PARTITION BY (r.major_version, r.minor_version)
+ ORDER BY r.tree DESC
+ ) AS id
+ FROM (
+ SELECT
+ r.id,
+ r.tree,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN versions[1]
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[1]
+ ELSE (versions[1] || '.' || versions[2])
+ END
+ )
+ ELSE (versions[1] || '.' || versions[2])
+ END::numeric AS major_version,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN '0'
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[2]
+ ELSE '0'
+ END
+ )
+ ELSE versions[3]
+ END::int AS minor_version
+ FROM (
+ SELECT
+ d.id,
+ v.tree,
+ regexp_split_to_array(
+ regexp_replace(d.file, 'release-|.html?', '', 'g'),
+ '-') AS versions
+ FROM docs d
+ JOIN core_version v ON
+ v.tree = d.version AND
+ v.testing = 0
+ WHERE file ~ '^release-'
+ ) r
+ ) r
+ ) r
+ JOIN docs ON docs.id = r.id
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version and minor_version:
+ sql += """
+ WHERE major_version = %s AND minor_version = %s;
+ """
+ params += [major_version, minor_version]
+ else:
+ sql += """
+ ORDER BY r.major_version DESC, r.minor_version DESC;
+ """
+ # execute the query to get the full queryset
+ queryset = DocPage.objects.raw(sql, params)
+ # if major + minor version are provided, we want to render something similar
+ # to the docs page
+ # otherwise, load the page that lists all of the versions
+ if major_version and minor_version:
+ docs = [d for d in queryset]
+ if not docs:
+ raise Http404()
+ context = { 'd': docs[0] }
+ else:
+ context = { 'versions': [d for d in queryset], }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d40673fc..9382975a 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 43f6c3e2..8f0b047b 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..c9a9bfd1
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,51 @@
+{% extends "base/page.html" %}
+{%block title%}Release Notes{%endblock%}
+{% block contents %}
+{% regroup versions by major_version as version_groups %}
+
+<div id="release-notes" class="row">
+ {% if d %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>PostgreSQL {{ d.major_version }}.{{ d.minor_version }}</h2>
+ </section>
+ <div id="docContent">
+ {{ d.content|safe }}
+ </div>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ {% for version_group in version_groups %}
+ <h2 id="release-{{ version_group.grouper }}">PostgreSQL {{ version_group.grouper }}</h2>
+ <ul>
+ {% for d in version_group.list %}
+ <li>
+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">
+ {{ version_group.grouper }}.{{ d.minor_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endfor %}
+ </div>
+ <div class="col-md-3">
+ <section>
+ <h2>Jump to...</h2>
+ </section>
+ <ul>
+ {% for version_group in version_groups %}
+ <li>
+ <a href="#release-{{ version_group.grouper }}">PostgreSQL {{ version_group.grouper }}</a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
[application/pgp-signature] signature.asc (832B, ../../e0f09c9a-bd2b-862a-d379-601dfabc8969@postgresql.org/3-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 13:46 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 13:46 UTC (permalink / raw)
To: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/12/19 8:12 PM, Jonathan S. Katz wrote:
> Hi,
>
> Attached is a proposed patch for archiving the release notes on the
> website. The patch builds the release note archive without modifying the
> schema and works with old and new releases.
>
> Known adjustments to be made:
>
> - The URLs on each release note page are broken. I have to figure out
> how the best way to change the relative path in the URLs that are on the
> page as it is going from the page root (/docs/release) instead of the
> site root. This _should_ be easy
> - Even with above fix, some URLs will be broken in them, i.e. references
> to other release notes
> - PostgreSQL v1 + v0: I need to relabel this for Postgres95
> - Also, some of the earlier versions do not have the proper release
> numbering (e.g. 1.03)
All of the above are now fixed. Attached is v2 of the patch. I've also
attached a couple of screenshots so you can see how it looks.
IMV this is ready to go, but would like some review and/or additional
testing prior to pushing.
Thanks,
Jonathan
From 1c79231c2442f5fac8e303420b6b5b5966f9ed8a Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 64 +++++++++++++++++++++++++++++
5 files changed, 158 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index 6c93c8b7..915c4a29 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..1da162fd 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ sql = """
+ SELECT
+ docs.*,
+ r.major_version,
+ r.minor_version
+ FROM (
+ SELECT DISTINCT
+ r.major_version,
+ r.minor_version,
+ first_value(r.id) OVER (
+ PARTITION BY (r.major_version, r.minor_version)
+ ORDER BY r.tree DESC
+ ) AS id
+ FROM (
+ SELECT
+ r.id,
+ r.tree,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN versions[1]
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[1]
+ ELSE (versions[1] || '.' || versions[2])
+ END
+ )
+ ELSE (versions[1] || '.' || versions[2])
+ END::numeric AS major_version,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN '0'
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[2]
+ ELSE '0'
+ END
+ )
+ ELSE versions[3]
+ END::int AS minor_version
+ FROM (
+ SELECT
+ d.id,
+ v.tree,
+ regexp_split_to_array(
+ regexp_replace(d.file, 'release-|.html?', '', 'g'),
+ '-') AS versions
+ FROM docs d
+ JOIN core_version v ON
+ v.tree = d.version AND
+ v.testing = 0
+ WHERE file ~ '^release-'
+ ) r
+ ) r
+ ) r
+ JOIN docs ON docs.id = r.id
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version and minor_version:
+ sql += """
+ WHERE major_version = %s AND minor_version = %s;
+ """
+ params += [major_version, minor_version]
+ else:
+ sql += """
+ ORDER BY r.major_version DESC, r.minor_version DESC;
+ """
+ # execute the query to get the full queryset
+ queryset = DocPage.objects.raw(sql, params)
+ # if major + minor version are provided, we want to render something similar
+ # to the docs page
+ # otherwise, load the page that lists all of the versions
+ if major_version and minor_version:
+ docs = [d for d in queryset]
+ if not docs:
+ raise Http404()
+ context = { 'd': docs[0] }
+ else:
+ context = { 'versions': [d for d in queryset], }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d40673fc..9382975a 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 43f6c3e2..8f0b047b 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..fdf32fef
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,64 @@
+{% extends "base/page.html" %}
+
+{% block extrahead %}
+{% if d %}
+ <base href="/docs/{{ d.major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup versions by major_version as version_groups %}
+
+<div id="release-notes" class="row">
+ {% if d %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if d.major_version == 0 %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ d.major_version }}.{% if d.major_version == 0 or d.major_version == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ d.content|safe }}
+ </div>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ {% for version_group in version_groups %}
+ <h2 id="release-{{ version_group.grouper }}">{% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}</h2>
+ <ul>
+ {% for d in version_group.list %}
+ <li>
+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">
+ {{ version_group.grouper }}.{% if version_group.grouper == 0 or version_group.grouper == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endfor %}
+ </div>
+ <div class="col-md-3">
+ <section>
+ <h2>Jump to...</h2>
+ </section>
+ <ul>
+ {% for version_group in version_groups %}
+ <li>
+ <a href="#release-{{ version_group.grouper }}">
+ {% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Create-Release-Notes-archive-in-the-Documentation-se_v2.patch (8.4K, ../../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/2-0001-Create-Release-Notes-archive-in-the-Documentation-se_v2.patch)
download | inline diff:
From 1c79231c2442f5fac8e303420b6b5b5966f9ed8a Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH] Create Release Notes archive in the Documentation section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 ++++
pgweb/docs/views.py | 84 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
templates/docs/release_notes.html | 64 +++++++++++++++++++++++++++++
5 files changed, 158 insertions(+)
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index 6c93c8b7..915c4a29 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1293,6 +1293,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..1da162fd 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -140,6 +140,90 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ sql = """
+ SELECT
+ docs.*,
+ r.major_version,
+ r.minor_version
+ FROM (
+ SELECT DISTINCT
+ r.major_version,
+ r.minor_version,
+ first_value(r.id) OVER (
+ PARTITION BY (r.major_version, r.minor_version)
+ ORDER BY r.tree DESC
+ ) AS id
+ FROM (
+ SELECT
+ r.id,
+ r.tree,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN versions[1]
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[1]
+ ELSE (versions[1] || '.' || versions[2])
+ END
+ )
+ ELSE (versions[1] || '.' || versions[2])
+ END::numeric AS major_version,
+ CASE array_length(versions, 1)
+ WHEN 1 THEN '0'
+ WHEN 2 THEN (
+ CASE
+ WHEN versions[1]::int >= 10 OR versions[1]::int < 6
+ THEN versions[2]
+ ELSE '0'
+ END
+ )
+ ELSE versions[3]
+ END::int AS minor_version
+ FROM (
+ SELECT
+ d.id,
+ v.tree,
+ regexp_split_to_array(
+ regexp_replace(d.file, 'release-|.html?', '', 'g'),
+ '-') AS versions
+ FROM docs d
+ JOIN core_version v ON
+ v.tree = d.version AND
+ v.testing = 0
+ WHERE file ~ '^release-'
+ ) r
+ ) r
+ ) r
+ JOIN docs ON docs.id = r.id
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version and minor_version:
+ sql += """
+ WHERE major_version = %s AND minor_version = %s;
+ """
+ params += [major_version, minor_version]
+ else:
+ sql += """
+ ORDER BY r.major_version DESC, r.minor_version DESC;
+ """
+ # execute the query to get the full queryset
+ queryset = DocPage.objects.raw(sql, params)
+ # if major + minor version are provided, we want to render something similar
+ # to the docs page
+ # otherwise, load the page that lists all of the versions
+ if major_version and minor_version:
+ docs = [d for d in queryset]
+ if not docs:
+ raise Http404()
+ context = { 'd': docs[0] }
+ else:
+ context = { 'versions': [d for d in queryset], }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d40673fc..9382975a 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -57,6 +57,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 43f6c3e2..8f0b047b 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -36,6 +36,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..fdf32fef
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,64 @@
+{% extends "base/page.html" %}
+
+{% block extrahead %}
+{% if d %}
+ <base href="/docs/{{ d.major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup versions by major_version as version_groups %}
+
+<div id="release-notes" class="row">
+ {% if d %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if d.major_version == 0 %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ d.major_version }}.{% if d.major_version == 0 or d.major_version == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ d.content|safe }}
+ </div>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ {% for version_group in version_groups %}
+ <h2 id="release-{{ version_group.grouper }}">{% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}</h2>
+ <ul>
+ {% for d in version_group.list %}
+ <li>
+ <a href="/docs/release/{{ version_group.grouper }}.{{ d.minor_version }}/">
+ {{ version_group.grouper }}.{% if version_group.grouper == 0 or version_group.grouper == 1 and d.minor_version != 0 %}0{% endif %}{{ d.minor_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endfor %}
+ </div>
+ <div class="col-md-3">
+ <section>
+ <h2>Jump to...</h2>
+ </section>
+ <ul>
+ {% for version_group in version_groups %}
+ <li>
+ <a href="#release-{{ version_group.grouper }}">
+ {% if version_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ version_group.grouper }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
[image/png] Screen Shot 2019-02-13 at 8.44.07 AM.png (405.7K, ../../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/3-Screen%20Shot%202019-02-13%20at%208.44.07%20AM.png)
download | view image
[image/png] Screen Shot 2019-02-13 at 8.44.40 AM.png (554.9K, ../../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/4-Screen%20Shot%202019-02-13%20at%208.44.40%20AM.png)
download | view image
[application/pgp-signature] signature.asc (832B, ../../751cae66-4d83-5012-94c6-b915bfa03f9e@postgresql.org/5-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 15:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Tom Lane @ 2019-02-13 15:13 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
"Jonathan S. Katz" <jkatz@postgresql.org> writes:
> All of the above are now fixed. Attached is v2 of the patch. I've also
> attached a couple of screenshots so you can see how it looks.
> IMV this is ready to go, but would like some review and/or additional
> testing prior to pushing.
The patch doesn't convey a lot to my mind, so I have to ask: exactly
what URLs would this present? Does it do anything to respond to
Andres' complaint that existing relnote pages will vanish?
regards, tom lane
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-02-13 15:21 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 15:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 10:13 AM, Tom Lane wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
>> All of the above are now fixed. Attached is v2 of the patch. I've also
>> attached a couple of screenshots so you can see how it looks.
>> IMV this is ready to go, but would like some review and/or additional
>> testing prior to pushing.
>
> The patch doesn't convey a lot to my mind, so I have to ask: exactly
> what URLs would this present?
I'm a bit confuse by the question, so I'll answer it from two angles.
WRT loading the release notes themselves, basically it is using the data
found in the current doc imports. Often in the release notes, there are
URLs either to older release notes (like in the top line) or various
features/sections of the documentation (e.g. a GUC, a SQL command, etc.)
Within these notes themselves, all the URLs should work.
The patch also introduces a new set of URLs to present the release
notes, of the format:
/docs/release/11.2/
/docs/release/11.1/
/docs/release/11.0/
...
/docs/release/9.6.2/
/docs/release/9.6.1/
/docs/release/9.6.0/
...
(and some ugliness in the old ones, which I could maybe adjust, but for
now):
/docs/release/1.9/
/docs/release/1.2/
/docs/release/1.1/
/docs/release/1.0/
/docs/release/0.3/
/docs/release/0.1/
> Does it do anything to respond to
> Andres' complaint that existing relnote pages will vanish?
Yes. All the relnotes are now in this archive.
Please let me know if any of the above is unclear.
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../81313189-2e85-062a-f6d9-620298b4b00e@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 16:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 16:23 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 2 replies; 25+ messages in thread
From: Tom Lane @ 2019-02-13 16:18 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
"Jonathan S. Katz" <jkatz@postgresql.org> writes:
> On 2/13/19 10:13 AM, Tom Lane wrote:
>> The patch doesn't convey a lot to my mind, so I have to ask: exactly
>> what URLs would this present?
> I'm a bit confuse by the question, so I'll answer it from two angles.
Neither of those are quite what I meant. As I understood Andres'
complaint, it was that right now we have URLs like
https://www.postgresql.org/docs/10/release-9-6-5.html
but those are going to be 404 beginning tomorrow. It sounds from your
response like this patch isn't meant to restore those cross-version URLs.
Which is fine by me, really, but we might get pushback about it. If so,
there might be material for follow-on work to redirect those into this
new set of URLs.
> WRT loading the release notes themselves, basically it is using the data
> found in the current doc imports. Often in the release notes, there are
> URLs either to older release notes (like in the top line) or various
> features/sections of the documentation (e.g. a GUC, a SQL command, etc.)
Right. The latter type will link to the main docs for the associated
release, correct?
regards, tom lane
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-02-13 16:23 ` Magnus Hagander <magnus@hagander.net>
2019-02-13 18:17 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
1 sibling, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-02-13 16:23 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jonathan S. Katz <jkatz@postgresql.org>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On Wed, Feb 13, 2019 at 5:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
> > On 2/13/19 10:13 AM, Tom Lane wrote:
> >> The patch doesn't convey a lot to my mind, so I have to ask: exactly
> >> what URLs would this present?
>
> > I'm a bit confuse by the question, so I'll answer it from two angles.
>
> Neither of those are quite what I meant. As I understood Andres'
> complaint, it was that right now we have URLs like
>
> https://www.postgresql.org/docs/10/release-9-6-5.html
>
> but those are going to be 404 beginning tomorrow. It sounds from your
> response like this patch isn't meant to restore those cross-version URLs.
> Which is fine by me, really, but we might get pushback about it. If so,
> there might be material for follow-on work to redirect those into this
> new set of URLs.
>
We can make those become redirects at the webserver level, I'm pretty sure.
Seems like it should be easy enough to regexp-match it for a simple mapping.
I'm less certain if we can have that tested and deployed by tomorrow.
(Which goes for the whole patch from Jonathan as well)
//Magnus
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 16:23 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
@ 2019-02-13 18:17 ` Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 0 replies; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 18:17 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 11:23 AM, Magnus Hagander wrote:
> On Wed, Feb 13, 2019 at 5:18 PM Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
> "Jonathan S. Katz" <jkatz@postgresql.org
> <mailto:jkatz@postgresql.org>> writes:
> > On 2/13/19 10:13 AM, Tom Lane wrote:
> >> The patch doesn't convey a lot to my mind, so I have to ask: exactly
> >> what URLs would this present?
>
> > I'm a bit confuse by the question, so I'll answer it from two angles.
>
> Neither of those are quite what I meant. As I understood Andres'
> complaint, it was that right now we have URLs like
>
> https://www.postgresql.org/docs/10/release-9-6-5.html
>
> but those are going to be 404 beginning tomorrow. It sounds from your
> response like this patch isn't meant to restore those cross-version
> URLs.
> Which is fine by me, really, but we might get pushback about it. If so,
> there might be material for follow-on work to redirect those into this
> new set of URLs.
>
>
> We can make those become redirects at the webserver level, I'm pretty
> sure. Seems like it should be easy enough to regexp-match it for a
> simple mapping.
+1; I would question whether or not its worth it, but we do have that
option.
>
> I'm less certain if we can have that tested and deployed by tomorrow.
> (Which goes for the whole patch from Jonathan as well)
I will profess confidence with the patch -- of course, I would
appreciate additional validation (and I'm there are different approaches
as well, given I put forward one back in the summer :)
If we want to push it, I'm ok to own it and be available for any fixes
(which is easier now that I'm in one place for awhile, and given it's
release day I try to stay around).
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../36a44ed7-d3ec-f199-b604-13fafa48b91d@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-02-13 18:01 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:16 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:44 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
1 sibling, 2 replies; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 18:01 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 11:18 AM, Tom Lane wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
>> On 2/13/19 10:13 AM, Tom Lane wrote:
>>> The patch doesn't convey a lot to my mind, so I have to ask: exactly
>>> what URLs would this present?
>
>> I'm a bit confuse by the question, so I'll answer it from two angles.
>
> Neither of those are quite what I meant. As I understood Andres'
> complaint, it was that right now we have URLs like
>
> https://www.postgresql.org/docs/10/release-9-6-5.html
>
> but those are going to be 404 beginning tomorrow. It sounds from your
> response like this patch isn't meant to restore those cross-version URLs.
> Which is fine by me, really, but we might get pushback about it. If so,
> there might be material for follow-on work to redirect those into this
> new set of URLs
Thanks for clarifying!
So, in anticipation of push back, I also want to provide some stats. I
looked at overall traffic since Jul 1, 2018 to yesterday. Traffic to any
of the release notes in general was a very small chunk of it (< 0.5%).
When just looking at the subset of release notes, the top 5 receivers were:
1. 11.0
2. 10.5
3. 10.4
4. "current/static/release.html"
5. 9.6 release index
This constituted a little over 35% of the overall release note traffic.
My inferences are that people tend to go to the release notes for the
"latest" release.
Now, in terms of things like "/docs/9.5/9-4-19.html" and the like, the
only one that had significant traffic was
/docs/9.6/static/release-9-5.html, and that was #25 on the list (the
notes coming before it accounting for 60%+ of the traffic). In fact, I
did not see another of the "mismatch" URLs until #37 on the list, which
was /docs/10/static/release-9-5.html
From a user experience perspective, does it stink that we're potentially
creating a bunch of 404s? Yes. Is it going to upset some people? Yes,
and I'm sympathetic to that. However, looking at the overall numbers, I
think we'll be ok, even if we don't have the redirects per Magnus'
suggestion downthread (which I will also reply to).
>
>> WRT loading the release notes themselves, basically it is using the data
>> found in the current doc imports. Often in the release notes, there are
>> URLs either to older release notes (like in the top line) or various
>> features/sections of the documentation (e.g. a GUC, a SQL command, etc.)
>
> Right. The latter type will link to the main docs for the associated
> release, correct?
Correct.
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../5ab20e2d-f291-51db-6761-07daeed5a87a@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 18:16 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 25+ messages in thread
From: Tom Lane @ 2019-02-13 18:16 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
"Jonathan S. Katz" <jkatz@postgresql.org> writes:
> On 2/13/19 11:18 AM, Tom Lane wrote:
>> https://www.postgresql.org/docs/10/release-9-6-5.html
>> but those are going to be 404 beginning tomorrow. It sounds from your
>> response like this patch isn't meant to restore those cross-version URLs.
>> Which is fine by me, really, but we might get pushback about it. If so,
>> ...
> Now, in terms of things like "/docs/9.5/9-4-19.html" and the like, the
> only one that had significant traffic was
> /docs/9.6/static/release-9-5.html, and that was #25 on the list (the
> notes coming before it accounting for 60%+ of the traffic).
I wonder how much of that just amounts to people clicking on the "next
page" link till they get to a page that's not relevant to what they're
interested in. If so, there won't be any UX problem, because the
"next page" link won't take them there anymore.
Making these URLs go away only matters to the extent that people have
them bookmarked (seems unlikely) or get sent there by google searches
(rather more likely).
Anyway, I think we could push what you have here and then await
developments before deciding if there's a need for more work.
regards, tom lane
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 18:44 ` Andres Freund <andres@anarazel.de>
2019-02-13 19:03 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
1 sibling, 1 reply; 25+ messages in thread
From: Andres Freund @ 2019-02-13 18:44 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
Hi,
On 2019-02-13 13:01:46 -0500, Jonathan S. Katz wrote:
> So, in anticipation of push back, I also want to provide some stats. I
> looked at overall traffic since Jul 1, 2018 to yesterday. Traffic to any
> of the release notes in general was a very small chunk of it (< 0.5%).
Given the number of pages, that doesn't seem that small. I personally
have hit broken /devel/release-xy.html links several times since the
hasty removal.
> From a user experience perspective, does it stink that we're potentially
> creating a bunch of 404s? Yes. Is it going to upset some people? Yes,
> and I'm sympathetic to that. However, looking at the overall numbers, I
> think we'll be ok, even if we don't have the redirects per Magnus'
> suggestion downthread (which I will also reply to).
We're going to break current/relase-xy.html links after every single
major release this way. This seems absurd.
I'm quite pissed at how haphazardly this was done.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:44 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
@ 2019-02-13 19:03 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 19:10 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 19:03 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 1:44 PM, Andres Freund wrote:
> Hi,
>
> On 2019-02-13 13:01:46 -0500, Jonathan S. Katz wrote:
>> So, in anticipation of push back, I also want to provide some stats. I
>> looked at overall traffic since Jul 1, 2018 to yesterday. Traffic to any
>> of the release notes in general was a very small chunk of it (< 0.5%).
>
> Given the number of pages, that doesn't seem that small. I personally
> have hit broken /devel/release-xy.html links several times since the
> hasty removal.
It's an incredibly small amount relative to other parts of the site. By
the above measure, it's statistically insignificant even with alpha of .01
To give it more context, it makes up 1% of all pages that are viewed in
the documentation. Looking from Jul 1, 2018, in the top 100 viewed doc
pages, #91 was the PG11 release, and nothing else. Basically, the major
release pushes the views of the release notes way up by a significant
portion.
Also, this did hurt my workflow as well when putting together the press
release. Given the release notes were not in devel, I ended up building
the docs from the REL_11_STABLE branch to put it together (rather than
parsing the SGML manually). It was inconvenient, but IMV the benefits
far outweigh the inconvenience.
>
>
>> From a user experience perspective, does it stink that we're potentially
>> creating a bunch of 404s? Yes. Is it going to upset some people? Yes,
>> and I'm sympathetic to that. However, looking at the overall numbers, I
>> think we'll be ok, even if we don't have the redirects per Magnus'
>> suggestion downthread (which I will also reply to).
>
> We're going to break current/relase-xy.html links after every single
> major release this way. This seems absurd.
We mentioned a way we can fix this -- having a map from /current/ (and
if need be /devel) to the proper version of the old release notes can be
done with some regular expressions, as Magnus said. It should not be too
difficult to do. I may even be able to get a POC done later today.
> I'm quite pissed at how haphazardly this was done.
We had discussion on this for months, and after some idling, we proposed
a solution and worked through it quickly. Sometimes you just need to rip
the band-aid off.
The nice thing about web is that you can test your assumptions and
iterate much more quickly than other ways to deliver software (e.g. a
database).
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../475f78b3-a4e5-6cb7-90d5-c5faf116ba31@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:44 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
2019-02-13 19:03 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 19:10 ` Andres Freund <andres@anarazel.de>
2019-02-13 19:34 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Andres Freund @ 2019-02-13 19:10 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
Hi,
On February 13, 2019 8:03:03 PM GMT+01:00, "Jonathan S. Katz" <jkatz@postgresql.org> wrote:
>> I'm quite pissed at how haphazardly this was done.
>
>We had discussion on this for months, and after some idling, we
>proposed
>a solution and worked through it quickly. Sometimes you just need to
>rip
>the band-aid off.
Well, it was done under the heading of a modest proposal. But even leaving that aside, nothing, absolutely nothing, prevented putting the web piece into place before breaking things.
Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:44 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
2019-02-13 19:03 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 19:10 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
@ 2019-02-13 19:34 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 20:33 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 19:34 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 2:10 PM, Andres Freund wrote:
> Hi,
>
> On February 13, 2019 8:03:03 PM GMT+01:00, "Jonathan S. Katz" <jkatz@postgresql.org> wrote:
>>> I'm quite pissed at how haphazardly this was done.
>>
>> We had discussion on this for months, and after some idling, we
>> proposed
>> a solution and worked through it quickly. Sometimes you just need to
>> rip
>> the band-aid off.
>
> But even leaving that aside, nothing, absolutely nothing, prevented putting the web piece into place before breaking things.
I don't disagree with the above point. With that said, we are working to
get the web piece up prior to the majority of the links going 404.
I will go to work on a patch for current (which could be similar to
"devel") and see if I can have that ready. I will do it as a separate
patch from the one upthread.
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../5ff7e3c8-a6bd-100c-942a-c02a19208735@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:01 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:44 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
2019-02-13 19:03 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 19:10 ` Re: Release Notes Archive Patch Andres Freund <andres@anarazel.de>
2019-02-13 19:34 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-13 20:33 ` Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 0 replies; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-13 20:33 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/13/19 2:34 PM, Jonathan S. Katz wrote:
> On 2/13/19 2:10 PM, Andres Freund wrote:
>> Hi,
>>
>> On February 13, 2019 8:03:03 PM GMT+01:00, "Jonathan S. Katz" <jkatz@postgresql.org> wrote:
>>>> I'm quite pissed at how haphazardly this was done.
>>>
>>> We had discussion on this for months, and after some idling, we
>>> proposed
>>> a solution and worked through it quickly. Sometimes you just need to
>>> rip
>>> the band-aid off.
>>
>> But even leaving that aside, nothing, absolutely nothing, prevented putting the web piece into place before breaking things.
>
> I don't disagree with the above point. With that said, we are working to
> get the web piece up prior to the majority of the links going 404.
>
> I will go to work on a patch for current (which could be similar to
> "devel") and see if I can have that ready. I will do it as a separate
> patch from the one upthread.
This turned out to be not so bad, please see attached.
Here's the way it works:
- If you are viewing release notes in documentation prior to 9.4, do nothing
- If you are viewing the release notes in documentation for 9.4 and
above and you are viewing the release notes in your version (e.g. 9.4.8
in 9.4), do nothing
- If you are viewing the release notes in docs for 9.4+ and you are
viewing a "mismatched" version (e.g. /docs/10/release-9-6-4.html),
permanent redirect (301) to the proper version (e.g.
/docs/9.6/release-6-4.html)
It accounts for version numbering changes and all the fun
Notes:
- Tested in multiple scenarios, also dealing with different versioning
number permutations as well (e.g. release-10.html, release-10-1.html,
release-9-6.html, release-9-6-1.html)
- Tested with current. I did not test with devel as I do not have
"devel" docs set up on my local. However, I am going to work on setting
that up
- Given docs on the site go back to 7.2, there is a stop that says if
you are viewing a release note older than 7.2, then view the releases
notes in 7.2
This can be pushed independently of the previous patch as it redirects
users to existing documentation.
Feedback welcome. Thanks,
Jonathan
From e029d8ec99f18a46e6940746abe3e0fd0f65f122 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load with
404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 1da162fd..14fce173 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -53,6 +54,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0002-Ensure-release-notes-from-older-version-still-load-w.patch (3.6K, ../../364b776c-db88-c618-8d77-9a8bfd07d08e@postgresql.org/2-0002-Ensure-release-notes-from-older-version-still-load-w.patch)
download | inline diff:
From e029d8ec99f18a46e6940746abe3e0fd0f65f122 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load with
404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 1da162fd..14fce173 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -53,6 +54,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
[application/pgp-signature] signature.asc (832B, ../../364b776c-db88-c618-8d77-9a8bfd07d08e@postgresql.org/3-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-19 10:42 ` Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
1 sibling, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-02-19 10:42 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On Wed, Feb 13, 2019 at 2:13 AM Jonathan S. Katz <jkatz@postgresql.org>
wrote:
> Hi,
>
> Attached is a proposed patch for archiving the release notes on the
> website. The patch builds the release note archive without modifying the
> schema and works with old and new releases.
>
> It works as such:
>
> - Find all release notes that have been loaded into pgweb (a process
> that occurs each release when we load the documentation)
> - Find the last modified release notes for each version. This accounts
> for the old docs, e.g. there is a copy of the 9.2.8 notes in the 9.3.9
> release, so we will render those
> - There is a list of all release notes. If you click into it, you will
> see the version specific release notes
>
> Known adjustments to be made:
>
> - The URLs on each release note page are broken. I have to figure out
> how the best way to change the relative path in the URLs that are on the
> page as it is going from the page root (/docs/release) instead of the
> site root. This _should_ be easy
> - Even with above fix, some URLs will be broken in them, i.e. references
> to other release notes
> - PostgreSQL v1 + v0: I need to relabel this for Postgres95
> - Also, some of the earlier versions do not have the proper release
> numbering (e.g. 1.03)
>
> I'm hoping we can put this out with the upcoming release, but am ok with
> doing this shortly thereafter.
>
> Comments on patch and approach welcome.
>
>
A few comments on this one:
1. It loses the "go to next minor" and "go to previous minor" links in the
previous release notes. Those should be easy enough to get back, but should
be done. E.g. if I'm on 9.6.3, I want links to 9.6.2 and 9.6.4. And we
should also use the change to make it more "explicit" and *also* have a
link to 9.6.0 on all of them amonst the links themselves.
2b. In fact, we should use this chance to create a proper set of links,
e.g. when you get to release notes for 9.6.0, it should right then and
there provide a list of all the minor releases I think -- to avoid having
to go back.
2. Links within the docs are just plain broken? E.g. the 9.6.0 release
notes link to /docs/release/9.6.0/app-pg-dumpall.html which clearly doesn't
exist. IIRC we discussed something around this, but it seems to have never
made it into the patches? (It is listed in your known adjustments to be
made above, but I could also not find a newer patch?)
3. That SQL query really needs some documentation, because it takes quite a
bit of reading to figure out what it really means. And while it works on my
dev install, it fails when i test-ran it on the current database with the
error "ERROR: invalid input syntax for type numeric: "prior". Most likely
it comes from there being a file called release-prior.html in versions
9.4-11.0 now.
It should also be reviewed for the fact that you are pulling back *all* the
documentation including *all* the contents in order to render a list of
versions...That gets annoyingly expensive when you actually have the full
set of documentation.
4. The "jump to..." list should probably be split between supported and
unsupported versions, to keep it a bit less.
5. In general, there's a huge amount of numbers on the index page. I'm not
sure what's a good way to format it better, I normally leave that to you :)
But the page is not very friendly at this point with the massive list of
numbers you have to scroll through.
//Magnus
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
@ 2019-02-27 23:30 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-27 23:30 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
Hi,
On 2/19/19 5:42 AM, Magnus Hagander wrote:
> A few comments on this one:
>
> 1. It loses the "go to next minor" and "go to previous minor" links in
> the previous release notes. Those should be easy enough to get back, but
> should be done. E.g. if I'm on 9.6.3, I want links to 9.6.2 and 9.6.4.
> And we should also use the change to make it more "explicit" and *also*
> have a link to 9.6.0 on all of them amonst the links themsel
>
> 2b. In fact, we should use this chance to create a proper set of links,
> e.g. when you get to release notes for 9.6.0, it should right then and
> there provide a list of all the minor releases I think -- to avoid
> having to go back.
So there could be an issue with that as we would have to carry the
lag/lead somehow. Not insurmountable, but given this is minimally
invasive, it would take a bit more complicating of that SQL query that
was just simplified.
>
> 2. Links within the docs are just plain broken? E.g. the 9.6.0 release
> notes link to /docs/release/9.6.0/app-pg-dumpall.html which clearly
> doesn't exist. IIRC we discussed something around this, but it seems to
> have never made it into the patches? (It is listed in your known
> adjustments to be made above, but I could also not find a newer patch?)
I could not reproduce this. The links work fine for me.
>
> 3. That SQL query really needs some documentation, because it takes
> quite a bit of reading to figure out what it really means. And while it
> works on my dev install, it fails when i test-ran it on the current
> database with the error "ERROR:Â invalid input syntax for type numeric:
> "prior". Most likely it comes from there being a file called
> release-prior.html in versions 9.4-11.0 now.Â
>
> It should also be reviewed for the fact that you are pulling back *all*
> the documentation including *all* the contents in order to render a list
> of versions...That gets annoyingly expensive when you actually have the
> full set of documentation.
Per off-list discussion, Magnus added a simpler query that was provided.
>
> 4. The "jump to..." list should probably be split between supported and
> unsupported versions, to keep it a bit less.
Well, with the below, I don't think we need that.
>
> 5. In general, there's a huge amount of numbers on the index page. I'm
> not sure what's a good way to format it better, I normally leave that to
> you :) But the page is not very friendly at this point with the massive
> list of numbers you have to scroll through.
We could list out the major versions, then have the minor versions. I'm
not opposed to that. See attached.
Jonathan
From a6f252a096978d10069dc5b77e2c164dcef3119d Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 3/4] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 +++
pgweb/docs/views.py | 93 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 72 ++++++++++++++++++++++++++++++
6 files changed, 182 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..de71eb34 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..815f3a37 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,98 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 -
+ # From there, we take a unique set based on the filename + releaes version,
+ # and return the content
+ sql = """
+ SELECT DISTINCT ON (file, major, minor) version, file, major, minor, content
+ FROM (
+ SELECT
+ version,
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor,
+ content
+ FROM (
+ SELECT
+ version,
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v,
+ content
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version > 0
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ sql += """
+ WHERE major = %s AND minor = %s;
+ """
+ params += [major_version]
+ if major_version in ['0', '1']:
+ params += ['0.{}'.format(minor_version)]
+ else:
+ params += [minor_version]
+ elif major_version is not None:
+ sql += """
+ WHERE major = %s
+ ORDER BY rr.minor DESC;
+ """
+ params += [major_version]
+ else:
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if only major version is present, then we load all the releases for that major version
+ # if neither are present, we load the list of all major versions
+ if major_version is not None and minor_version is not None:
+ try:
+ release_note = release_notes[0]
+ except IndexError:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ }
+ elif major_version is not None:
+ if not release_notes:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'release_notes': release_notes,
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..6ded70b6 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d\.\d)|\d+)(\.(?P<minor_version>\d+))?)/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..d40565ad
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,72 @@
+{% extends "base/page.html" %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <p>
+ <a href="/docs/release/{{ major_version }}/">
+ Return to the {% if major_version == '0' %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ Release Notes
+ </a>
+ </p>
+ </div>
+ {% elif major_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>{% if major_version == '0' %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}</h2>
+ </section>
+ <ul>
+ {% for release_note in release_notes %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}/">
+ {{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ <p>
+ <a href="/docs/release/">Return to Release Notes</a>
+ </p>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul>
+ {% for release_note_group in release_note_groups %}
+ <li>
+ <a href="/docs/release/{{ release_note_group.grouper }}/">
+ {% if release_note_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ release_note_group.grouper }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
From 40036e6d8cfeda577a9c1f65bfbe2c38917afef8 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 4/4] Ensure release notes from older version still load with
404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 815f3a37..2304afbc 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0003-Create-Release-Notes-archive-in-the-Documentation-se.patch (10.3K, ../../bc9038eb-e61d-4cd8-4e01-0b3676d49d68@postgresql.org/2-0003-Create-Release-Notes-archive-in-the-Documentation-se.patch)
download | inline diff:
From a6f252a096978d10069dc5b77e2c164dcef3119d Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 3/4] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 7 +++
pgweb/docs/views.py | 93 +++++++++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 72 ++++++++++++++++++++++++++++++
6 files changed, 182 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..de71eb34 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,13 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .titlepage,
+#release-notes .toc {
+ display: none;
+}
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..815f3a37 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,98 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 -
+ # From there, we take a unique set based on the filename + releaes version,
+ # and return the content
+ sql = """
+ SELECT DISTINCT ON (file, major, minor) version, file, major, minor, content
+ FROM (
+ SELECT
+ version,
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor,
+ content
+ FROM (
+ SELECT
+ version,
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v,
+ content
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version > 0
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to the exact release notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ sql += """
+ WHERE major = %s AND minor = %s;
+ """
+ params += [major_version]
+ if major_version in ['0', '1']:
+ params += ['0.{}'.format(minor_version)]
+ else:
+ params += [minor_version]
+ elif major_version is not None:
+ sql += """
+ WHERE major = %s
+ ORDER BY rr.minor DESC;
+ """
+ params += [major_version]
+ else:
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if only major version is present, then we load all the releases for that major version
+ # if neither are present, we load the list of all major versions
+ if major_version is not None and minor_version is not None:
+ try:
+ release_note = release_notes[0]
+ except IndexError:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ }
+ elif major_version is not None:
+ if not release_notes:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'release_notes': release_notes,
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..6ded70b6 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d\.\d)|\d+)(\.(?P<minor_version>\d+))?)/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..d40565ad
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,72 @@
+{% extends "base/page.html" %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <p>
+ <a href="/docs/release/{{ major_version }}/">
+ Return to the {% if major_version == '0' %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ Release Notes
+ </a>
+ </p>
+ </div>
+ {% elif major_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>{% if major_version == '0' %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}</h2>
+ </section>
+ <ul>
+ {% for release_note in release_notes %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}/">
+ {{ major_version }}.{% if major_version == '0' or major_version == '1' %}{{ release_note.minor|make_list|slice:"2:4"|join:"" }}{% else %}{{ release_note.minor }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ <p>
+ <a href="/docs/release/">Return to Release Notes</a>
+ </p>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul>
+ {% for release_note_group in release_note_groups %}
+ <li>
+ <a href="/docs/release/{{ release_note_group.grouper }}/">
+ {% if release_note_group.grouper == 0 %}Postgres95{% else %}PostgreSQL {{ release_note_group.grouper }}{% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
[text/plain] 0004-Ensure-release-notes-from-older-version-still-load-w.patch (3.6K, ../../bc9038eb-e61d-4cd8-4e01-0b3676d49d68@postgresql.org/3-0004-Ensure-release-notes-from-older-version-still-load-w.patch)
download | inline diff:
From 40036e6d8cfeda577a9c1f65bfbe2c38917afef8 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 4/4] Ensure release notes from older version still load with
404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 815f3a37..2304afbc 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
[application/pgp-signature] signature.asc (832B, ../../bc9038eb-e61d-4cd8-4e01-0b3676d49d68@postgresql.org/4-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-28 12:19 ` Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-02-28 12:19 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On Thu, Feb 28, 2019 at 12:30 AM Jonathan S. Katz <jkatz@postgresql.org>
wrote:
> Hi,
>
> On 2/19/19 5:42 AM, Magnus Hagander wrote:
>
> > A few comments on this one:
> >
> > 1. It loses the "go to next minor" and "go to previous minor" links in
> > the previous release notes. Those should be easy enough to get back, but
> > should be done. E.g. if I'm on 9.6.3, I want links to 9.6.2 and 9.6.4.
> > And we should also use the change to make it more "explicit" and *also*
> > have a link to 9.6.0 on all of them amonst the links themsel
> >
> > 2b. In fact, we should use this chance to create a proper set of links,
> > e.g. when you get to release notes for 9.6.0, it should right then and
> > there provide a list of all the minor releases I think -- to avoid
> > having to go back.
>
> So there could be an issue with that as we would have to carry the
> lag/lead somehow. Not insurmountable, but given this is minimally
> invasive, it would take a bit more complicating of that SQL query that
> was just simplified.
>
Well, for "previous" you wouldn't need SQL :) But yes, you'd need a "do we
have release notes for the next version" in there. But you only need those
on the one-page views, so it's really not that bad.
I think it's worth it, it's definitely something *I* use a lot in the old
interface.
(And as a minor note, for the query, I don't think adding major/minor
versions in the WHERE clause is enough to make it fast. You need to push it
down into the actual filename in the innermost where-clause, to make sure
we get an index scan. Shouldn't be too hard)
> 2. Links within the docs are just plain broken? E.g. the 9.6.0 release
> > notes link to /docs/release/9.6.0/app-pg-dumpall.html which clearly
> > doesn't exist. IIRC we discussed something around this, but it seems to
> > have never made it into the patches? (It is listed in your known
> > adjustments to be made above, but I could also not find a newer patch?)
>
> I could not reproduce this. The links work fine for me.
>
It could be because I was on the wrong version of the patch. They do work
in the patch you sent now.
> > 3. That SQL query really needs some documentation, because it takes
> > quite a bit of reading to figure out what it really means. And while it
> > works on my dev install, it fails when i test-ran it on the current
> > database with the error "ERROR: invalid input syntax for type numeric:
> > "prior". Most likely it comes from there being a file called
> > release-prior.html in versions 9.4-11.0 now.
> >
> > It should also be reviewed for the fact that you are pulling back *all*
> > the documentation including *all* the contents in order to render a list
> > of versions...That gets annoyingly expensive when you actually have the
> > full set of documentation.
>
> Per off-list discussion, Magnus added a simpler query that was provided.
>
> >
> > 4. The "jump to..." list should probably be split between supported and
> > unsupported versions, to keep it a bit less.
>
> Well, with the below, I don't think we need that.
>
> >
> > 5. In general, there's a huge amount of numbers on the index page. I'm
> > not sure what's a good way to format it better, I normally leave that to
> > you :) But the page is not very friendly at this point with the massive
> > list of numbers you have to scroll through.
>
> We could list out the major versions, then have the minor versions. I'm
> not opposed to that. See attached.
>
Hmm. I'm still not sure I like that big long list of numbers offhand.
In fact -- do we need a separate page? What if we just added them to
/docs/manual/ and /docs/manual/archive/?
And then we highlight the release notes of the latest version directly on
/docs/.
And maybe add a link in the "online manuals" section out on the righthand
side of /docs/?
Thoughts?
--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
@ 2019-02-28 15:14 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-02-28 15:14 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/28/19 7:19 AM, Magnus Hagander wrote:
>
>
> On Thu, Feb 28, 2019 at 12:30 AM Jonathan S. Katz <jkatz@postgresql.org
> <mailto:jkatz@postgresql.org>> wrote:
> So there could be an issue with that as we would have to carry the
> lag/lead somehow. Not insurmountable, but given this is minimally
> invasive, it would take a bit more complicating of that SQL query that
> was just simplified.
>
>
> Well, for "previous" you wouldn't need SQL :) But yes, you'd need a "do
> we have release notes for the next version" in there. But you only need
> those on the one-page views, so it's really not that ba
>
> I think it's worth it, it's definitely something *I* use a lot in the
> old interface.
I'll look into adding it then.
>
> (And as a minor note, for the query, I don't think adding major/minor
> versions in the WHERE clause is enough to make it fast. You need to push
> it down into the actual filename in the innermost where-clause, to make
> sure we get an index scan. Shouldn't be too hard)
Yeah...it kind of makes constructing the query a bit uglier, which is
why I avoided it. I'm happy to do it, but I think that given a) it's not
a lot of rows and b) it's going to be behind varnish most of the time
anyway that I'm not too concerned.
As a compromise, I can come up with a version that does this, and we can
decide what to do from there.
>
> > 2. Links within the docs are just plain broken? E.g. the 9.6.0 release
> > notes link to /docs/release/9.6.0/app-pg-dumpall.html which clearly
> > doesn't exist. IIRC we discussed something around this, but it
> seems to
> > have never made it into the patches? (It is listed in your known
> > adjustments to be made above, but I could also not find a newer
> patch?)
>
> I could not reproduce this. The links work fine for me.
>
>
> It could be because I was on the wrong version of the patch. They do
> work in the patch you sent now.
Great.
> > 5. In general, there's a huge amount of numbers on the index page. I'm
> > not sure what's a good way to format it better, I normally leave
> that to
> > you :) But the page is not very friendly at this point with the
> massive
> > list of numbers you have to scroll through.
>
> We could list out the major versions, then have the minor versions. I'm
> not opposed to that. See attached.
>
> Â
> Hmm. I'm still not sure I like that big long list of numbers offhand.
Why? It's in the specific version that you're looking for. It also makes
it easy to find the version you exactly want, instead of having to click
previous/next to find it. It's no different than:
https://www.postgresql.org/docs/9.4/release.html
In fact, it's a similar workflow:
1. Pick your major version
2. Pick your minor version
3. Enjoy a helping of release notes.
If anything, it's one less step because you don't have to go into the
specific documentation, click "Release Notes" and find them.
>
> In fact -- do we need a separate page? What if we just added them to
> /docs/manual/ and /docs/manual/archive/?
I strongly feel we need a separate page. It makes them so much easier to
find, and given all the hubbub let's make it easy for our users to find
the release notes, not buried somewhere.
> And then we highlight the release notes of the latest version directly
> on /docs/.Â
>
> And maybe add a link in the "online manuals" section out on the
> righthand side of /docs/?
I was actually thinking in the release notes themselves, we add a right
nav that shows all the minor versions for the particular major version
of the release notes.
I'll post another revision soon.
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../7ec61f14-5507-c073-b25d-247befef90e2@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-02-28 19:12 ` Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-02-28 19:12 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On Thu, Feb 28, 2019 at 4:15 PM Jonathan S. Katz <jkatz@postgresql.org>
wrote:
> On 2/28/19 7:19 AM, Magnus Hagander wrote:
> >
> >
> > On Thu, Feb 28, 2019 at 12:30 AM Jonathan S. Katz <jkatz@postgresql.org
> > <mailto:jkatz@postgresql.org>> wrote:
>
> > So there could be an issue with that as we would have to carry the
> > lag/lead somehow. Not insurmountable, but given this is minimally
> > invasive, it would take a bit more complicating of that SQL query
> that
> > was just simplified.
> >
> >
> > Well, for "previous" you wouldn't need SQL :) But yes, you'd need a "do
> > we have release notes for the next version" in there. But you only need
> > those on the one-page views, so it's really not that ba
> >
> > I think it's worth it, it's definitely something *I* use a lot in the
> > old interface.
>
> I'll look into adding it then.
>
> >
> > (And as a minor note, for the query, I don't think adding major/minor
> > versions in the WHERE clause is enough to make it fast. You need to push
> > it down into the actual filename in the innermost where-clause, to make
> > sure we get an index scan. Shouldn't be too hard)
>
> Yeah...it kind of makes constructing the query a bit uglier, which is
> why I avoided it. I'm happy to do it, but I think that given a) it's not
> a lot of rows and b) it's going to be behind varnish most of the time
> anyway that I'm not too concerned.
>
> As a compromise, I can come up with a version that does this, and we can
> decide what to do from there.
>
:) Sounds like a plan.
> > > 2. Links within the docs are just plain broken? E.g. the 9.6.0
> release
> > > notes link to /docs/release/9.6.0/app-pg-dumpall.html which clearly
> > > doesn't exist. IIRC we discussed something around this, but it
> > seems to
> > > have never made it into the patches? (It is listed in your known
> > > adjustments to be made above, but I could also not find a newer
> > patch?)
> >
> > I could not reproduce this. The links work fine for me.
> >
> >
> > It could be because I was on the wrong version of the patch. They do
> > work in the patch you sent now.
>
> Great.
>
> > > 5. In general, there's a huge amount of numbers on the index page.
> I'm
> > > not sure what's a good way to format it better, I normally leave
> > that to
> > > you :) But the page is not very friendly at this point with the
> > massive
> > > list of numbers you have to scroll through.
> >
> > We could list out the major versions, then have the minor versions.
> I'm
> > not opposed to that. See attached.
> >
> >
> > Hmm. I'm still not sure I like that big long list of numbers offhand.
>
> Why? It's in the specific version that you're looking for. It also makes
> it easy to find the version you exactly want, instead of having to click
> previous/next to find it. It's no different than:
>
> https://www.postgresql.org/docs/9.4/release.html
I don't like that one either :)
I prefer compating it to the rest of the site, in particular after the work
Sarah and you put in there. And compared to that, I think it feels a bit
off.
In the end, I'll be happy to defer to your judgement, just wanted to make
sure you had heard my comments :)
> In fact, it's a similar workflow:
>
> 1. Pick your major version
> 2. Pick your minor version
> 3. Enjoy a helping of release notes.
>
> If anything, it's one less step because you don't have to go into the
> specific documentation, click "Release Notes" and find them.
>
Right. I'm just saying you can make it even better :)
> In fact -- do we need a separate page? What if we just added them to
> > /docs/manual/ and /docs/manual/archive/?
>
> I strongly feel we need a separate page. It makes them so much easier to
> find, and given all the hubbub let's make it easy for our users to find
> the release notes, not buried somewhere.
>
Fair enough.
> And then we highlight the release notes of the latest version directly
> > on /docs/.
> >
> > And maybe add a link in the "online manuals" section out on the
> > righthand side of /docs/?
>
> I was actually thinking in the release notes themselves, we add a right
> nav that shows all the minor versions for the particular major version
> of the release notes.
>
Ah yeah, that could be pretty good.
--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
@ 2019-03-02 20:22 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-03-02 20:22 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 2/28/19 2:12 PM, Magnus Hagander wrote:
> On Thu, Feb 28, 2019 at 4:15 PM Jonathan S. Katz <jkatz@postgresql.org
> <mailto:jkatz@postgresql.org>> wrote:
>
> On 2/28/19 7:19 AM, Magnus Hagander wrote:
> > Well, for "previous" you wouldn't need SQL :) But yes, you'd need
> a "do
> > we have release notes for the next version" in there. But you only
> need
> > those on the one-page views, so it's really not that ba
> >
> > I think it's worth it, it's definitely something *I* use a lot in the
> > old interface.
>
> I'll look into adding it then.
Added. Yay window functions :) It adds a bit more complexity to the
query (see below), but it lets people browse more easily, so yay.
>
> >
> > (And as a minor note, for the query, I don't think adding major/minor
> > versions in the WHERE clause is enough to make it fast. You need
> to push
> > it down into the actual filename in the innermost where-clause, to
> make
> > sure we get an index scan. Shouldn't be too hard)
>
> Yeah...it kind of makes constructing the query a bit uglier, which is
> why I avoided it. I'm happy to do it, but I think that given a) it's not
> a lot of rows and b) it's going to be behind varnish most of the time
> anyway that I'm not too concerned.
>
> As a compromise, I can come up with a version that does this, and we can
> decide what to do from there.
>
>
> :) Sounds like a plan.
...so if we want to keep it to one query + support lead and lag, this
does not work out. Additionally, if we try to look it up over a major
version, we end up losing out on all of the legacy release notes from
9.3 & older. It also gets complicated when you deal with release notes
for versions of documentation we don't have loaded (e.g. 6.1.x).
However, we can at least limit the search to all release notes that were
loaded from 9.3 and newer, as 9.3 will contain all of the historical
release notes.
If we really want to use the index, we can add some magic to to check
which version we're looking up (e.g. 6.1.1) and then map it to the last
known version that had all docs (i.e. 9.3).
IMHO it's creating more trouble than its worth. The # of rows is small
(~2200, and with the 9.3 restriction ~1500), it does not grow much, and
these pages will be cached the vast majority of the time. Yes, it's wide
due to "content" but again, I'm not that concerned.
> I don't like that one either :)
>
> I prefer compating it to the rest of the site, in particular after the
> work Sarah and you put in there. And compared to that, I think it feels
> a bit off.
>
> In the end, I'll be happy to defer to your judgement, just wanted to
> make sure you had heard my comments :)
So I hopefully met somewhere in the middle on this: I brought it back
down to two pages, and had an accordion on the first page:
1. Click the major version, a list of the minor versions in that major
pop out
2. Select the minor version, you're taken to the release notes. There
are some controls to navigate to diff minor versions within that version.
I have some ideas for other UX that make it nicer to display (something
more "card" based), but in the interest of time I'd prefer we get this up.
>
> > And then we highlight the release notes of the latest version directly
> > on /docs/.Â
> >
> > And maybe add a link in the "online manuals" section out on the
> > righthand side of /docs/?
>
> I was actually thinking in the release notes themselves, we add a right
> nav that shows all the minor versions for the particular major version
> of the release notes.
>
>
> Ah yeah, that could be pretty good.
This is done. Latest version attached.
I also added a new Django filter given there was some code I kept
copying-and-pasting around the minor version display formatting.
If there is nothing that's grossly flawed, I'd like to get this pushed.
The two things I want us to be happy with are a) the query and b) the
URLs, as everything else can conceivably change (well, the query can
change, but I want us to be happy with how we are generating it).
Thanks,
Jonathan
From 76cce7acf79947e07b51a8baf03a4956fd7e7171 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 1/2] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 15 ++++++
pgweb/core/templatetags/pgfilters.py | 9 ++++
pgweb/docs/views.py | 95 ++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 102 +++++++++++++++++++++++++++++++++++
7 files changed, 231 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..ec82466b 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,21 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .NAVHEADER,
+#release-notes .NAVFOOTER,
+#release-notes .titlepage,
+#release-notes h1.SECT1,
+#release-notes .toc {
+ display: none;
+}
+
+#release-notes .version-list h2:after {
+ content: none;
+}
+
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/core/templatetags/pgfilters.py b/pgweb/core/templatetags/pgfilters.py
index 13f2470c..4edeb95c 100644
--- a/pgweb/core/templatetags/pgfilters.py
+++ b/pgweb/core/templatetags/pgfilters.py
@@ -70,3 +70,12 @@ def dictlookup(value, key):
@register.filter(name='json')
def tojson(value):
return json.dumps(value)
+
+@register.filter()
+def release_notes_pg_minor_version(minor_version, major_version):
+ """Formats the minor version number to the appropriate PostgreSQL version.
+ This is particularly for very old version of PostgreSQL.
+ """
+ if str(major_version) in ['0', '1']:
+ return str(minor_version)[2:4]
+ return minor_version
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..36895fcc 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,100 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. We will limit our lookup to release notes from 9.3 on up,
+ # given 9.3 has all the release notes for PostgreSQL 9.3 and older
+ # From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 - current
+ # It is then put into a unique set
+ # Lastly, we determine the next/previous versions (lead/lag) so we are able
+ # to easily page between the different versions in the unique release note view
+ sql = """
+ SELECT
+ file, major, minor,
+ lag(minor) OVER (PARTITION BY major ORDER BY minor) AS previous,
+ lead(minor) OVER (PARTITION BY major ORDER BY minor) AS next,
+ content
+ FROM (
+ SELECT DISTINCT ON (file, major, minor)
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor,
+ content
+ FROM (
+ SELECT
+ version,
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v,
+ content
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version >= 9.3
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to all the release notes for the minor version, as we need the
+ # list of the entire set in order to generate the nice side bar in the release
+ # notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ # have to wrap it in one more query, otherwise lead/lag does not work
+ sql = """SELECT *
+ FROM ({}) rr
+ WHERE rr.major = %s
+ ORDER BY rr.minor DESC""".format(sql)
+ params += [major_version]
+ else:
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if neither are present, we load the list of all of the release notes to list out
+ if major_version is not None and minor_version is not None:
+ # first, see if any release notes were returned; if not, raise a 404
+ if not release_notes:
+ raise Http404()
+ # next, see if we can find the specific release notes we are looking for
+ # format what the "minor" version should look like
+ try:
+ minor = Decimal('0.{}'.format(minor_version) if major_version in ['0', '1'] else minor_version)
+ except TypeError:
+ raise Http404()
+ release_note = [r for r in release_notes if r['minor'] == minor][0]
+ # of course, if nothing is found, return a 404
+ if not release_note:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ 'release_notes': release_notes
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..80913c3f 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..d6d9a688
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,102 @@
+{% extends "base/page.html" %}
+{% load pgfilters %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <div class="row">
+ <div class="col-md-3">
+ {% if release_note.previous is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ Previous
+ </a>
+ {% endif %}
+ </div>
+ <div class="col-md-6 text-center">
+ <p>
+ <a href="/docs/release/">
+ Return to the Release Notes Archive
+ </a>
+ </p>
+ </div>
+ <div class="col-md-3 text-right">
+ {% if release_note.next is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ Next
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ <div class="col-md-2 version-list">
+ <section>
+ <h2>Versions</h2>
+ </section>
+ <ul>
+ {% for r in release_notes %}
+ <li>
+ {% if r.minor == release_note.minor %}
+ <strong>
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </strong>
+ {% else %}
+ <a href="/docs/release/{{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul>
+ {% for release_note_group in release_note_groups %}
+ {% with major_version=release_note_group.grouper %}
+ <li>
+ <a href="#release{{ major_version }}" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="release{{ major_version }}">
+ {% if major_version == 0 %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ </a>
+ <ul class="collapse" id="release{{ major_version }}">
+ {% for release_note in release_note_group.list %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </li>
+ {% endwith %}
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
From 9f80c5e1fa44fdecf9a748c8d6705e649ec3c9df Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load
without 404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 36895fcc..555eb424 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Create-Release-Notes-archive-in-the-Documentation-se.patch (12.8K, ../../a52310c6-513f-8966-4d91-a06120c444d1@postgresql.org/2-0001-Create-Release-Notes-archive-in-the-Documentation-se.patch)
download | inline diff:
From 76cce7acf79947e07b51a8baf03a4956fd7e7171 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 1/2] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 15 ++++++
pgweb/core/templatetags/pgfilters.py | 9 ++++
pgweb/docs/views.py | 95 ++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 102 +++++++++++++++++++++++++++++++++++
7 files changed, 231 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..ec82466b 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,21 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .NAVHEADER,
+#release-notes .NAVFOOTER,
+#release-notes .titlepage,
+#release-notes h1.SECT1,
+#release-notes .toc {
+ display: none;
+}
+
+#release-notes .version-list h2:after {
+ content: none;
+}
+
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/core/templatetags/pgfilters.py b/pgweb/core/templatetags/pgfilters.py
index 13f2470c..4edeb95c 100644
--- a/pgweb/core/templatetags/pgfilters.py
+++ b/pgweb/core/templatetags/pgfilters.py
@@ -70,3 +70,12 @@ def dictlookup(value, key):
@register.filter(name='json')
def tojson(value):
return json.dumps(value)
+
+@register.filter()
+def release_notes_pg_minor_version(minor_version, major_version):
+ """Formats the minor version number to the appropriate PostgreSQL version.
+ This is particularly for very old version of PostgreSQL.
+ """
+ if str(major_version) in ['0', '1']:
+ return str(minor_version)[2:4]
+ return minor_version
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..36895fcc 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,100 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. We will limit our lookup to release notes from 9.3 on up,
+ # given 9.3 has all the release notes for PostgreSQL 9.3 and older
+ # From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 - current
+ # It is then put into a unique set
+ # Lastly, we determine the next/previous versions (lead/lag) so we are able
+ # to easily page between the different versions in the unique release note view
+ sql = """
+ SELECT
+ file, major, minor,
+ lag(minor) OVER (PARTITION BY major ORDER BY minor) AS previous,
+ lead(minor) OVER (PARTITION BY major ORDER BY minor) AS next,
+ content
+ FROM (
+ SELECT DISTINCT ON (file, major, minor)
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor,
+ content
+ FROM (
+ SELECT
+ version,
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v,
+ content
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version >= 9.3
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to all the release notes for the minor version, as we need the
+ # list of the entire set in order to generate the nice side bar in the release
+ # notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ # have to wrap it in one more query, otherwise lead/lag does not work
+ sql = """SELECT *
+ FROM ({}) rr
+ WHERE rr.major = %s
+ ORDER BY rr.minor DESC""".format(sql)
+ params += [major_version]
+ else:
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if neither are present, we load the list of all of the release notes to list out
+ if major_version is not None and minor_version is not None:
+ # first, see if any release notes were returned; if not, raise a 404
+ if not release_notes:
+ raise Http404()
+ # next, see if we can find the specific release notes we are looking for
+ # format what the "minor" version should look like
+ try:
+ minor = Decimal('0.{}'.format(minor_version) if major_version in ['0', '1'] else minor_version)
+ except TypeError:
+ raise Http404()
+ release_note = [r for r in release_notes if r['minor'] == minor][0]
+ # of course, if nothing is found, return a 404
+ if not release_note:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ 'release_notes': release_notes
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..80913c3f 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..d6d9a688
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,102 @@
+{% extends "base/page.html" %}
+{% load pgfilters %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <div class="row">
+ <div class="col-md-3">
+ {% if release_note.previous is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ Previous
+ </a>
+ {% endif %}
+ </div>
+ <div class="col-md-6 text-center">
+ <p>
+ <a href="/docs/release/">
+ Return to the Release Notes Archive
+ </a>
+ </p>
+ </div>
+ <div class="col-md-3 text-right">
+ {% if release_note.next is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ Next
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ <div class="col-md-2 version-list">
+ <section>
+ <h2>Versions</h2>
+ </section>
+ <ul>
+ {% for r in release_notes %}
+ <li>
+ {% if r.minor == release_note.minor %}
+ <strong>
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </strong>
+ {% else %}
+ <a href="/docs/release/{{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul>
+ {% for release_note_group in release_note_groups %}
+ {% with major_version=release_note_group.grouper %}
+ <li>
+ <a href="#release{{ major_version }}" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="release{{ major_version }}">
+ {% if major_version == 0 %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ </a>
+ <ul class="collapse" id="release{{ major_version }}">
+ {% for release_note in release_note_group.list %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </li>
+ {% endwith %}
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
[text/plain] 0002-Ensure-release-notes-from-older-version-still-load-w.patch (3.6K, ../../a52310c6-513f-8966-4d91-a06120c444d1@postgresql.org/3-0002-Ensure-release-notes-from-older-version-still-load-w.patch)
download | inline diff:
From 9f80c5e1fa44fdecf9a748c8d6705e649ec3c9df Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load
without 404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 36895fcc..555eb424 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
[application/pgp-signature] signature.asc (832B, ../../a52310c6-513f-8966-4d91-a06120c444d1@postgresql.org/4-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-03-08 19:21 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 19:10 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-03-08 19:21 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 3/2/19 12:22 PM, Jonathan S. Katz wrote:
This is done. Latest version attached.
Per in-person patch review, attached is the latest version.
Noted changes:
1. Fixed bug with previous/next in template
2. Only load the "content" when it is needed, i.e. when looking at the
specific release notes for a (major,minor) version pair
3. Use some arrows to make the collapsible list look more..collapsible
4. Updated some comments
Thanks,
Jonathan
From c884493494e5a29691bc85cb6c085c9cb0caecf8 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 1/2] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 29 ++++++++++
pgweb/core/templatetags/pgfilters.py | 9 +++
pgweb/docs/views.py | 98 +++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 104 +++++++++++++++++++++++++++++++++++
7 files changed, 250 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..489ac916 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,35 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .NAVHEADER,
+#release-notes .NAVFOOTER,
+#release-notes .titlepage,
+#release-notes h1.SECT1,
+#release-notes .toc {
+ display: none;
+}
+
+#release-notes .version-list h2:after {
+ content: none;
+}
+
+.release-notes-list {
+ list-style-type: none;
+}
+
+.release-notes-list :not(.collapsed) > .right,
+.release-notes-list .collapsed > .down {
+ display: none;
+}
+
+.release-notes-list .collapsed > .right,
+.release-notes-list :not(.collapsed) > .down {
+ display: block;
+}
+
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/core/templatetags/pgfilters.py b/pgweb/core/templatetags/pgfilters.py
index 13f2470c..4edeb95c 100644
--- a/pgweb/core/templatetags/pgfilters.py
+++ b/pgweb/core/templatetags/pgfilters.py
@@ -70,3 +70,12 @@ def dictlookup(value, key):
@register.filter(name='json')
def tojson(value):
return json.dumps(value)
+
+@register.filter()
+def release_notes_pg_minor_version(minor_version, major_version):
+ """Formats the minor version number to the appropriate PostgreSQL version.
+ This is particularly for very old version of PostgreSQL.
+ """
+ if str(major_version) in ['0', '1']:
+ return str(minor_version)[2:4]
+ return minor_version
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..62f0abb3 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,103 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. We will limit our lookup to release notes from 9.3 on up,
+ # given 9.3 has all the release notes for PostgreSQL 9.3 and older
+ # From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 - current
+ # It is then put into a unique set
+ # Lastly, we determine the next/previous versions (lead/lag) so we are able
+ # to easily page between the different versions in the unique release note view
+ # We only include the content if we are doing an actual lookup on an exact
+ # major/minor release pair, to limit how much data we load into memory
+ sql = """
+ SELECT
+ {content}
+ file, major, minor,
+ lag(minor) OVER (PARTITION BY major ORDER BY minor) AS previous,
+ lead(minor) OVER (PARTITION BY major ORDER BY minor) AS next
+ FROM (
+ SELECT DISTINCT ON (file, major, minor)
+ {content}
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor
+ FROM (
+ SELECT
+ {content}
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version >= 9.3
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to all the release notes for the minor version, as we need the
+ # list of the entire set in order to generate the nice side bar in the release
+ # notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ # at this point, include the content
+ sql = sql.format(content="content,")
+ # restrict to the major version, order from latest to earliest minor
+ sql = """{}
+ WHERE rr.major = %s
+ ORDER BY rr.minor DESC""".format(sql)
+ params += [major_version]
+ else:
+ sql = sql.format(content="")
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if neither are present, we load the list of all of the release notes to list out
+ if major_version is not None and minor_version is not None:
+ # first, see if any release notes were returned; if not, raise a 404
+ if not release_notes:
+ raise Http404()
+ # next, see if we can find the specific release notes we are looking for
+ # format what the "minor" version should look like
+ try:
+ minor = Decimal('0.{}'.format(minor_version) if major_version in ['0', '1'] else minor_version)
+ except TypeError:
+ raise Http404()
+ release_note = [r for r in release_notes if r['minor'] == minor][0]
+ # of course, if nothing is found, return a 404
+ if not release_note:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ 'release_notes': release_notes
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..80913c3f 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/';},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql';},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org';},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..ca74e8d1
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,104 @@
+{% extends "base/page.html" %}
+{% load pgfilters %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <div class="row">
+ <div class="col-md-3">
+ {% if release_note.previous is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.previous|release_notes_pg_minor_version:major_version }}/">
+ Previous
+ </a>
+ {% endif %}
+ </div>
+ <div class="col-md-6 text-center">
+ <p>
+ <a href="/docs/release/">
+ Return to the Release Notes Archive
+ </a>
+ </p>
+ </div>
+ <div class="col-md-3 text-right">
+ {% if release_note.next is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.next|release_notes_pg_minor_version:major_version }}/">
+ Next
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ <div class="col-md-2 version-list">
+ <section>
+ <h2>Versions</h2>
+ </section>
+ <ul>
+ {% for r in release_notes %}
+ <li>
+ {% if r.minor == release_note.minor %}
+ <strong>
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </strong>
+ {% else %}
+ <a href="/docs/release/{{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul class="release-notes-list fa-ul">
+ {% for release_note_group in release_note_groups %}
+ {% with major_version=release_note_group.grouper %}
+ <li>
+ <a class="collapsed" href="#release{{ major_version }}" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="release{{ major_version }}">
+ <span class="fa-li right"><i class="fas fa-angle-right"></i></span>
+ <span class="fa-li down"><i class="fas fa-angle-down"></i></span>
+ {% if major_version == 0 %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ </a>
+ <ul class="collapse release-notes-list" id="release{{ major_version }}">
+ {% for release_note in release_note_group.list %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </li>
+ {% endwith %}
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
From ba529fe1ded5c2d66e6910e779dfe218b2944e4c Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load
without 404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 62f0abb3..54690eec 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Create-Release-Notes-archive-in-the-Documentation-se.patch (13.5K, ../../961333c1-254b-8fae-4b53-4f6fa0dfe51f@postgresql.org/2-0001-Create-Release-Notes-archive-in-the-Documentation-se.patch)
download | inline diff:
From c884493494e5a29691bc85cb6c085c9cb0caecf8 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Tue, 12 Feb 2019 20:50:48 +0100
Subject: [PATCH 1/2] Create Release Notes archive in the Documentation
section.
This creates a consolidated area to reference all of the notes from
previous releases of PostgreSQL, as current releases only keep the
the notes for that specific major release of PostgreSQL.
---
media/css/main.css | 29 ++++++++++
pgweb/core/templatetags/pgfilters.py | 9 +++
pgweb/docs/views.py | 98 +++++++++++++++++++++++++++++++++
pgweb/urls.py | 2 +
pgweb/util/contexts.py | 1 +
pgweb/util/db.py | 7 +++
templates/docs/release_notes.html | 104 +++++++++++++++++++++++++++++++++++
7 files changed, 250 insertions(+)
create mode 100644 pgweb/util/db.py
create mode 100644 templates/docs/release_notes.html
diff --git a/media/css/main.css b/media/css/main.css
index e0462ad2..489ac916 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -1294,6 +1294,35 @@ table.sponsor-table tbody tr td:nth-child(3) {
width: 30%;
}
+/** Release Notes */
+#release-notes .navheader,
+#release-notes .navfooter,
+#release-notes .NAVHEADER,
+#release-notes .NAVFOOTER,
+#release-notes .titlepage,
+#release-notes h1.SECT1,
+#release-notes .toc {
+ display: none;
+}
+
+#release-notes .version-list h2:after {
+ content: none;
+}
+
+.release-notes-list {
+ list-style-type: none;
+}
+
+.release-notes-list :not(.collapsed) > .right,
+.release-notes-list .collapsed > .down {
+ display: none;
+}
+
+.release-notes-list .collapsed > .right,
+.release-notes-list :not(.collapsed) > .down {
+ display: block;
+}
+
/** ALL RESPONSIVE QUERIES HERE */
/* Small devices (landscape phones, 576px and up)*/
diff --git a/pgweb/core/templatetags/pgfilters.py b/pgweb/core/templatetags/pgfilters.py
index 13f2470c..4edeb95c 100644
--- a/pgweb/core/templatetags/pgfilters.py
+++ b/pgweb/core/templatetags/pgfilters.py
@@ -70,3 +70,12 @@ def dictlookup(value, key):
@register.filter(name='json')
def tojson(value):
return json.dumps(value)
+
+@register.filter()
+def release_notes_pg_minor_version(minor_version, major_version):
+ """Formats the minor version number to the appropriate PostgreSQL version.
+ This is particularly for very old version of PostgreSQL.
+ """
+ if str(major_version) in ['0', '1']:
+ return str(minor_version)[2:4]
+ return minor_version
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 4577f0ce..62f0abb3 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -13,6 +13,7 @@ from pgweb.util.helpers import template_to_string
from pgweb.util.misc import send_template_mail
from pgweb.core.models import Version
+from pgweb.util.db import exec_to_dict
from .models import DocPage
from .forms import DocCommentForm
@@ -140,6 +141,103 @@ def manualarchive(request):
'versions': [_VersionPdfWrapper(v) for v in versions],
})
+def release_notes(request, major_version=None, minor_version=None):
+ """Contains the main archive of release notes."""
+ # this query gets a list of a unique set of release notes for each version of
+ # PostgreSQL. From PostgreSQL 9.4+, release notes are only present for their
+ # specific version of PostgreSQL, so all legacy release notes are present in
+ # 9.3 and older
+ # First the query identifies all of the release note files that have been loaded
+ # into the docs. We will limit our lookup to release notes from 9.3 on up,
+ # given 9.3 has all the release notes for PostgreSQL 9.3 and older
+ # From there, it parses the version the release notes are for
+ # from the file name, and breaks it up into "major" and "minor" version from
+ # our understanding of how PostgreSQL version numbering is handled, which is
+ # in 3 camps: 1 and older, 6.0 - 9.6, 10 - current
+ # It is then put into a unique set
+ # Lastly, we determine the next/previous versions (lead/lag) so we are able
+ # to easily page between the different versions in the unique release note view
+ # We only include the content if we are doing an actual lookup on an exact
+ # major/minor release pair, to limit how much data we load into memory
+ sql = """
+ SELECT
+ {content}
+ file, major, minor,
+ lag(minor) OVER (PARTITION BY major ORDER BY minor) AS previous,
+ lead(minor) OVER (PARTITION BY major ORDER BY minor) AS next
+ FROM (
+ SELECT DISTINCT ON (file, major, minor)
+ {content}
+ file,
+ CASE
+ WHEN v[1]::int >= 10 THEN v[1]::numeric
+ WHEN v[1]::int <= 1 THEN v[1]::int
+ ELSE array_to_string(v[1:2], '.')::numeric END AS major,
+ COALESCE(
+ CASE
+ WHEN v[1]::int >= 10 THEN v[2]
+ WHEN v[1]::int <= 1 THEN '.' || v[2]
+ ELSE v[3]
+ END::numeric, 0
+ ) AS minor
+ FROM (
+ SELECT
+ {content}
+ file,
+ string_to_array(regexp_replace(file, 'release-(.*)\.htm.*', '\\1'), '-') AS v
+ FROM docs
+ WHERE file ~ '^release-\d+' AND version >= 9.3
+ ) r
+ ) rr
+ """
+ params = []
+ # if the major + minor version are provided, then we want to narrow down
+ # the results to all the release notes for the minor version, as we need the
+ # list of the entire set in order to generate the nice side bar in the release
+ # notes
+ # otherwise ensure the release notes are returned in order
+ if major_version is not None and minor_version is not None:
+ # at this point, include the content
+ sql = sql.format(content="content,")
+ # restrict to the major version, order from latest to earliest minor
+ sql = """{}
+ WHERE rr.major = %s
+ ORDER BY rr.minor DESC""".format(sql)
+ params += [major_version]
+ else:
+ sql = sql.format(content="")
+ sql += """
+ ORDER BY rr.major DESC, rr.minor DESC;
+ """
+ # run the query, loading a list of dict that contain all of the release
+ # notes that are filtered out by the query
+ release_notes = exec_to_dict(sql, params)
+ # determine which set of data to pass to the template:
+ # if both major/minor versions are present, we will load the release notes
+ # if neither are present, we load the list of all of the release notes to list out
+ if major_version is not None and minor_version is not None:
+ # first, see if any release notes were returned; if not, raise a 404
+ if not release_notes:
+ raise Http404()
+ # next, see if we can find the specific release notes we are looking for
+ # format what the "minor" version should look like
+ try:
+ minor = Decimal('0.{}'.format(minor_version) if major_version in ['0', '1'] else minor_version)
+ except TypeError:
+ raise Http404()
+ release_note = [r for r in release_notes if r['minor'] == minor][0]
+ # of course, if nothing is found, return a 404
+ if not release_note:
+ raise Http404()
+ context = {
+ 'major_version': major_version,
+ 'minor_version': minor_version,
+ 'release_note': release_note,
+ 'release_notes': release_notes
+ }
+ else:
+ context = { 'release_notes': release_notes }
+ return render_pgweb(request, 'docs', 'docs/release_notes.html', context)
@login_required
def commentform(request, itemid, version, filename):
diff --git a/pgweb/urls.py b/pgweb/urls.py
index d8c664f2..80913c3f 100644
--- a/pgweb/urls.py
+++ b/pgweb/urls.py
@@ -58,6 +58,8 @@ urlpatterns = [
url(r'^docs/$', pgweb.docs.views.root),
url(r'^docs/manuals/$', pgweb.docs.views.manuals),
url(r'^docs/manuals/archive/$', pgweb.docs.views.manualarchive),
+ url(r'^docs/release/$', pgweb.docs.views.release_notes),
+ url(r'^docs/release/((?P<major_version>(\d+\.\d+)|\d+)\.(?P<minor_version>\d+))/$', pgweb.docs.views.release_notes),
# Legacy URLs for accessing the docs page; provides a permanent redirect
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(static|interactive)/((.*).html?)?$', pgweb.docs.views.docspermanentredirect),
url(r'^docs/(current|devel|\d+(?:\.\d)?)/(.*).html?$', pgweb.docs.views.docpage),
diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py
index 25c4787e..c38f2480 100644
--- a/pgweb/util/contexts.py
+++ b/pgweb/util/contexts.py
@@ -34,6 +34,7 @@ sitenav = {
{'title': 'Japanese', 'link': 'http://www.postgresql.jp/document/'},
{'title': 'Russian', 'link': 'https://postgrespro.ru/docs/postgresql'},
]},
+ {'title': 'Release Notes', 'link': '/docs/release/'},
{'title': 'Books', 'link': '/docs/books/'},
{'title': 'Online Resources', 'link': '/docs/online-resources/'},
{'title': 'Wiki', 'link': 'https://wiki.postgresql.org'},
diff --git a/pgweb/util/db.py b/pgweb/util/db.py
new file mode 100644
index 00000000..a1efae0a
--- /dev/null
+++ b/pgweb/util/db.py
@@ -0,0 +1,7 @@
+from django.db import connection
+
+def exec_to_dict(query, params=None):
+ curs = connection.cursor()
+ curs.execute(query, params)
+ columns = [col[0] for col in curs.description]
+ return [dict(list(zip(columns, row))) for row in curs.fetchall()]
diff --git a/templates/docs/release_notes.html b/templates/docs/release_notes.html
new file mode 100644
index 00000000..ca74e8d1
--- /dev/null
+++ b/templates/docs/release_notes.html
@@ -0,0 +1,104 @@
+{% extends "base/page.html" %}
+{% load pgfilters %}
+
+{% block extrahead %}
+{% if major_version is not None and minor_version is not None %}
+ <base href="/docs/{{ major_version }}/" />
+{% endif %}
+{% endblock extrahead %}
+
+{%block title%}Release Notes{%endblock%}
+
+{% block contents %}
+{% regroup release_notes by major as release_note_groups %}
+
+<div id="release-notes" class="row">
+ {% if major_version is not None and minor_version is not None %}
+ <div class="col-md-10">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ <h2>
+ {% if major_version == '0' %}Postgres95{% else %}PostgreSQL{% endif %}
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </h2>
+ </section>
+ <div id="docContent">
+ {{ release_note.content|safe }}
+ </div>
+ <div class="row">
+ <div class="col-md-3">
+ {% if release_note.previous is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.previous|release_notes_pg_minor_version:major_version }}/">
+ Previous
+ </a>
+ {% endif %}
+ </div>
+ <div class="col-md-6 text-center">
+ <p>
+ <a href="/docs/release/">
+ Return to the Release Notes Archive
+ </a>
+ </p>
+ </div>
+ <div class="col-md-3 text-right">
+ {% if release_note.next is not None %}
+ <a href="/docs/release/{{ major_version }}.{{ release_note.next|release_notes_pg_minor_version:major_version }}/">
+ Next
+ </a>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ <div class="col-md-2 version-list">
+ <section>
+ <h2>Versions</h2>
+ </section>
+ <ul>
+ {% for r in release_notes %}
+ <li>
+ {% if r.minor == release_note.minor %}
+ <strong>
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </strong>
+ {% else %}
+ <a href="/docs/release/{{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ r.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% else %}
+ <div class="col-md-9">
+ <section>
+ <h1>Release Notes <i class="far fa-file-alt"></i></h1>
+ </section>
+ <p>Below is the complete archive of release notes for every version of PostgreSQL.</p>
+ <ul class="release-notes-list fa-ul">
+ {% for release_note_group in release_note_groups %}
+ {% with major_version=release_note_group.grouper %}
+ <li>
+ <a class="collapsed" href="#release{{ major_version }}" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="release{{ major_version }}">
+ <span class="fa-li right"><i class="fas fa-angle-right"></i></span>
+ <span class="fa-li down"><i class="fas fa-angle-down"></i></span>
+ {% if major_version == 0 %}Postgres95{% else %}PostgreSQL {{ major_version }}{% endif %}
+ </a>
+ <ul class="collapse release-notes-list" id="release{{ major_version }}">
+ {% for release_note in release_note_group.list %}
+ <li>
+ <a href="/docs/release/{{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}/">
+ {{ major_version }}.{{ release_note.minor|release_notes_pg_minor_version:major_version }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </li>
+ {% endwith %}
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
+</div>
+
+{% endblock %}
--
2.14.3 (Apple Git-98)
[text/plain] 0002-Ensure-release-notes-from-older-version-still-load-w.patch (3.6K, ../../961333c1-254b-8fae-4b53-4f6fa0dfe51f@postgresql.org/3-0002-Ensure-release-notes-from-older-version-still-load-w.patch)
download | inline diff:
From ba529fe1ded5c2d66e6910e779dfe218b2944e4c Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Wed, 13 Feb 2019 15:22:49 -0500
Subject: [PATCH 2/2] Ensure release notes from older version still load
without 404 errors.
An upcoming change in PostgreSQL keeps only release notes in their
current versions. So e.g., PostgreSQL 11 only has the release notes
for 11.0, 11.1, 11.2 etc.
Thus, for PostgreSQL 9.4 on up, any URLs such as /docs/10/release-9-6-8.html
would return a 404. Additonal, URLs with /current/ and /devel/ would break
as well.
This patch prevents these 404s from occuring by redirecting users accessing
release notes in the 9.4 and above documentation to the older versions
of the release notes by redirecting them to the notes in the specific
version. So in the above example, a user would be redirect to
/docs/9.6/release-9-6-8.html
As we do not have documentation on the website past 7.2, any release
notes from an older version are redirected to the release notes tree
in 7.2
---
pgweb/docs/views.py | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 62f0abb3..54690eec 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -5,8 +5,9 @@ from pgweb.util.decorators import login_required, allow_frames, content_sources
from django.db.models import Q
from django.conf import settings
-from decimal import Decimal
+from decimal import Decimal, ROUND_DOWN
import os
+import re
from pgweb.util.contexts import render_pgweb
from pgweb.util.helpers import template_to_string
@@ -54,6 +55,34 @@ def docpage(request, version, filename):
return HttpResponsePermanentRedirect("/docs/{0}/{1}.html".format(int(ver), filename))
fullname = "%s.%s" % (filename, extension)
+
+ # Before looking up the documentation, we need to make a check for release
+ # notes. Based on a change, from PostgreSQL 9.4 and up, release notes are
+ # only available for the current version (e.g. 11 only has 11.0, 11.1, 11.2)
+ # This checks to see if there is a mismatch (e.g. ver = 9.4, fullname = release-9-3-2.html)
+ # and perform a redirect to the older version
+ if fullname.startswith('release-') and ver >= Decimal("9.4"):
+ # figure out which version to redirect to. Note that the oldest version
+ # of the docs loaded is 7.2
+ release_version = re.sub(r'release-((\d+)(-\d+)?)(-\d+)?.html',
+ r'\1', fullname).replace('-', '.')
+ # convert to Decimal for ease of manipulation
+ release_version = Decimal(release_version)
+ # if the version is greater than 10, truncate the number
+ if release_version >= Decimal('10'):
+ release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
+ # only proceed if the release version of the documents does not match
+ # the calculated release version
+ if release_version != ver:
+ url = "/docs/"
+ if release_version >= Decimal('10'):
+ url += "{}/{}".format(int(release_version), fullname)
+ elif release_version < Decimal('7.2'):
+ url += "7.2/{}".format(fullname)
+ else:
+ url += "{}/{}".format(release_version, fullname)
+ return HttpResponsePermanentRedirect(url)
+
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.extra(
where=["file=%s OR file IN (SELECT file2 FROM docsalias WHERE file1=%s) OR file IN (SELECT file1 FROM docsalias WHERE file2=%s)"],
--
2.14.3 (Apple Git-98)
[application/pgp-signature] signature.asc (832B, ../../961333c1-254b-8fae-4b53-4f6fa0dfe51f@postgresql.org/4-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-03-09 19:10 ` Magnus Hagander <magnus@hagander.net>
2019-03-09 22:37 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Magnus Hagander @ 2019-03-09 19:10 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On Fri, Mar 8, 2019 at 11:21 AM Jonathan S. Katz <jkatz@postgresql.org>
wrote:
> On 3/2/19 12:22 PM, Jonathan S. Katz wrote:
> This is done. Latest version attached.
>
> Per in-person patch review, attached is the latest version.
>
> Noted changes:
>
> 1. Fixed bug with previous/next in template
> 2. Only load the "content" when it is needed, i.e. when looking at the
> specific release notes for a (major,minor) version pair
> 3. Use some arrows to make the collapsible list look more..collapsible
> 4. Updated some comments
>
LGTM!
--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 19:10 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
@ 2019-03-09 22:37 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 23:43 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 25+ messages in thread
From: Jonathan S. Katz @ 2019-03-09 22:37 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
On 3/9/19 11:10 AM, Magnus Hagander wrote:
> On Fri, Mar 8, 2019 at 11:21 AM Jonathan S. Katz <jkatz@postgresql.org
> <mailto:jkatz@postgresql.org>> wrote:
>
> On 3/2/19 12:22 PM, Jonathan S. Katz wrote:
> This is done. Latest version attached.
>
> Per in-person patch review, attached is the latest version.
>
> Noted changes:
>
> 1. Fixed bug with previous/next in template
> 2. Only load the "content" when it is needed, i.e. when looking at the
> specific release notes for a (major,minor) version pair
> 3. Use some arrows to make the collapsible list look more..collapsible
> 4. Updated some comments
>
>
> LGTM!
Thanks for the review. This has been pushed.
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../9d7e91e8-017b-e84a-588e-da96b698dc09@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 19:10 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-09 22:37 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
@ 2019-03-09 23:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-03-20 21:03 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 1 reply; 25+ messages in thread
From: Tom Lane @ 2019-03-09 23:43 UTC (permalink / raw)
To: Jonathan S. Katz <jkatz@postgresql.org>; +Cc: Magnus Hagander <magnus@hagander.net>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>
"Jonathan S. Katz" <jkatz@postgresql.org> writes:
> On 3/9/19 11:10 AM, Magnus Hagander wrote:
>> LGTM!
> Thanks for the review. This has been pushed.
Looks good to me too. I've updated the current-branch release note
sources to point to this archive.
regards, tom lane
^ permalink raw reply [nested|flat] 25+ messages in thread
* Re: Release Notes Archive Patch
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 19:10 ` Re: Release Notes Archive Patch Magnus Hagander <magnus@hagander.net>
2019-03-09 22:37 ` Re: Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 23:43 ` Re: Release Notes Archive Patch Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-03-20 21:03 ` Jonathan S. Katz <jkatz@postgresql.org>
0 siblings, 0 replies; 25+ messages in thread
From: Jonathan S. Katz @ 2019-03-20 21:03 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Magnus Hagander <magnus@hagander.net>; pgsql-www@lists.postgresql.org <pgsql-www@lists.postgresql.org>; Andres Freund <andres@anarazel.de>
On 3/9/19 6:43 PM, Tom Lane wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
>> On 3/9/19 11:10 AM, Magnus Hagander wrote:
>>> LGTM!
>
>> Thanks for the review. This has been pushed.
>
> Looks good to me too. I've updated the current-branch release note
> sources to point to this archive.
Andres noted a bug to me where if you went to a URL like:
https://www.postgresql.org/docs/devel/release-9-6.html
it would 404. I pushed a fix that redirects the user to the correct page.
Thanks,
Jonathan
Attachments:
[application/pgp-signature] signature.asc (832B, ../../51c9c9ad-4a6e-42fd-3f4e-47057ab0ae00@postgresql.org/2-signature.asc)
download
^ permalink raw reply [nested|flat] 25+ messages in thread
end of thread, other threads:[~2019-03-20 21:03 UTC | newest]
Thread overview: 25+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13 01:12 Release Notes Archive Patch Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 13:46 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 15:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 15:21 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 16:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 16:23 ` Magnus Hagander <magnus@hagander.net>
2019-02-13 18:17 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:01 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 18:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-02-13 18:44 ` Andres Freund <andres@anarazel.de>
2019-02-13 19:03 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 19:10 ` Andres Freund <andres@anarazel.de>
2019-02-13 19:34 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-13 20:33 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-19 10:42 ` Magnus Hagander <magnus@hagander.net>
2019-02-27 23:30 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 12:19 ` Magnus Hagander <magnus@hagander.net>
2019-02-28 15:14 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-02-28 19:12 ` Magnus Hagander <magnus@hagander.net>
2019-03-02 20:22 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-08 19:21 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 19:10 ` Magnus Hagander <magnus@hagander.net>
2019-03-09 22:37 ` Jonathan S. Katz <jkatz@postgresql.org>
2019-03-09 23:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-03-20 21:03 ` Jonathan S. Katz <jkatz@postgresql.org>
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