Skip to content

Commit e0e08d3

Browse files
committed
<example> is a floating element, so it's use is inappropriate when the
surrounding text refers to the example inline.
1 parent 65559c3 commit e0e08d3

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.250.2.4 2010/07/29 19:34:36 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.250.2.5 2010/08/10 20:41:28 petere Exp $ -->
22

33
<chapter id="datatype">
44
<title>Data Types</title>
@@ -2869,10 +2869,6 @@ CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
28692869

28702870
Once created, the enum type can be used in table and function
28712871
definitions much like any other type:
2872-
</para>
2873-
2874-
<example>
2875-
<title>Basic Enum Usage</title>
28762872
<programlisting>
28772873
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
28782874
CREATE TABLE person (
@@ -2886,7 +2882,7 @@ SELECT * FROM person WHERE current_mood = 'happy';
28862882
Moe | happy
28872883
(1 row)
28882884
</programlisting>
2889-
</example>
2885+
</para>
28902886
</sect2>
28912887

28922888
<sect2>
@@ -2897,10 +2893,7 @@ SELECT * FROM person WHERE current_mood = 'happy';
28972893
order in which the values were listed when the type was created.
28982894
All standard comparison operators and related
28992895
aggregate functions are supported for enums. For example:
2900-
</para>
2901-
2902-
<example>
2903-
<title>Enum Ordering</title>
2896+
29042897
<programlisting>
29052898
INSERT INTO person VALUES ('Larry', 'sad');
29062899
INSERT INTO person VALUES ('Curly', 'ok');
@@ -2926,19 +2919,16 @@ WHERE current_mood = (SELECT MIN(current_mood) FROM person);
29262919
Larry
29272920
(1 row)
29282921
</programlisting>
2929-
</example>
2922+
</para>
29302923
</sect2>
29312924

29322925
<sect2>
29332926
<title>Type Safety</title>
29342927

29352928
<para>
29362929
Each enumerated data type is separate and cannot
2937-
be compared with other enumerated types.
2938-
</para>
2930+
be compared with other enumerated types. See this example:
29392931

2940-
<example>
2941-
<title>Lack of Casting</title>
29422932
<programlisting>
29432933
CREATE TYPE happiness AS ENUM ('happy', 'very happy', 'ecstatic');
29442934
CREATE TABLE holidays (
@@ -2954,15 +2944,12 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
29542944
WHERE person.current_mood = holidays.happiness;
29552945
ERROR: operator does not exist: mood = happiness
29562946
</programlisting>
2957-
</example>
2947+
</para>
29582948

29592949
<para>
29602950
If you really need to do something like that, you can either
29612951
write a custom operator or add explicit casts to your query:
2962-
</para>
29632952

2964-
<example>
2965-
<title>Comparing Different Enums by Casting to Text</title>
29662953
<programlisting>
29672954
SELECT person.name, holidays.num_weeks FROM person, holidays
29682955
WHERE person.current_mood::text = holidays.happiness::text;
@@ -2972,7 +2959,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
29722959
(1 row)
29732960

29742961
</programlisting>
2975-
</example>
2962+
</para>
29762963
</sect2>
29772964

29782965
<sect2>

0 commit comments

Comments
 (0)