Confusion in section 8.7.3. Type Safety

Started by PG Bug reporting form7 months ago3 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/datatype-enum.html
Description:

In section 8.7.3. Type Safety one can observe a the following statement in
the examples.

INSERT INTO holidays(num_weeks,happiness) VALUES (2, 'sad');

This is somewhat confusing since type happiness doesn't contain 'sad'. I
would suggest to remove the statement or to add an enum 'sad' in type
happiness.

#2David Rowley
dgrowleyml@gmail.com
In reply to: PG Bug reporting form (#1)
Re: Confusion in section 8.7.3. Type Safety

On Tue, 23 Sept 2025 at 20:59, PG Doc comments form
<noreply@postgresql.org> wrote:

Page: https://www.postgresql.org/docs/17/datatype-enum.html
Description:

In section 8.7.3. Type Safety one can observe a the following statement in
the examples.

INSERT INTO holidays(num_weeks,happiness) VALUES (2, 'sad');

This is somewhat confusing since type happiness doesn't contain 'sad'. I
would suggest to remove the statement or to add an enum 'sad' in type
happiness.

Thank you for the report. I think you might have missed that this
section is demonstrating that the statement does not work due to the
column's type not containing an enum value for 'sad' and that enum
values are specific to the particular enum, rather than global to all
enum types, as one *could* have assumed.

Your proposed modification would make the bogus INSERT statement work,
which would defeat the purpose of the section demonstrating that it
doesn't work.

David

#3Dejan Spasic
dejan.spasic@bitweise.biz
In reply to: David Rowley (#2)
Re: Confusion in section 8.7.3. Type Safety

Yes, you are right. Thanks for the fast feedback.

BitWeise
Erkrather Straße 304
D-40231 Düsseldorf
Tel.: +49.151 2915 88 99
E-Mail: dejan.spasic@bitweise.biz
WWW: http://www.bitweise.biz

On Tue, Sep 23, 2025, 1:14 PM David Rowley <dgrowleyml@gmail.com> wrote:

Show quoted text

On Tue, 23 Sept 2025 at 20:59, PG Doc comments form
<noreply@postgresql.org> wrote:

Page: https://www.postgresql.org/docs/17/datatype-enum.html
Description:

In section 8.7.3. Type Safety one can observe a the following statement

in

the examples.

INSERT INTO holidays(num_weeks,happiness) VALUES (2, 'sad');

This is somewhat confusing since type happiness doesn't contain 'sad'. I
would suggest to remove the statement or to add an enum 'sad' in type
happiness.

Thank you for the report. I think you might have missed that this
section is demonstrating that the statement does not work due to the
column's type not containing an enum value for 'sad' and that enum
values are specific to the particular enum, rather than global to all
enum types, as one *could* have assumed.

Your proposed modification would make the bogus INSERT statement work,
which would defeat the purpose of the section demonstrating that it
doesn't work.

David