Re: Setting expire date on insert/modify

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Setting expire date on insert/modify
Дата
Msg-id 25891.1138160849@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Setting expire date on insert/modify  ("Foster, Stephen" <stephenlfoster@comcast.net>)
Список pgsql-general
"Foster, Stephen" <stephenlfoster@comcast.net> writes:
> Michael, I tried that line in the trigger procedure with double quotes,
> single quotes and without.  The only way it would save was with single
> quotes and that is why you saw it that way.

Just for reference, the thing that was tripping you up (or one thing
that was tripping you up at least) was trying to extrapolate the syntax

    typename 'literal value'

to situations where you didn't mean an actual literal constant.  This
syntax is something that's forced on us by the SQL standard, but we do
not support it for anything but literal constants (which is all that the
standard defines it for, either).  In the examples you gave, you wanted
to coerce the value of a variable of one type to some other type, and so
you should have written either

    CAST( variablename AS typename )
or
    variablename :: typename

the former being the SQL-spec syntax for a runtime type conversion
and the latter being a traditional Postgres abbreviation.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgxml
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: hardware checks (was Re: invalid memory alloc request