Re: Problem with records that disappear.

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Problem with records that disappear.
Дата
Msg-id 50F3D2D2.8010009@hogranch.com
обсуждение исходный текст
Ответ на Re: Problem with records that disappear.  (Condor <condor@stz-bg.com>)
Ответы Re: Problem with records that disappear.  (Condor <condor@stz-bg.com>)
Список pgsql-general
On 1/14/2013 1:34 AM, Condor wrote:
> It's a standalone statements without BEGIN TRANSACTION. An update is
> easy to explain with another
> but insert with missing row and there is no DELETE command in whole
> code and no one other have access to server.
> No any error logs, only access log system insert that user make the
> changes (no info what changes).


as I see it, that INSERT can't ever happen.  if AID is NULL, then the
first IF AID > 0 will be FALSE, so the 2nd IF AID IS NULL will never get
evaluated.   the two UPDATE's up front will not happen either if AID is
null.

and, what is SET X=X about?!?   thats a big noop anyways.

is this 'redacted' code that's been sanitized?   the more I look at it,
the more I'm cringing.   WHERE x=x on that SELECT INTO ids will return
the whole table, since X = X is always true unless X is NULL.


> BEGIN
>   UPDATE table SET X = X where id = aid;
>   UPDATE table_2 SET Y=Y where id = aid;
>   IF aid > 0 THEN
>     SELECT INTO ids id FROM table_3 WHERE x = x;
>     IF aid IS NULL THEN
>       INSERT INTO table_3 (id) VALUES (x);
>     ELSE
>       UPDATE table_3 SET id = id + 1 WHERE x = X;
>     END IF;
>   END IF;
>   RETURN 200;
> END;






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

Предыдущее
От: Condor
Дата:
Сообщение: Re: Problem with records that disappear.
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Linux Distribution Preferences?