Re: Verifying a timestamp is null or in the past

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Verifying a timestamp is null or in the past
Дата
Msg-id CAADeyWj5V=5SGNy0ZUhmcPpYx5zWcigYMbH_Z9o6_xYH6kkhVQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Verifying a timestamp is null or in the past  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: Verifying a timestamp is null or in the past  (Raymond O'Donnell <rod@iol.ie>)
Список pgsql-general
Hello Ray and others,

On Sat, Dec 31, 2011 at 10:26 AM, Raymond O'Donnell <rod@iol.ie> wrote:
>> # select pref_move_week('DE16290', 'DE1');
>> ERROR:  query has no destination for result data
>> HINT:  If you want to discard the results of a SELECT, use PERFORM instead.
>> CONTEXT:  PL/pgSQL function "pref_move_week" line 3 at SQL statement
>>
>> #  create or replace function pref_move_week(_from varchar,
>>         _to varchar) returns void as $BODY$
>>             begin
>>
>>             select 1 from pref_users
>>                 where id=_from and
>>                 vip is not NULL and
>>                 vip > current_timestamp + interval '1 week';
>
> As the error message says, if you don't need the result of the SELECT
> then do PERFORM instead:
>
>  perform 1 from pref_users...
>

I've tried that of course, but "perform 1 ..." fails with 8.4.9:


# select 1 from pref_users
where id='DE1' and
vip is not NULL and
vip > current_timestamp + interval '1 week';
 ?column?
----------
        1
(1 row)

# perform 1 from pref_users
where id='DE1' and
vip is not NULL and
vip > current_timestamp + interval '1 week';
ERROR:  syntax error at or near "perform"
LINE 1: perform 1 from pref_users
        ^

And also - does PERFORM works with FOUND?

Thank you
Alex

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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Streaming replication failover
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Verifying a timestamp is null or in the past