Before the discussion is put in the freezer, I think the actual
behavior is not consistent. If ALTERing the field formula allow me to
reference fields positioned after the calculated one, the extracted
metadata should work too.

If it is too much difficult to fix this behavior, I would suggest to
make the ALTER fail too, to avoid bad surprises when metadata is
extracted and run, bringing more consistency between the two operations.

[]s
Carlos
http://www.firebirdnews.org
FireBase - http://www.FireBase.com.br

AP>  On 09/15/12 21:22, Adriano dos Santos Fernandes wrote:
>> On 15-09-2012 14:02, Carlos H. Cantu wrote:
>>> Example:
>>>
>>> create table a (
>>>  field1 computed by (field2 * 0.5),
>>>  field2 numeric (9,2)
>>> );
>>>
>>> returns:
>>>
>>> Column does not belong to referenced table.
>>> Dynamic SQL Error.
>>> SQL error code = -206.
>>> Column unknown.
>>> FIELD2.
>>> At line 2, column 22.
>>>
>>> BUT
>>>
>>> create table a (
>>>  field2 numeric (9,2),
>>>  field1 computed by (field2 * 0.5)
>>> );
>>>
>>> Works fine.
>>>
>> Ideally (but DDL and ideally has a great distance) it should work.
>>
>> I consider that all DDL validations should be done as "After this
>> command is executed, will the database state be valid?"

AP> Mentioned trick might be done using gdef. But one had to explicitly
AP> provide order of fields in relation, something like:

AP> define relation
AP> TRANSMSGS                                                        

AP>     FAC_CODE    position
AP> 2,                                                               

AP>     NUMBER  position
AP> 3,                                                               

AP>     CODE computed by (fac_code * 10000 + number)    position 1;

AP> I do not suggest to add explicit position to DDL - just curious. And yes
AP> - it will be nice to fix DDL to make it perform validations after all
AP> command is parsed, not for each field.


AP> 
------------------------------------------------------------------------------
AP> Live Security Virtual Conference
AP> Exclusive live event will cover all the ways today's security and 
AP> threat landscape has changed and how IT managers can respond. Discussions
AP> will include endpoint security, mobile security and the latest in malware
AP> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
AP> Firebird-Devel mailing list, web interface at
AP> https://lists.sourceforge.net/lists/listinfo/firebird-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to