Thread: BUG #15936: user defined data type isn't picking default value

BUG #15936: user defined data type isn't picking default value

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      15936
Logged by:          Shiwangini Shishulkar
Email address:      shiwangini.shishulkar@webgility.com
PostgreSQL version: 11.4
Operating system:   CentOS Linux release 7.6.1810 (Core)
Description:

We have created a user defined data type type_currency. Below is the
definition:

-- DROP DOMAIN type_currency;

CREATE DOMAIN type_currency AS numeric
    DEFAULT 0;


However, when we are not any specific value to this column ,it should by
default pick '0'. However, it isn't working in the way/not taking 0 as
default value.


Re: BUG #15936: user defined data type isn't picking default value

From
Sergei Kornilov
Date:
Hello

melkij=> CREATE DOMAIN type_currency AS numeric default 0;
CREATE DOMAIN
melkij=> create table tt ( i int, t type_currency);
CREATE TABLE
melkij=> insert into tt (i) values (1);
INSERT 0 1
melkij=> table tt;
 i | t 
---+---
 1 | 0

Works for me.
Can you provide reproducible testcase?

regards, Sergei