How to use record variable with non-null domain in plpgsql

Поиск
Список
Период
Сортировка
От Andrus
Тема How to use record variable with non-null domain in plpgsql
Дата
Msg-id 1C63F0F484C94229928C0F65AB19296E@dell2
обсуждение исходный текст
Ответ на Re: Converting char to varchar automatically  (Andy Colson <andy@squeakycode.net>)
Ответы Re: How to use record variable with non-null domain in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: PostgreSQL Developer Best Practices
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to use record variable with non-null domain in plpgsql