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

Commit6d5afc2

Browse files
committed
<example> is a floating element, so it's use is inappropriate when the
surrounding text refers to the example inline.
1 parent20bf5e0 commit6d5afc2

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.255 2010/07/29 19:34:40 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.256 2010/08/10 20:41:27 petere Exp $ -->
22

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

28782878
Once created, the enum type can be used in table and function
28792879
definitions much like any other type:
2880-
</para>
2881-
2882-
<example>
2883-
<title>Basic Enum Usage</title>
28842880
<programlisting>
28852881
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
28862882
CREATE TABLE person (
@@ -2894,7 +2890,7 @@ SELECT * FROM person WHERE current_mood = 'happy';
28942890
Moe | happy
28952891
(1 row)
28962892
</programlisting>
2897-
</example>
2893+
</para>
28982894
</sect2>
28992895

29002896
<sect2>
@@ -2905,10 +2901,7 @@ SELECT * FROM person WHERE current_mood = 'happy';
29052901
order in which the values were listed when the type was created.
29062902
All standard comparison operators and related
29072903
aggregate functions are supported for enums. For example:
2908-
</para>
2909-
2910-
<example>
2911-
<title>Enum Ordering</title>
2904+
29122905
<programlisting>
29132906
INSERT INTO person VALUES ('Larry', 'sad');
29142907
INSERT INTO person VALUES ('Curly', 'ok');
@@ -2934,19 +2927,16 @@ WHERE current_mood = (SELECT MIN(current_mood) FROM person);
29342927
Larry
29352928
(1 row)
29362929
</programlisting>
2937-
</example>
2930+
</para>
29382931
</sect2>
29392932

29402933
<sect2>
29412934
<title>Type Safety</title>
29422935

29432936
<para>
29442937
Each enumerated data type is separate and cannot
2945-
be compared with other enumerated types.
2946-
</para>
2938+
be compared with other enumerated types. See this example:
29472939

2948-
<example>
2949-
<title>Lack of Casting</title>
29502940
<programlisting>
29512941
CREATE TYPE happiness AS ENUM ('happy', 'very happy', 'ecstatic');
29522942
CREATE TABLE holidays (
@@ -2962,15 +2952,12 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
29622952
WHERE person.current_mood = holidays.happiness;
29632953
ERROR: operator does not exist: mood = happiness
29642954
</programlisting>
2965-
</example>
2955+
</para>
29662956

29672957
<para>
29682958
If you really need to do something like that, you can either
29692959
write a custom operator or add explicit casts to your query:
2970-
</para>
29712960

2972-
<example>
2973-
<title>Comparing Different Enums by Casting to Text</title>
29742961
<programlisting>
29752962
SELECT person.name, holidays.num_weeks FROM person, holidays
29762963
WHERE person.current_mood::text = holidays.happiness::text;
@@ -2980,7 +2967,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
29802967
(1 row)
29812968

29822969
</programlisting>
2983-
</example>
2970+
</para>
29842971
</sect2>
29852972

29862973
<sect2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp