Re: [SQL] null values in non-nullable column

2006-12-19 Thread Richard Huxton
George Pavlov wrote: Even though, as Tom Lane explained, CREATE TABLE AS is not the problem here, it seems to me that might be the cleanest, least obtrusive place to add validation. If C.T.A failed at the table creation step because of the JOIN-produces NULLs that would be an early and decent war

Re: [SQL] null values in non-nullable column

2006-12-19 Thread George Pavlov
Yes, the thread did not seem to go very far. The SQL standard does seem inconsistent in this area, but that is not an argument for allowing data constraint violation. Until the standard is modified I think it would be good for the reputation of the DBMS we all love to come up with a fix... Even t

Re: [SQL] null values in non-nullable column

2006-12-19 Thread Markus Schaber
Hi, George, "George Pavlov" <[EMAIL PROTECTED]> wrote: > In 8.1 I have a situation where nullability of user defined datatypes > does not seem to be enforced. Using the following steps I end up with a > table that has a column that should not be nullable, but has nulls in > it. Ouch. That hurts!

Re: [SQL] null values in non-nullable column

2006-12-04 Thread Michael Glaesemann
On Dec 5, 2006, at 12:49 , Tom Lane wrote: Actually I think this is a bug in the SQL spec :-( The description of says that output columns are "possibly nullable" if they're on the nullable side of the outer join, but it's not apparent that that idea is meant to negate a domain constraint. An

Re: [SQL] null values in non-nullable column

2006-12-04 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > Could you expand on that a bit? Here's what I've interpreted: > The column types of the select are assumed to be (int, > boolean_not_null), and so the values aren't checked again before the > insert during CREATE TABLE AS. "discarding domain-nes

Re: [SQL] null values in non-nullable column

2006-12-04 Thread Michael Glaesemann
On Dec 5, 2006, at 11:52 , Tom Lane wrote: "George Pavlov" <[EMAIL PROTECTED]> writes: -- this creates a table with a not-nullable column (datatype -- inherited from the original table) which contains nulls; Hm. Arguably we should discard domain-ness in any SELECT result, but I'm sure some

Re: [SQL] null values in non-nullable column

2006-12-04 Thread Tom Lane
"George Pavlov" <[EMAIL PROTECTED]> writes: > -- this creates a table with a not-nullable column (datatype > -- inherited from the original table) which contains nulls; Hm. Arguably we should discard domain-ness in any SELECT result, but I'm sure some people would complain about that ...

[SQL] null values in non-nullable column

2006-12-04 Thread George Pavlov
In 8.1 I have a situation where nullability of user defined datatypes does not seem to be enforced. Using the following steps I end up with a table that has a column that should not be nullable, but has nulls in it. Here's a pared down outline of the steps: -- create a datatype that should enforc