Re: [Firebird-devel] [FB-Tracker] Created: (CORE-5507) Wrong value of the new field at the old records, created before that new field was added.

2017-03-26 Thread Vlad Khorsun
25.03.2017 0:16, Lester Caine wrote:
> On 24/03/17 21:42, Vlad Khorsun wrote:
>> 24.03.2017 21:36, Lester Caine wrote:
>>> On 24/03/17 17:57, Vlad Khorsun wrote:
> What must be done is specified exactly. And we should suppose that in
> all other aspects data stored in database should not be changed -
What data is *stored* ?
>>> For any field, the data that is loaded initially or later modified. And
>>> I REPEAT ... if the field was originally NULL it should remain NULL
>>> until a specific record update modifies it. It should not be returning
>>> some DEFAULT value that was added later UNLESS the constraints are
>>> changed to require the NULL value to be populated, but that should not
>>> be populated 'magically' and the SQL spec does not override that basic
>>> function of a value in an existing record? The DEFAULT value should only
>>> be used to replace a NULL value when a record is added ... full stop.
>
>>Engine substitute default value if and only if NOT NULL field was added
>> and DEFAULT value was specified. Engine not allow to add NOT NULL field
>> without DEFAULT. If NULLable field was added engine will return NULL's
>> for that field at existing old records despite of precence of DEFAULT value.
>>
>>Is it OK ?
>
> That is what I would expect to see ...
> As I stated in SET's reply I would expect to manage the change of a
> default as appropriate, but the fall back should always be the stored
> values? You would only see a 'new' default value if you added it, not if
> you simply changed the metadata?

   If i understand you correctly - fb3 works the way you expect. You may look
at my sample at CORE-5507 to see how it works.

Regards,
Vlad

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] [FB-Tracker] Created: (CORE-5507) Wrong value of the new field at the old records, created before that new field was added.

2017-03-26 Thread Alex Peshkoff
On 03/24/17 20:57, Vlad Khorsun wrote:
> 24.03.2017 19:39, Alex Peshkoff wrote:
>> On 03/24/17 20:26, Vlad Khorsun wrote:
>>> 24.03.2017 17:57, Alex Peshkoff wrote:
 On 03/24/17 17:53, Vlad Khorsun wrote:

>   So far we have no agreement on what is "correct result". Current 
> implementation
> changed well known old behaviour not claiming it as a bug. I'd say it 
> looks like
> a bug itself.
 Vlad, looking at sql2008 (part2, foundation, 11.10 - alter table
 statement) one can read in  that when new column
 is added, and this is base (not generated) column, and this is not
 identity column then every value in this column is it's default value.
 And it's mentioned in  >>> clause> that new default value is stored in column descriptor, but
 nobody mentions that it should be changed for existing records.

 I.e. according to standard old (interbase origined) behavior was a bug
 and current one is correct.
>   >>
>>>  I already show that info from standard but can't make same conclusion.
>>> I see it as not specified.
>> Well, it's also not specified that rand() output should not be placed
>> into a column for which default value was changed :-)
> I consider standard as document which we should read curefully and follow
> strictly. Such documents should be created in a such way to not allow 
> ambiguity
> and describe every possible and not possible conditions. Unfortunately, this 
> is
> not always true.

Yes, it's written by people. When we look at our favorite p.11.11 it's 
clear that action for different types of columns is expressed 
differently. I agree that 'update statement is executed ' and 'every 
value in column is the default value' are different, thay may mean same 
or may not. Regarding correct treatment of them it's better to trust our 
native english-speaking people - minor language differences may be 
important here.



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel