Insert SHRT_MIN fails for int2 column

Поиск
Список
Период
Сортировка
От Kelly Burkhart
Тема Insert SHRT_MIN fails for int2 column
Дата
Msg-id 1110212157.3206.10.camel@krb06
обсуждение исходный текст
Ответы Re: Insert SHRT_MIN fails for int2 column
Список pgsql-odbc
When inserting SHRT_MIN into an int2 column, the odbc driver comes up
with the following SQL:

insert into dbc_test ( i16 ) values ( -32768::int2    );

This fails with an out of range error, and should be either:

insert into dbc_test ( i16 ) values ( (-32768)::int2    );

Or have the ::int2 cast removed altogether.

The ::int2 cast is added in convert.c on line 3024 (for 08.00.0005)
preceded by a comment stating it is necessary:

    /* needs cast because there is no automatic downcast from
        int4 constants */
    CVT_APPEND_STR(qb, "::int2");

Is this really necessary?  On my 7.4.2 database, the following works
just fine:

create table tst ( i16 int2 );
insert into tst ( i16 ) values ( -32768 );
insert into tst ( i16 ) values ( 32767 );


-Kelly

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Max Cohan
Дата:
Сообщение: Error with latest release under .NET
Следующее
От: jross@wykids.org
Дата:
Сообщение: Re: Installation problem with psqlodbc-08_00_0100.zip