Thank you for your quick response.
This was very helpfull and resolved my problem.
But for me it is a bit counterintuitive that -32768 is not treated as a
negative constant but as a unary operator to a positive constant.
It could be helpfull to remind the user of the nature of negative
On Thu, 2 May 2024 at 23:25, Hans Buschmann wrote:
> postgres=# select -32768::smallint;
> ERROR: smallint out of range
The precedence order of operations applies the cast before the unary
minus operator.
Any of the following will work:
postgres=# select cast(-32768 as smallint),
I tried to initialize a table with values for smallint columns.
The final goal is to get mask values for logical operations.
The insert failed with ERROR: smallint out of range.
the same occurs when using a simple select statement like:
select -32768::smallint;
select -2147483648::int;