Skip to content

Commit 34b7020

Browse files
committed
docs: land height is "elevation", not "altitude"
See https://mapscaping.com/blogs/geo-candy/what-is-the-difference-between-elevation-relief-and-altitude No patching of regression tests. Reported-by: taf1@cornell.edu Discussion: https://postgr.es/m/158506544539.679.2278386310645558048@wrigleys.postgresql.org Backpatch-through: 9.5
1 parent 35d0865 commit 34b7020

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

doc/src/sgml/advanced.sgml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -585,20 +585,20 @@ SELECT sum(salary) OVER w, avg(salary) OVER w
585585
CREATE TABLE capitals (
586586
name text,
587587
population real,
588-
altitude int, -- (in ft)
588+
elevation int, -- (in ft)
589589
state char(2)
590590
);
591591

592592
CREATE TABLE non_capitals (
593593
name text,
594594
population real,
595-
altitude int -- (in ft)
595+
elevation int -- (in ft)
596596
);
597597

598598
CREATE VIEW cities AS
599-
SELECT name, population, altitude FROM capitals
599+
SELECT name, population, elevation FROM capitals
600600
UNION
601-
SELECT name, population, altitude FROM non_capitals;
601+
SELECT name, population, elevation FROM non_capitals;
602602
</programlisting>
603603

604604
This works OK as far as querying goes, but it gets ugly when you
@@ -612,7 +612,7 @@ CREATE VIEW cities AS
612612
CREATE TABLE cities (
613613
name text,
614614
population real,
615-
altitude int -- (in ft)
615+
elevation int -- (in ft)
616616
);
617617

618618
CREATE TABLE capitals (
@@ -624,7 +624,7 @@ CREATE TABLE capitals (
624624
<para>
625625
In this case, a row of <classname>capitals</classname>
626626
<firstterm>inherits</firstterm> all columns (<structfield>name</structfield>,
627-
<structfield>population</structfield>, and <structfield>altitude</structfield>) from its
627+
<structfield>population</structfield>, and <structfield>elevation</structfield>) from its
628628
<firstterm>parent</firstterm>, <classname>cities</classname>. The
629629
type of the column <structfield>name</structfield> is
630630
<type>text</type>, a native <productname>PostgreSQL</productname>
@@ -636,43 +636,43 @@ CREATE TABLE capitals (
636636

637637
<para>
638638
For example, the following query finds the names of all cities,
639-
including state capitals, that are located at an altitude
639+
including state capitals, that are located at an elevation
640640
over 500 feet:
641641

642642
<programlisting>
643-
SELECT name, altitude
643+
SELECT name, elevation
644644
FROM cities
645-
WHERE altitude &gt; 500;
645+
WHERE elevation &gt; 500;
646646
</programlisting>
647647

648648
which returns:
649649

650650
<screen>
651-
name | altitude
652-
-----------+----------
653-
Las Vegas | 2174
654-
Mariposa | 1953
655-
Madison | 845
651+
name | elevation
652+
-----------+-----------
653+
Las Vegas | 2174
654+
Mariposa | 1953
655+
Madison | 845
656656
(3 rows)
657657
</screen>
658658
</para>
659659

660660
<para>
661661
On the other hand, the following query finds
662662
all the cities that are not state capitals and
663-
are situated at an altitude over 500 feet:
663+
are situated at an elevation over 500 feet:
664664

665665
<programlisting>
666-
SELECT name, altitude
666+
SELECT name, elevation
667667
FROM ONLY cities
668-
WHERE altitude &gt; 500;
668+
WHERE elevation &gt; 500;
669669
</programlisting>
670670

671671
<screen>
672-
name | altitude
673-
-----------+----------
674-
Las Vegas | 2174
675-
Mariposa | 1953
672+
name | elevation
673+
-----------+-----------
674+
Las Vegas | 2174
675+
Mariposa | 1953
676676
(2 rows)
677677
</screen>
678678
</para>

doc/src/sgml/ddl.sgml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
25862586
CREATE TABLE cities (
25872587
name text,
25882588
population float,
2589-
altitude int -- in feet
2589+
elevation int -- in feet
25902590
);
25912591

25922592
CREATE TABLE capitals (
@@ -2606,40 +2606,40 @@ CREATE TABLE capitals (
26062606
rows of a table or all rows of a table plus all of its descendant tables.
26072607
The latter behavior is the default.
26082608
For example, the following query finds the names of all cities,
2609-
including state capitals, that are located at an altitude over
2609+
including state capitals, that are located at an elevation over
26102610
500 feet:
26112611

26122612
<programlisting>
2613-
SELECT name, altitude
2613+
SELECT name, elevation
26142614
FROM cities
2615-
WHERE altitude &gt; 500;
2615+
WHERE elevation &gt; 500;
26162616
</programlisting>
26172617

26182618
Given the sample data from the <productname>PostgreSQL</productname>
26192619
tutorial (see <xref linkend="tutorial-sql-intro"/>), this returns:
26202620

26212621
<programlisting>
2622-
name | altitude
2623-
-----------+----------
2624-
Las Vegas | 2174
2625-
Mariposa | 1953
2626-
Madison | 845
2622+
name | elevation
2623+
-----------+-----------
2624+
Las Vegas | 2174
2625+
Mariposa | 1953
2626+
Madison | 845
26272627
</programlisting>
26282628
</para>
26292629

26302630
<para>
26312631
On the other hand, the following query finds all the cities that
2632-
are not state capitals and are situated at an altitude over 500 feet:
2632+
are not state capitals and are situated at an elevation over 500 feet:
26332633

26342634
<programlisting>
2635-
SELECT name, altitude
2635+
SELECT name, elevation
26362636
FROM ONLY cities
2637-
WHERE altitude &gt; 500;
2637+
WHERE elevation &gt; 500;
26382638

2639-
name | altitude
2640-
-----------+----------
2641-
Las Vegas | 2174
2642-
Mariposa | 1953
2639+
name | elevation
2640+
-----------+-----------
2641+
Las Vegas | 2174
2642+
Mariposa | 1953
26432643
</programlisting>
26442644
</para>
26452645

@@ -2658,9 +2658,9 @@ SELECT name, altitude
26582658
to explicitly specify that descendant tables are included:
26592659

26602660
<programlisting>
2661-
SELECT name, altitude
2661+
SELECT name, elevation
26622662
FROM cities*
2663-
WHERE altitude &gt; 500;
2663+
WHERE elevation &gt; 500;
26642664
</programlisting>
26652665

26662666
Writing <literal>*</literal> is not necessary, since this behavior is always
@@ -2675,39 +2675,39 @@ SELECT name, altitude
26752675
originating table:
26762676

26772677
<programlisting>
2678-
SELECT c.tableoid, c.name, c.altitude
2678+
SELECT c.tableoid, c.name, c.elevation
26792679
FROM cities c
2680-
WHERE c.altitude &gt; 500;
2680+
WHERE c.elevation &gt; 500;
26812681
</programlisting>
26822682

26832683
which returns:
26842684

26852685
<programlisting>
2686-
tableoid | name | altitude
2687-
----------+-----------+----------
2688-
139793 | Las Vegas | 2174
2689-
139793 | Mariposa | 1953
2690-
139798 | Madison | 845
2686+
tableoid | name | elevation
2687+
----------+-----------+-----------
2688+
139793 | Las Vegas | 2174
2689+
139793 | Mariposa | 1953
2690+
139798 | Madison | 845
26912691
</programlisting>
26922692

26932693
(If you try to reproduce this example, you will probably get
26942694
different numeric OIDs.) By doing a join with
26952695
<structname>pg_class</structname> you can see the actual table names:
26962696

26972697
<programlisting>
2698-
SELECT p.relname, c.name, c.altitude
2698+
SELECT p.relname, c.name, c.elevation
26992699
FROM cities c, pg_class p
2700-
WHERE c.altitude &gt; 500 AND c.tableoid = p.oid;
2700+
WHERE c.elevation &gt; 500 AND c.tableoid = p.oid;
27012701
</programlisting>
27022702

27032703
which returns:
27042704

27052705
<programlisting>
2706-
relname | name | altitude
2707-
----------+-----------+----------
2708-
cities | Las Vegas | 2174
2709-
cities | Mariposa | 1953
2710-
capitals | Madison | 845
2706+
relname | name | elevation
2707+
----------+-----------+-----------
2708+
cities | Las Vegas | 2174
2709+
cities | Mariposa | 1953
2710+
capitals | Madison | 845
27112711
</programlisting>
27122712
</para>
27132713

@@ -2716,9 +2716,9 @@ WHERE c.altitude &gt; 500 AND c.tableoid = p.oid;
27162716
alias type, which will print the table OID symbolically:
27172717

27182718
<programlisting>
2719-
SELECT c.tableoid::regclass, c.name, c.altitude
2719+
SELECT c.tableoid::regclass, c.name, c.elevation
27202720
FROM cities c
2721-
WHERE c.altitude &gt; 500;
2721+
WHERE c.elevation &gt; 500;
27222722
</programlisting>
27232723
</para>
27242724

@@ -2728,7 +2728,7 @@ WHERE c.altitude &gt; 500;
27282728
other tables in the inheritance hierarchy. In our example, the
27292729
following <command>INSERT</command> statement will fail:
27302730
<programlisting>
2731-
INSERT INTO cities (name, population, altitude, state)
2731+
INSERT INTO cities (name, population, elevation, state)
27322732
VALUES ('Albany', NULL, NULL, 'NY');
27332733
</programlisting>
27342734
We might hope that the data would somehow be routed to the

0 commit comments

Comments
 (0)