Re: Type conversion

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Type conversion
Дата
Msg-id 1728.961530525@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Type conversion  (Ice Planet <ice@adiemus.sk>)
Список pgsql-sql
Ice Planet <ice@adiemus.sk> writes:
> B: insert into t2 values (select int2(int4(b)) from t1 where a = 1)

Works for me when spelled correctly:

regression=# insert into t2 (select int2(int4(b)) from t1 where a = 1);
INSERT 314647 1

If you make a suitable conversion function then you can omit the
explicit conversion:

regression=# create function int2(int8) returns int2 as
regression-# 'begin return int2(int4($1)); end;' language 'plpgsql';
CREATE
regression=# insert into t2 (select b from t1 where a = 1);
INSERT 314649 1
        regards, tom lane


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

Предыдущее
От: Ice Planet
Дата:
Сообщение: Type conversion
Следующее
От: Ed Loehr
Дата:
Сообщение: Re: Type conversion