Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit980a855

Browse files
committed
doc: consistently use "structname" and "structfield" markup
Previously "literal" and "classname" were used, inconsistently, forSQL table and column names.Reported-by: Peter SmithAuthor: Peter SmithDiscussion:https://postgr.es/m/CAHut+Pvtf24r+bdPgBind84dBLPvgNL7aB+=HxAUupdPuo2gRg@mail.gmail.comBackpatch-through: master
1 parente8bfad4 commit980a855

33 files changed

+166
-166
lines changed

‎doc/src/sgml/advanced.sgml‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ SELECT * FROM myview;
8080
</indexterm>
8181

8282
<para>
83-
Recall the <classname>weather</classname> and
84-
<classname>cities</classname> tables from <xref
83+
Recall the <structname>weather</structname> and
84+
<structname>cities</structname> tables from <xref
8585
linkend="tutorial-sql"/>. Consider the following problem: You
8686
want to make sure that no one can insert rows in the
87-
<classname>weather</classname> table that do not have a matching
88-
entry in the <classname>cities</classname> table. This is called
87+
<structname>weather</structname> table that do not have a matching
88+
entry in the <structname>cities</structname> table. This is called
8989
maintaining the <firstterm>referential integrity</firstterm> of
9090
your data. In simplistic database systems this would be
9191
implemented (if at all) by first looking at the
92-
<classname>cities</classname> table to check if a matching record
92+
<structname>cities</structname> table to check if a matching record
9393
exists, and then inserting or rejecting the new
94-
<classname>weather</classname> records. This approach has a
94+
<structname>weather</structname> records. This approach has a
9595
number of problems and is very inconvenient, so
9696
<productname>PostgreSQL</productname> can do this for you.
9797
</para>
@@ -578,8 +578,8 @@ SELECT sum(salary) OVER w, avg(salary) OVER w
578578
</para>
579579

580580
<para>
581-
Let's create two tables: A table <classname>cities</classname>
582-
and a table <classname>capitals</classname>. Naturally, capitals
581+
Let's create two tables: A table <structname>cities</structname>
582+
and a table <structname>capitals</structname>. Naturally, capitals
583583
are also cities, so you want some way to show the capitals
584584
implicitly when you list all cities. If you're really clever you
585585
might invent some scheme like this:
@@ -625,14 +625,14 @@ CREATE TABLE capitals (
625625
</para>
626626

627627
<para>
628-
In this case, a row of <classname>capitals</classname>
628+
In this case, a row of <structname>capitals</structname>
629629
<firstterm>inherits</firstterm> all columns (<structfield>name</structfield>,
630630
<structfield>population</structfield>, and <structfield>elevation</structfield>) from its
631-
<firstterm>parent</firstterm>, <classname>cities</classname>. The
631+
<firstterm>parent</firstterm>, <structname>cities</structname>. The
632632
type of the column <structfield>name</structfield> is
633633
<type>text</type>, a native <productname>PostgreSQL</productname>
634634
type for variable length character strings. The
635-
<classname>capitals</classname> table has
635+
<structname>capitals</structname> table has
636636
an additional column, <structfield>state</structfield>, which shows its
637637
state abbreviation. In
638638
<productname>PostgreSQL</productname>, a table can inherit from
@@ -685,8 +685,8 @@ SELECT name, elevation
685685
<para>
686686
Here the <literal>ONLY</literal> before <literal>cities</literal>
687687
indicates that the query should be run over only the
688-
<classname>cities</classname> table, and not tables below
689-
<classname>cities</classname> in the inheritance hierarchy. Many
688+
<structname>cities</structname> table, and not tables below
689+
<structname>cities</structname> in the inheritance hierarchy. Many
690690
of the commands that we have already discussed &mdash;
691691
<command>SELECT</command>, <command>UPDATE</command>, and
692692
<command>DELETE</command> &mdash; support this <literal>ONLY</literal>

‎doc/src/sgml/ddl.sgml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ CREATE TABLE posts (
13531353
);
13541354
</programlisting>
13551355
Without the specification of the column, the foreign key would also set
1356-
the column <literal>tenant_id</literal> to null, but that column is still
1356+
the column <structfield>tenant_id</structfield> to null, but that column is still
13571357
required as part of the primary key.
13581358
</para>
13591359

@@ -2831,7 +2831,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
28312831

28322832
<para>
28332833
As an example, suppose that user <literal>miriam</literal> creates
2834-
table <literal>mytable</literal> and does:
2834+
table <structname>mytable</structname> and does:
28352835
<programlisting>
28362836
GRANT SELECT ON mytable TO PUBLIC;
28372837
GRANT SELECT, UPDATE, INSERT ON mytable TO admin;
@@ -3059,7 +3059,7 @@ CREATE POLICY user_mod_policy ON users
30593059

30603060
<para>
30613061
Below is a larger example of how this feature can be used in production
3062-
environments. The table <literal>passwd</literal> emulates a Unix password
3062+
environments. The table <structname>passwd</structname> emulates a Unix password
30633063
file:
30643064
</para>
30653065

‎doc/src/sgml/ecpg.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ while (1)
18271827
in <xref linkend="xtypes"/>. The following example inserts the
18281828
complex type values <literal>(1,1)</literal>
18291829
and <literal>(3,3)</literal> into the
1830-
columns <literal>a</literal> and <literal>b</literal>, and select
1830+
columns <structfield>a</structfield> and <structfield>b</structfield>, and select
18311831
them from the table after that.
18321832

18331833
<programlisting>

‎doc/src/sgml/func/func-json.sgml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,8 +3899,8 @@ SELECT jt.* FROM
38993899
<literal>NESTED</literal> paths <literal>$.movies[*]</literal> and
39003900
<literal>$.books[*]</literal> and also the usage of
39013901
<literal>FOR ORDINALITY</literal> column at <literal>NESTED</literal>
3902-
levels (columns <literal>movie_id</literal>, <literal>book_id</literal>,
3903-
and <literal>author_id</literal>):
3902+
levels (columns <structfield>movie_id</structfield>, <structfield>book_id</structfield>,
3903+
and <structfield>author_id</structfield>):
39043904

39053905
<programlisting>
39063906
SELECT * FROM JSON_TABLE (

‎doc/src/sgml/indices.sgml‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ CREATE INDEX test2_mm_idx ON test2 (major, minor);
593593
By default, B-tree indexes store their entries in ascending order
594594
with nulls last (table TID is treated as a tiebreaker column among
595595
otherwise equal entries). This means that a forward scan of an
596-
index on column <literal>x</literal> produces output satisfying <literal>ORDER BY x</literal>
596+
index on column <structfield>x</structfield> produces output satisfying <literal>ORDER BY x</literal>
597597
(or more verbosely, <literal>ORDER BY x ASC NULLS LAST</literal>). The
598598
index can also be scanned backward, producing output satisfying
599599
<literal>ORDER BY x DESC</literal>
@@ -698,23 +698,23 @@ CREATE INDEX test3_desc_index ON test3 (id DESC NULLS LAST);
698698
indexes are best, but sometimes it's better to create separate indexes
699699
and rely on the index-combination feature. For example, if your
700700
workload includes a mix of queries that sometimes involve only column
701-
<literal>x</literal>, sometimes only column <literal>y</literal>, and sometimes both
701+
<structfield>x</structfield>, sometimes only column <structfield>y</structfield>, and sometimes both
702702
columns, you might choose to create two separate indexes on
703-
<literal>x</literal> and <literal>y</literal>, relying on index combination to
703+
<structfield>x</structfield> and <structfield>y</structfield>, relying on index combination to
704704
process the queries that use both columns. You could also create a
705705
multicolumn index on <literal>(x, y)</literal>. This index would typically be
706706
more efficient than index combination for queries involving both
707707
columns, but as discussed in <xref linkend="indexes-multicolumn"/>, it
708708
would be less useful for queries involving only <literal>y</literal>. Just
709709
how useful will depend on how effective the B-tree index skip scan
710-
optimization is; if <literal>x</literal> has no more than several hundred
710+
optimization is; if <structfield>x</structfield> has no more than several hundred
711711
distinct values, skip scan will make searches for specific
712-
<literal>y</literal> values execute reasonably efficiently. A combination
712+
<structfield>y</structfield> values execute reasonably efficiently. A combination
713713
of a multicolumn index on <literal>(x, y)</literal> and a separate index on
714-
<literal>y</literal> might also serve reasonably well. For
715-
queries involving only <literal>x</literal>, the multicolumn index could be
714+
<structfield>y</structfield> might also serve reasonably well. For
715+
queries involving only <structfield>x</structfield>, the multicolumn index could be
716716
used, though it would be larger and hence slower than an index on
717-
<literal>x</literal> alone. The last alternative is to create all three
717+
<structfield>x</structfield> alone. The last alternative is to create all three
718718
indexes, but this is probably only reasonable if the table is searched
719719
much more often than it is updated and all three types of query are
720720
common. If one of the types of query is much less common than the
@@ -1179,9 +1179,9 @@ CREATE INDEX mytable_cat_data ON mytable (category, data);
11791179
<listitem>
11801180
<para>
11811181
The query must reference only columns stored in the index. For
1182-
example, given an index on columns <literal>x</literal>
1183-
and <literal>y</literal> of a table that also has a
1184-
column <literal>z</literal>, these queries could use index-only scans:
1182+
example, given an index on columns <structfield>x</structfield>
1183+
and <structfield>y</structfield> of a table that also has a
1184+
column <structfield>z</structfield>, these queries could use index-only scans:
11851185
<programlisting>
11861186
SELECT x, y FROM tab WHERE x = 'key';
11871187
SELECT x FROM tab WHERE x = 'key' AND y &lt; 42;
@@ -1262,15 +1262,15 @@ CREATE INDEX tab_x_y ON tab(x) INCLUDE (y);
12621262
</para>
12631263

12641264
<para>
1265-
Because column <literal>y</literal> is not part of the index's search
1265+
Because column <structfield>y</structfield> is not part of the index's search
12661266
key, it does not have to be of a data type that the index can handle;
12671267
it's merely stored in the index and is not interpreted by the index
12681268
machinery. Also, if the index is a unique index, that is
12691269
<programlisting>
12701270
CREATE UNIQUE INDEX tab_x_y ON tab(x) INCLUDE (y);
12711271
</programlisting>
1272-
the uniqueness condition applies to just column <literal>x</literal>,
1273-
not to the combination of <literal>x</literal> and <literal>y</literal>.
1272+
the uniqueness condition applies to just column <structfield>x</structfield>,
1273+
not to the combination of <structfield>x</structfield> and <structfield>y</structfield>.
12741274
(An <literal>INCLUDE</literal> clause can also be written
12751275
in <literal>UNIQUE</literal> and <literal>PRIMARY KEY</literal>
12761276
constraints, providing alternative syntax for setting up an index like
@@ -1300,7 +1300,7 @@ CREATE UNIQUE INDEX tab_x_y ON tab(x) INCLUDE (y);
13001300
<programlisting>
13011301
CREATE INDEX tab_x_y ON tab(x, y);
13021302
</programlisting>
1303-
even though they had no intention of ever using <literal>y</literal> as
1303+
even though they had no intention of ever using <structfield>y</structfield> as
13041304
part of a <literal>WHERE</literal> clause. This works fine as long as
13051305
the extra columns are trailing columns; making them be leading columns is
13061306
unwise for the reasons explained in <xref linkend="indexes-multicolumn"/>.
@@ -1340,7 +1340,7 @@ SELECT f(x) FROM tab WHERE f(x) &lt; 1;
13401340
context <literal>f(x)</literal>, but the planner does not notice that and
13411341
concludes that an index-only scan is not possible. If an index-only scan
13421342
seems sufficiently worthwhile, this can be worked around by
1343-
adding <literal>x</literal> as an included column, for example
1343+
adding <structfield>x</structfield> as an included column, for example
13441344
<programlisting>
13451345
CREATE INDEX tab_f_x ON tab (f(x)) INCLUDE (x);
13461346
</programlisting>

‎doc/src/sgml/information_schema.sgml‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,15 +2089,15 @@
20892089
Since data types can be defined in a variety of ways in SQL, and
20902090
<productname>PostgreSQL</productname> contains additional ways to
20912091
define data types, their representation in the information schema
2092-
can be somewhat difficult. The column <literal>data_type</literal>
2092+
can be somewhat difficult. The column <structfield>data_type</structfield>
20932093
is supposed to identify the underlying built-in type of the column.
20942094
In <productname>PostgreSQL</productname>, this means that the type
20952095
is defined in the system catalog schema
20962096
<literal>pg_catalog</literal>. This column might be useful if the
20972097
application can handle the well-known built-in types specially (for
20982098
example, format the numeric types differently or use the data in
2099-
the precision columns). The columns <literal>udt_name</literal>,
2100-
<literal>udt_schema</literal>, and <literal>udt_catalog</literal>
2099+
the precision columns). The columns <structfield>udt_name</structfield>,
2100+
<structfield>udt_schema</structfield>, and <structfield>udt_catalog</structfield>
21012101
always identify the underlying data type of the column, even if the
21022102
column is based on a domain. (Since
21032103
<productname>PostgreSQL</productname> treats built-in types like
@@ -2107,8 +2107,8 @@
21072107
type, because in that case it wouldn't matter if the column is
21082108
really based on a domain. If the column is based on a domain, the
21092109
identity of the domain is stored in the columns
2110-
<literal>domain_name</literal>, <literal>domain_schema</literal>,
2111-
and <literal>domain_catalog</literal>. If you want to pair up
2110+
<structfield>domain_name</structfield>, <structfield>domain_schema</structfield>,
2111+
and <structfield>domain_catalog</structfield>. If you want to pair up
21122112
columns with their associated data types and treat domains as
21132113
separate types, you could write <literal>coalesce(domain_name,
21142114
udt_name)</literal>, etc.
@@ -6376,7 +6376,7 @@ ORDER BY c.ordinal_position;
63766376
the sequence data type (see above). The precision indicates
63776377
the number of significant digits. It can be expressed in
63786378
decimal (base 10) or binary (base 2) terms, as specified in the
6379-
column <literal>numeric_precision_radix</literal>.
6379+
column <structfield>numeric_precision_radix</structfield>.
63806380
</para></entry>
63816381
</row>
63826382

@@ -6386,8 +6386,8 @@ ORDER BY c.ordinal_position;
63866386
</para>
63876387
<para>
63886388
This column indicates in which base the values in the columns
6389-
<literal>numeric_precision</literal> and
6390-
<literal>numeric_scale</literal> are expressed. The value is
6389+
<structfield>numeric_precision</structfield> and
6390+
<structfield>numeric_scale</structfield> are expressed. The value is
63916391
either 2 or 10.
63926392
</para></entry>
63936393
</row>
@@ -6402,7 +6402,7 @@ ORDER BY c.ordinal_position;
64026402
of significant digits to the right of the decimal point. It
64036403
can be expressed in decimal (base 10) or binary (base 2) terms,
64046404
as specified in the column
6405-
<literal>numeric_precision_radix</literal>.
6405+
<structfield>numeric_precision_radix</structfield>.
64066406
</para></entry>
64076407
</row>
64086408

@@ -6461,10 +6461,10 @@ ORDER BY c.ordinal_position;
64616461
</sect1>
64626462

64636463
<sect1 id="infoschema-sql-features">
6464-
<title><literal>sql_features</literal></title>
6464+
<title><structname>sql_features</structname></title>
64656465

64666466
<para>
6467-
The table <literal>sql_features</literal> contains information
6467+
The table <structname>sql_features</structname> contains information
64686468
about which formal features defined in the SQL standard are
64696469
supported by <productname>PostgreSQL</productname>. This is the
64706470
same information that is presented in <xref linkend="features"/>.
@@ -6556,10 +6556,10 @@ ORDER BY c.ordinal_position;
65566556
</sect1>
65576557

65586558
<sect1 id="infoschema-sql-implementation-info">
6559-
<title><literal>sql_implementation_info</literal></title>
6559+
<title><structname>sql_implementation_info</structname></title>
65606560

65616561
<para>
6562-
The table <literal>sql_implementation_info</literal> contains
6562+
The table <structname>sql_implementation_info</structname> contains
65636563
information about various aspects that are left
65646564
implementation-defined by the SQL standard. This information is
65656565
primarily intended for use in the context of the ODBC interface;
@@ -6638,10 +6638,10 @@ ORDER BY c.ordinal_position;
66386638
</sect1>
66396639

66406640
<sect1 id="infoschema-sql-parts">
6641-
<title><literal>sql_parts</literal></title>
6641+
<title><structname>sql_parts</structname></title>
66426642

66436643
<para>
6644-
The table <literal>sql_parts</literal> contains information about
6644+
The table <structname>sql_parts</structname> contains information about
66456645
which of the several parts of the SQL standard are supported by
66466646
<productname>PostgreSQL</productname>.
66476647
</para>
@@ -6714,10 +6714,10 @@ ORDER BY c.ordinal_position;
67146714
</sect1>
67156715

67166716
<sect1 id="infoschema-sql-sizing">
6717-
<title><literal>sql_sizing</literal></title>
6717+
<title><structname>sql_sizing</structname></title>
67186718

67196719
<para>
6720-
The table <literal>sql_sizing</literal> contains information about
6720+
The table <structname>sql_sizing</structname> contains information about
67216721
various size limits and maximum values in
67226722
<productname>PostgreSQL</productname>. This information is
67236723
primarily intended for use in the context of the ODBC interface;
@@ -7843,7 +7843,7 @@ ORDER BY c.ordinal_position;
78437843
in <productname>PostgreSQL</productname>) and distinct types (not
78447844
implemented in <productname>PostgreSQL</productname>). To be
78457845
future-proof, use the
7846-
column <literal>user_defined_type_category</literal> to
7846+
column <structfield>user_defined_type_category</structfield> to
78477847
differentiate between these. Other user-defined types such as base
78487848
types and enums, which are <productname>PostgreSQL</productname>
78497849
extensions, are not shown here. For domains,

‎doc/src/sgml/libpq.sgml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,7 +4508,7 @@ Oid PQftable(const PGresult *res,
45084508
<para>
45094509
<literal>InvalidOid</literal> is returned if the column number is out of range,
45104510
or if the specified column is not a simple reference to a table column.
4511-
You can query the system table <literal>pg_class</literal> to determine
4511+
You can query the system table <structname>pg_class</structname> to determine
45124512
exactly which table is referenced.
45134513
</para>
45144514

@@ -4578,7 +4578,7 @@ Oid PQftype(const PGresult *res,
45784578
</para>
45794579

45804580
<para>
4581-
You can query the system table <literal>pg_type</literal> to
4581+
You can query the system table <structname>pg_type</structname> to
45824582
obtain the names and properties of the various data types. The
45834583
<acronym>OID</acronym>s of the built-in data types are defined
45844584
in the file <filename>catalog/pg_type_d.h</filename>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp