Skip to content

Commit 28d332c

Browse files
committed
Language-annotate most documentation code blocks
1 parent 78ec02d commit 28d332c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+729
-730
lines changed

doc/src/sgml/advanced.sgml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<firstterm>view</firstterm> over the query, which gives a name to
4545
the query that you can refer to like an ordinary table:
4646

47-
<programlisting>
47+
<programlisting language="postgres">
4848
CREATE VIEW myview AS
4949
SELECT name, temp_lo, temp_hi, prcp, date, location
5050
FROM weather, cities
@@ -99,7 +99,7 @@ SELECT * FROM myview;
9999
<para>
100100
The new declaration of the tables would look like this:
101101

102-
<programlisting>
102+
<programlisting language="postgres">
103103
CREATE TABLE cities (
104104
name varchar(80) primary key,
105105
location point
@@ -116,11 +116,11 @@ CREATE TABLE weather (
116116

117117
Now try inserting an invalid record:
118118

119-
<programlisting>
119+
<programlisting language="postgres">
120120
INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
121121
</programlisting>
122122

123-
<screen>
123+
<screen language="postgres-shell">
124124
ERROR: insert or update on table "weather" violates foreign key constraint "weather_city_fkey"
125125
DETAIL: Key (city)=(Berkeley) is not present in table "cities".
126126
</screen>
@@ -160,7 +160,7 @@ DETAIL: Key (city)=(Berkeley) is not present in table "cities".
160160
to Bob's account. Simplifying outrageously, the SQL commands for this
161161
might look like:
162162

163-
<programlisting>
163+
<programlisting language="postgres">
164164
UPDATE accounts SET balance = balance - 100.00
165165
WHERE name = 'Alice';
166166
UPDATE branches SET balance = balance - 100.00
@@ -221,7 +221,7 @@ UPDATE branches SET balance = balance + 100.00
221221
<command>BEGIN</command> and <command>COMMIT</command> commands. So our banking
222222
transaction would actually look like:
223223

224-
<programlisting>
224+
<programlisting language="postgres">
225225
BEGIN;
226226
UPDATE accounts SET balance = balance - 100.00
227227
WHERE name = 'Alice';
@@ -290,7 +290,7 @@ COMMIT;
290290
have credited Wally's account. We could do it using savepoints like
291291
this:
292292

293-
<programlisting>
293+
<programlisting language="postgres">
294294
BEGIN;
295295
UPDATE accounts SET balance = balance - 100.00
296296
WHERE name = 'Alice';
@@ -339,11 +339,11 @@ COMMIT;
339339
Here is an example that shows how to compare each employee's salary
340340
with the average salary in his or her department:
341341

342-
<programlisting>
342+
<programlisting language="postgres">
343343
SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary;
344344
</programlisting>
345345

346-
<screen>
346+
<screen language="postgres-shell">
347347
depname | empno | salary | avg
348348
-----------+-------+--------+-----------------------
349349
develop | 11 | 5200 | 5020.0000000000000000
@@ -387,13 +387,13 @@ SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM emps
387387
(The window <literal>ORDER BY</literal> does not even have to match the
388388
order in which the rows are output.) Here is an example:
389389

390-
<programlisting>
390+
<programlisting language="postgres">
391391
SELECT depname, empno, salary,
392392
rank() OVER (PARTITION BY depname ORDER BY salary DESC)
393393
FROM empsalary;
394394
</programlisting>
395395

396-
<screen>
396+
<screen language="postgres-shell">
397397
depname | empno | salary | rank
398398
-----------+-------+--------+------
399399
develop | 8 | 6000 | 1
@@ -453,11 +453,11 @@ FROM empsalary;
453453
Here is an example using <function>sum</function>:
454454
</para>
455455

456-
<programlisting>
456+
<programlisting language="postgres">
457457
SELECT salary, sum(salary) OVER () FROM empsalary;
458458
</programlisting>
459459

460-
<screen>
460+
<screen language="postgres-shell">
461461
salary | sum
462462
--------+-------
463463
5200 | 47100
@@ -482,11 +482,11 @@ SELECT salary, sum(salary) OVER () FROM empsalary;
482482
results:
483483
</para>
484484

485-
<programlisting>
485+
<programlisting language="postgres">
486486
SELECT salary, sum(salary) OVER (ORDER BY salary) FROM empsalary;
487487
</programlisting>
488488

489-
<screen>
489+
<screen language="postgres-shell">
490490
salary | sum
491491
--------+-------
492492
3500 | 3500
@@ -523,7 +523,7 @@ SELECT salary, sum(salary) OVER (ORDER BY salary) FROM empsalary;
523523
If there is a need to filter or group rows after the window calculations
524524
are performed, you can use a sub-select. For example:
525525

526-
<programlisting>
526+
<programlisting language="postgres">
527527
SELECT depname, empno, salary, enroll_date
528528
FROM
529529
(SELECT depname, empno, salary, enroll_date,
@@ -545,7 +545,7 @@ WHERE pos &lt; 3;
545545
in a <literal>WINDOW</literal> clause and then referenced in <literal>OVER</literal>.
546546
For example:
547547

548-
<programlisting>
548+
<programlisting language="postgres">
549549
SELECT sum(salary) OVER w, avg(salary) OVER w
550550
FROM empsalary
551551
WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);
@@ -581,7 +581,7 @@ SELECT sum(salary) OVER w, avg(salary) OVER w
581581
implicitly when you list all cities. If you're really clever you
582582
might invent some scheme like this:
583583

584-
<programlisting>
584+
<programlisting language="postgres">
585585
CREATE TABLE capitals (
586586
name text,
587587
population real,
@@ -608,7 +608,7 @@ CREATE VIEW cities AS
608608
<para>
609609
A better solution is this:
610610

611-
<programlisting>
611+
<programlisting language="postgres">
612612
CREATE TABLE cities (
613613
name text,
614614
population real,
@@ -641,15 +641,15 @@ CREATE TABLE capitals (
641641
including state capitals, that are located at an elevation
642642
over 500 feet:
643643

644-
<programlisting>
644+
<programlisting language="postgres">
645645
SELECT name, elevation
646646
FROM cities
647647
WHERE elevation &gt; 500;
648648
</programlisting>
649649

650650
which returns:
651651

652-
<screen>
652+
<screen language="postgres-shell">
653653
name | elevation
654654
-----------+-----------
655655
Las Vegas | 2174
@@ -664,13 +664,13 @@ SELECT name, elevation
664664
all the cities that are not state capitals and
665665
are situated at an elevation over 500 feet:
666666

667-
<programlisting>
667+
<programlisting language="postgres">
668668
SELECT name, elevation
669669
FROM ONLY cities
670670
WHERE elevation &gt; 500;
671671
</programlisting>
672672

673-
<screen>
673+
<screen language="postgres-shell">
674674
name | elevation
675675
-----------+-----------
676676
Las Vegas | 2174

doc/src/sgml/amcheck.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<para>
6969
<function>bt_index_check</function> tests that its target, a
7070
B-Tree index, respects a variety of invariants. Example usage:
71-
<screen>
71+
<screen language="postgres-shell">
7272
test=# SELECT bt_index_check(index =&gt; c.oid, heapallindexed =&gt; i.indisunique),
7373
c.relname,
7474
c.relpages
@@ -192,7 +192,7 @@ ORDER BY c.relpages DESC LIMIT 10;
192192
may also find this information helpful, since it provides
193193
additional context should verification actually detect an
194194
inconsistency. Running:
195-
<programlisting>
195+
<programlisting language="postgres">
196196
SET client_min_messages = DEBUG1;
197197
</programlisting>
198198
in an interactive <application>psql</application> session before

doc/src/sgml/archive-modules.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
struct that needs to be filled with the callback function pointers for
5252
individual actions.
5353

54-
<programlisting>
54+
<programlisting language="c">
5555
typedef struct ArchiveModuleCallbacks
5656
{
5757
ArchiveCheckConfiguredCB check_configured_cb;
@@ -82,15 +82,15 @@ typedef void (*ArchiveModuleInit) (struct ArchiveModuleCallbacks *cb);
8282
<function>check_configured_cb</function> is defined, the server always
8383
assumes the module is configured.
8484

85-
<programlisting>
85+
<programlisting language="c">
8686
typedef bool (*ArchiveCheckConfiguredCB) (void);
8787
</programlisting>
8888

8989
If <literal>true</literal> is returned, the server will proceed with
9090
archiving the file by calling the <function>archive_file_cb</function>
9191
callback. If <literal>false</literal> is returned, archiving will not
9292
proceed, and the archiver will emit the following message to the server log:
93-
<screen>
93+
<screen language="postgres-shell">
9494
WARNING: archive_mode enabled, yet archiving is not configured
9595
</screen>
9696
In the latter case, the server will periodically call this function, and
@@ -104,7 +104,7 @@ WARNING: archive_mode enabled, yet archiving is not configured
104104
The <function>archive_file_cb</function> callback is called to archive a
105105
single WAL file.
106106

107-
<programlisting>
107+
<programlisting language="c">
108108
typedef bool (*ArchiveFileCB) (const char *file, const char *path);
109109
</programlisting>
110110

@@ -127,7 +127,7 @@ typedef bool (*ArchiveFileCB) (const char *file, const char *path);
127127
<function>shutdown_cb</function> is defined, no special action is taken in
128128
these situations.
129129

130-
<programlisting>
130+
<programlisting language="c">
131131
typedef void (*ArchiveShutdownCB) (void);
132132
</programlisting>
133133
</para>

0 commit comments

Comments
 (0)