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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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

Bug reference:      15936
Logged by:          Shiwangini Shishulkar
Email address:      [hidden email]
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.

Reply | Threaded
Open this post in threaded view
|

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

Sergei Kornilov
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