From: | "Andrus" <kobruleht2(at)hot(dot)ee> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to use record variable with non-null domain in plpgsql |
Date: | 2015-08-22 17:57:07 |
Message-ID: | 4615C04672CE45D4971088CC35984D04@dell2 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
>TBH, the problem here is with the not-null constraint on the domain.
>Get rid of that and you'll be much happier.
Is the only reasonable way is to change domain using
ALTER DOMAIN tebool DROP NOT NULL ?
bool types of columns are never used in database. Instead of them tebool type is alway used.
There are alrge number of tebool columns in database. In different installations there may be additional tebool columns
not know at design time.
Will everything work after such change ?
How to disable null values in tebool columns then ?
Should script created which loops over all tebool columns in all tables and adds not null constraint to them ?
Or is there some better solution ?
> Data types that try to
>insist on not being NULL are fundamentally incompatible with SQL
>semantics --- to take one example, what do you think will happen
>to a column of such a type when it's on the outside of a LEFT JOIN?
I tried:
create temp table test ( test tebool, test2 numeric ) on commit drop ;
create temp table test1 ( test tebool, test2 numeric ) on commit drop ;
insert into test values (false,1);
select test1.test from test left join test1 on false;
query returns null value.
I also tried to cast result to tebool
select test1.test::tebool from test left join test1 on false;
and
select null::ebool
This returns also null. So Postgres allows null values in this type instance.
There are no problems.
Andrus.
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2015-08-22 19:40:27 | Re: PostgreSQL Developer Best Practices |
Previous Message | Igor Sosa Mayor | 2015-08-22 17:16:17 | Re: Problem with pl/python procedure connecting to the internet |