mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
This commit is contained in:
		@@ -585,20 +585,20 @@ SELECT sum(salary) OVER w, avg(salary) OVER w
 | 
				
			|||||||
CREATE TABLE capitals (
 | 
					CREATE TABLE capitals (
 | 
				
			||||||
  name       text,
 | 
					  name       text,
 | 
				
			||||||
  population real,
 | 
					  population real,
 | 
				
			||||||
  altitude   int,    -- (in ft)
 | 
					  elevation  int,    -- (in ft)
 | 
				
			||||||
  state      char(2)
 | 
					  state      char(2)
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE non_capitals (
 | 
					CREATE TABLE non_capitals (
 | 
				
			||||||
  name       text,
 | 
					  name       text,
 | 
				
			||||||
  population real,
 | 
					  population real,
 | 
				
			||||||
  altitude   int     -- (in ft)
 | 
					  elevation  int     -- (in ft)
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE VIEW cities AS
 | 
					CREATE VIEW cities AS
 | 
				
			||||||
  SELECT name, population, altitude FROM capitals
 | 
					  SELECT name, population, elevation FROM capitals
 | 
				
			||||||
    UNION
 | 
					    UNION
 | 
				
			||||||
  SELECT name, population, altitude FROM non_capitals;
 | 
					  SELECT name, population, elevation FROM non_capitals;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    This works OK as far as querying goes, but it gets ugly when you
 | 
					    This works OK as far as querying goes, but it gets ugly when you
 | 
				
			||||||
@@ -612,7 +612,7 @@ CREATE VIEW cities AS
 | 
				
			|||||||
CREATE TABLE cities (
 | 
					CREATE TABLE cities (
 | 
				
			||||||
  name       text,
 | 
					  name       text,
 | 
				
			||||||
  population real,
 | 
					  population real,
 | 
				
			||||||
  altitude   int     -- (in ft)
 | 
					  elevation  int     -- (in ft)
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE capitals (
 | 
					CREATE TABLE capitals (
 | 
				
			||||||
@@ -624,7 +624,7 @@ CREATE TABLE capitals (
 | 
				
			|||||||
   <para>
 | 
					   <para>
 | 
				
			||||||
    In this case, a row of <classname>capitals</classname>
 | 
					    In this case, a row of <classname>capitals</classname>
 | 
				
			||||||
    <firstterm>inherits</firstterm> all columns (<structfield>name</>,
 | 
					    <firstterm>inherits</firstterm> all columns (<structfield>name</>,
 | 
				
			||||||
    <structfield>population</>, and <structfield>altitude</>) from its
 | 
					    <structfield>population</structfield>, and <structfield>elevation</structfield>) from its
 | 
				
			||||||
    <firstterm>parent</firstterm>, <classname>cities</classname>.  The
 | 
					    <firstterm>parent</firstterm>, <classname>cities</classname>.  The
 | 
				
			||||||
    type of the column <structfield>name</structfield> is
 | 
					    type of the column <structfield>name</structfield> is
 | 
				
			||||||
    <type>text</type>, a native <productname>PostgreSQL</productname>
 | 
					    <type>text</type>, a native <productname>PostgreSQL</productname>
 | 
				
			||||||
@@ -636,20 +636,20 @@ CREATE TABLE capitals (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   <para>
 | 
					   <para>
 | 
				
			||||||
    For example, the  following  query finds the  names  of  all  cities,
 | 
					    For example, the  following  query finds the  names  of  all  cities,
 | 
				
			||||||
    including  state capitals, that are located at an altitude
 | 
					    including  state capitals, that are located at an elevation
 | 
				
			||||||
    over 500 feet:
 | 
					    over 500 feet:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT name, altitude
 | 
					SELECT name, elevation
 | 
				
			||||||
  FROM cities
 | 
					  FROM cities
 | 
				
			||||||
  WHERE altitude > 500;
 | 
					  WHERE elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    which returns:
 | 
					    which returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<screen>
 | 
					<screen>
 | 
				
			||||||
   name    | altitude
 | 
					   name    | elevation
 | 
				
			||||||
-----------+----------
 | 
					-----------+-----------
 | 
				
			||||||
 Las Vegas |      2174
 | 
					 Las Vegas |      2174
 | 
				
			||||||
 Mariposa  |      1953
 | 
					 Mariposa  |      1953
 | 
				
			||||||
 Madison   |       845
 | 
					 Madison   |       845
 | 
				
			||||||
@@ -660,17 +660,17 @@ SELECT name, altitude
 | 
				
			|||||||
   <para>
 | 
					   <para>
 | 
				
			||||||
    On the other hand, the  following  query  finds
 | 
					    On the other hand, the  following  query  finds
 | 
				
			||||||
    all  the cities that are not state capitals and
 | 
					    all  the cities that are not state capitals and
 | 
				
			||||||
    are situated at an altitude over 500 feet:
 | 
					    are situated at an elevation over 500 feet:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT name, altitude
 | 
					SELECT name, elevation
 | 
				
			||||||
    FROM ONLY cities
 | 
					    FROM ONLY cities
 | 
				
			||||||
    WHERE altitude > 500;
 | 
					    WHERE elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<screen>
 | 
					<screen>
 | 
				
			||||||
   name    | altitude
 | 
					   name    | elevation
 | 
				
			||||||
-----------+----------
 | 
					-----------+-----------
 | 
				
			||||||
 Las Vegas |      2174
 | 
					 Las Vegas |      2174
 | 
				
			||||||
 Mariposa  |      1953
 | 
					 Mariposa  |      1953
 | 
				
			||||||
(2 rows)
 | 
					(2 rows)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2574,7 +2574,7 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
 | 
				
			|||||||
CREATE TABLE cities (
 | 
					CREATE TABLE cities (
 | 
				
			||||||
    name            text,
 | 
					    name            text,
 | 
				
			||||||
    population      float,
 | 
					    population      float,
 | 
				
			||||||
    altitude        int     -- in feet
 | 
					    elevation       int     -- in feet
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE capitals (
 | 
					CREATE TABLE capitals (
 | 
				
			||||||
@@ -2594,21 +2594,21 @@ CREATE TABLE capitals (
 | 
				
			|||||||
   rows of a table or all rows of a table plus all of its descendant tables.
 | 
					   rows of a table or all rows of a table plus all of its descendant tables.
 | 
				
			||||||
   The latter behavior is the default.
 | 
					   The latter behavior is the default.
 | 
				
			||||||
   For example, the following query finds the names of all cities,
 | 
					   For example, the following query finds the names of all cities,
 | 
				
			||||||
   including state capitals, that are located at an altitude over
 | 
					   including state capitals, that are located at an elevation over
 | 
				
			||||||
   500 feet:
 | 
					   500 feet:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT name, altitude
 | 
					SELECT name, elevation
 | 
				
			||||||
    FROM cities
 | 
					    FROM cities
 | 
				
			||||||
    WHERE altitude > 500;
 | 
					    WHERE elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Given the sample data from the <productname>PostgreSQL</productname>
 | 
					   Given the sample data from the <productname>PostgreSQL</productname>
 | 
				
			||||||
   tutorial (see <xref linkend="tutorial-sql-intro">), this returns:
 | 
					   tutorial (see <xref linkend="tutorial-sql-intro">), this returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
   name    | altitude
 | 
					   name    | elevation
 | 
				
			||||||
-----------+----------
 | 
					-----------+-----------
 | 
				
			||||||
 Las Vegas |      2174
 | 
					 Las Vegas |      2174
 | 
				
			||||||
 Mariposa  |      1953
 | 
					 Mariposa  |      1953
 | 
				
			||||||
 Madison   |       845
 | 
					 Madison   |       845
 | 
				
			||||||
@@ -2617,15 +2617,15 @@ SELECT name, altitude
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  <para>
 | 
					  <para>
 | 
				
			||||||
   On the other hand, the following query finds all the cities that
 | 
					   On the other hand, the following query finds all the cities that
 | 
				
			||||||
   are not state capitals and are situated at an altitude over 500 feet:
 | 
					   are not state capitals and are situated at an elevation over 500 feet:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT name, altitude
 | 
					SELECT name, elevation
 | 
				
			||||||
    FROM ONLY cities
 | 
					    FROM ONLY cities
 | 
				
			||||||
    WHERE altitude > 500;
 | 
					    WHERE elevation > 500;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   name    | altitude
 | 
					   name    | elevation
 | 
				
			||||||
-----------+----------
 | 
					-----------+-----------
 | 
				
			||||||
 Las Vegas |      2174
 | 
					 Las Vegas |      2174
 | 
				
			||||||
 Mariposa  |      1953
 | 
					 Mariposa  |      1953
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
@@ -2646,9 +2646,9 @@ SELECT name, altitude
 | 
				
			|||||||
   to explicitly specify that descendant tables are included:
 | 
					   to explicitly specify that descendant tables are included:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT name, altitude
 | 
					SELECT name, elevation
 | 
				
			||||||
    FROM cities*
 | 
					    FROM cities*
 | 
				
			||||||
    WHERE altitude > 500;
 | 
					    WHERE elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Writing <literal>*</> is not necessary, since this behavior is always
 | 
					   Writing <literal>*</> is not necessary, since this behavior is always
 | 
				
			||||||
@@ -2663,16 +2663,16 @@ SELECT name, altitude
 | 
				
			|||||||
   originating table:
 | 
					   originating table:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT c.tableoid, c.name, c.altitude
 | 
					SELECT c.tableoid, c.name, c.elevation
 | 
				
			||||||
FROM cities c
 | 
					FROM cities c
 | 
				
			||||||
WHERE c.altitude > 500;
 | 
					WHERE c.elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   which returns:
 | 
					   which returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
 tableoid |   name    | altitude
 | 
					 tableoid |   name    | elevation
 | 
				
			||||||
----------+-----------+----------
 | 
					----------+-----------+-----------
 | 
				
			||||||
   139793 | Las Vegas |      2174
 | 
					   139793 | Las Vegas |      2174
 | 
				
			||||||
   139793 | Mariposa  |      1953
 | 
					   139793 | Mariposa  |      1953
 | 
				
			||||||
   139798 | Madison   |       845
 | 
					   139798 | Madison   |       845
 | 
				
			||||||
@@ -2683,16 +2683,16 @@ WHERE c.altitude > 500;
 | 
				
			|||||||
   <structname>pg_class</> you can see the actual table names:
 | 
					   <structname>pg_class</> you can see the actual table names:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT p.relname, c.name, c.altitude
 | 
					SELECT p.relname, c.name, c.elevation
 | 
				
			||||||
FROM cities c, pg_class p
 | 
					FROM cities c, pg_class p
 | 
				
			||||||
WHERE c.altitude > 500 AND c.tableoid = p.oid;
 | 
					WHERE c.elevation > 500 AND c.tableoid = p.oid;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   which returns:
 | 
					   which returns:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
 relname  |   name    | altitude
 | 
					 relname  |   name    | elevation
 | 
				
			||||||
----------+-----------+----------
 | 
					----------+-----------+-----------
 | 
				
			||||||
 cities   | Las Vegas |      2174
 | 
					 cities   | Las Vegas |      2174
 | 
				
			||||||
 cities   | Mariposa  |      1953
 | 
					 cities   | Mariposa  |      1953
 | 
				
			||||||
 capitals | Madison   |       845
 | 
					 capitals | Madison   |       845
 | 
				
			||||||
@@ -2704,9 +2704,9 @@ WHERE c.altitude > 500 AND c.tableoid = p.oid;
 | 
				
			|||||||
   alias type, which will print the table OID symbolically:
 | 
					   alias type, which will print the table OID symbolically:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
SELECT c.tableoid::regclass, c.name, c.altitude
 | 
					SELECT c.tableoid::regclass, c.name, c.elevation
 | 
				
			||||||
FROM cities c
 | 
					FROM cities c
 | 
				
			||||||
WHERE c.altitude > 500;
 | 
					WHERE c.elevation > 500;
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
  </para>
 | 
					  </para>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2716,7 +2716,7 @@ WHERE c.altitude > 500;
 | 
				
			|||||||
   other tables in the inheritance hierarchy. In our example, the
 | 
					   other tables in the inheritance hierarchy. In our example, the
 | 
				
			||||||
   following <command>INSERT</command> statement will fail:
 | 
					   following <command>INSERT</command> statement will fail:
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
INSERT INTO cities (name, population, altitude, state)
 | 
					INSERT INTO cities (name, population, elevation, state)
 | 
				
			||||||
VALUES ('Albany', NULL, NULL, 'NY');
 | 
					VALUES ('Albany', NULL, NULL, 'NY');
 | 
				
			||||||
</programlisting>
 | 
					</programlisting>
 | 
				
			||||||
   We might hope that the data would somehow be routed to the
 | 
					   We might hope that the data would somehow be routed to the
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user