How to use record variable with non-null domain in plpgsql - Mailing list pgsql-general

From Andrus
Subject How to use record variable with non-null domain in plpgsql
Date
Msg-id 1C63F0F484C94229928C0F65AB19296E@dell2
Whole thread Raw
In response to Re: Converting char to varchar automatically  (Andy Colson <andy@squeakycode.net>)
Responses Re: How to use record variable with non-null domain in plpgsql
List pgsql-general
I'm looging for a way to use tebool type records in plpgsql method starting from Postgres 9.1
I tried code below but got error

domain tebool does not allow null values
Domain tebool default value is false so plpgsql must assing false to it and should not throw error.

How to fix this so that such record variable can created ?

Andrus.

CREATE DOMAIN tebool AS bool DEFAULT false NOT NULL;
create temp table test  ( test tebool ) on commit drop ;

CREATE OR REPLACE FUNCTION test()
       RETURNS numeric AS $$

    DECLARE
    r_test test;
    begin

    return 0;
    end;  $$ language plpgsql;

    select test();

Posted also in

http://stackoverflow.com/questions/32157166/how-to-fix-domain-tebool-does-not-allow-null-values-in-plpgsql-function


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: PostgreSQL Developer Best Practices
Next
From: Tom Lane
Date:
Subject: Re: How to use record variable with non-null domain in plpgsql