Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Andrus" <kobruleht2@xxxxxx> writes:
> 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 ?

TBH, the problem here is with the not-null constraint on the domain.
Get rid of that and you'll be much happier.  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?

It's reasonable to assign NOT NULL requirements to individual table
columns, but not to think of it as being a property of a data type.

Or another way to put it: NULL in SQL is a type-independent concept.
Individual data types simply don't get to opt out of that without
creating more problems than they solve.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux