pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15500: Cannot set NULL to a field with ENUM type
2+ messages / 2 participants
[nested] [flat]
* BUG #15500: Cannot set NULL to a field with ENUM type
@ 2018-11-13 14:48 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2018-11-13 14:48 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: ivan.shib@gmail.com
The following bug has been logged on the website:
Bug reference: 15500
Logged by: Ivan Shibkikh
Email address: ivan.shib@gmail.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?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15500: Cannot set NULL to a field with ENUM type
@ 2018-11-13 14:56 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Alvaro Herrera @ 2018-11-13 14:56 UTC (permalink / raw)
To: ivan.shib@gmail.com; pgsql-bugs@lists.postgresql.org
On 2018-Nov-13, PG Bug reporting form wrote:
> 3. Insert a new record:
> > INSERT INTO "public"."schedule" ("id", "week_day", "minute", "hour")
> VALUES (DEFAULT, 'NULL', DEFAULT, DEFAULT);
This is not a NULL value -- it's a string that says NULL. Try with
INSERT INTO public.schedule (id, week_day, minute, hour)
VALUES (DEFAULT, NULL, DEFAULT, DEFAULT);
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-11-13 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13 14:48 BUG #15500: Cannot set NULL to a field with ENUM type PG Bug reporting form <noreply@postgresql.org>
2018-11-13 14:56 ` Alvaro Herrera <alvherre@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox