BUG #15500: Cannot set NULL to a field with ENUM type

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: ivan(dot)shib(at)gmail(dot)com
Subject: BUG #15500: Cannot set NULL to a field with ENUM type
Date: 2018-11-13 14:48:43
Message-ID: 15500-2ebc24774d08db26@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15500
Logged by: Ivan Shibkikh
Email address: ivan(dot)shib(at)gmail(dot)com
PostgreSQL version: 11.1
Operating system: Alpine Linux
Description:

1. Created a new type:
> create type day_of_week as enum ('Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday', 'Friday', 'Saturday');

2. Created a new table:
> CREATE TABLE public.schedule
(
id SERIAL PRIMARY KEY NOT NULL,
week_day day_of_week DEFAULT NULL,
minute integer DEFAULT 0,
hour integer DEFAULT 0
);

3. Insert a new record:
> INSERT INTO "public"."schedule" ("id", "week_day", "minute", "hour")
VALUES (DEFAULT, 'NULL', DEFAULT, DEFAULT);

Result:
[42804] ERROR: column "week_day" is of type day_of_week but expression is of
type character varying
Hint: You will need to rewrite or cast the expression.
Position: 87

Why I cannot set NULL to ENUM field?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-13 14:56:37 Re: BUG #15500: Cannot set NULL to a field with ENUM type
Previous Message Peter Eisentraut 2018-11-13 12:52:50 Re: Usage of pg_waldump