pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ivan.shib@gmail.com
Subject: BUG #15500: Cannot set NULL to a field with ENUM type
Date: Tue, 13 Nov 2018 14:48:43 +0000
Message-ID: <15500-2ebc24774d08db26@postgresql.org> (raw)

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?



view thread (2+ messages)  latest in thread

Message-ID: <15500-2ebc24774d08db26@postgresql.org>
Permalink:  ../15500-2ebc24774d08db26@postgresql.org/
Also on:    postgresql.org/message-id/15500-2ebc24774d08db26@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, ivan.shib@gmail.com
  Subject: Re: BUG #15500: Cannot set NULL to a field with ENUM type
  In-Reply-To: <15500-2ebc24774d08db26@postgresql.org>
  References: <15500-2ebc24774d08db26@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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