Re: [Firebird-devel] [FB3] result type of negate operation

2021-10-11 Thread Mark Rotteveel
On 11-10-2021 07:43, Kovalenko Dmitry wrote:   The question is whether result of negation should keep the type of source or can it be expanded if needed. Then it would need to expand for all types. And what would be an -INT128? Result type must be same as result of expression

Re: [Firebird-devel] [FB3] result type of negate operation

2021-10-10 Thread Kovalenko Dmitry
>>>   The question is whether result of negation should keep the type of >>> source or can it be expanded if needed. >>Then it would need to expand for all types. >And what would be an -INT128? Result type must be same as result of expression "0-source"? Note that in Dialect 1: 0-smallint ->

Re: [Firebird-devel] [FB3] result type of negate operation

2021-10-10 Thread Adriano dos Santos Fernandes
On 10/10/2021 13:11, Dimitry Sibiryakov wrote: > Mark Rotteveel wrote 10.10.2021 18:08: >> Yes, this is normal. The range of a smallint is from -32768 to 32767, >> so you can't negate -32768 as it will overflow back to -32768, hence >> it will raise the integer overflow error. > >   The question

Re: [Firebird-devel] [FB3] result type of negate operation

2021-10-10 Thread Dimitry Sibiryakov
Mark Rotteveel wrote 10.10.2021 18:08: Yes, this is normal. The range of a smallint is from -32768 to 32767, so you can't negate -32768 as it will overflow back to -32768, hence it will raise the integer overflow error. The question is whether result of negation should keep the type of

Re: [Firebird-devel] [FB3] result type of negate operation

2021-10-10 Thread Mark Rotteveel
On 09-10-2021 21:26, Kovalenko Dmitry wrote: Hello, FB3.0.8.22506 (Dialect 3) Firebird defines a follow result types for Negate operation: -SMALLINT_COLUMN has result type SMALLINT -INTEGER_COLUMN has result type INTEGER As result, I see a work like this: SQL> create table TTT2

[Firebird-devel] [FB3] result type of negate operation

2021-10-09 Thread Kovalenko Dmitry
Hello, FB3.0.8.22506 (Dialect 3) Firebird defines a follow result types for Negate operation: -SMALLINT_COLUMN has result type SMALLINT -INTEGER_COLUMN has result type INTEGER As result, I see a work like this: SQL> create table TTT2 (COL_SMALLINT SMALLINT); SQL> insert into