Обсуждение: FROM clause in UPDATE

Поиск
Список
Период
Сортировка

FROM clause in UPDATE

От
"Slavisa Garic"
Дата:
Hi all,

Could someone tell me why this doesn't work in PostgreSQL 8.1.3 where it works in v8.0.5 and earlier (i haven't tried versions between these two):

v8.1.3
--------------------------------------------------
-bash-3.00$ psql -c "UPDATE NimrodGridRun
                        SET status = 'active', control = 'start'
                        WHERE status not in ('active', 'jsuspend')
                        AND NimrodGridRun.compute_id = 1
                        AND NimrodGridRun.agent_id = NimrodAgent.agent_id
                        AND NimrodAgent.status = 'active'
                        AND NimrodAgent.tag = '1'"
ERROR:  missing FROM-clause entry for table "nimrodagent"
-bash-3.00$

=================================
v8.0.5
----------------------------------------------
[slavisa: talvath - ~ (0)]: psql -c "UPDATE NimrodGridRun
                        SET status = 'active', control = 'start'
                        WHERE status not in ('active', 'jsuspend')
                        AND NimrodGridRun.compute_id = 1
                        AND NimrodGridRun.agent_id = NimrodAgent.agent_id
                        AND NimrodAgent.status = 'active'
                        AND NimrodAgent.tag = '1'"
UPDATE 0



The first query will work if I insert "FROM nimrodagent" just before the WHERE clause,
Regards,
Slavisa

Re: FROM clause in UPDATE

От
Alan Hodgson
Дата:
On Monday 17 July 2006 09:07, "Slavisa Garic" <sgaric@gmail.com> wrote:
> The first query will work if I insert "FROM nimrodagent" just before the
> WHERE clause,

The default in 8.1 is to require the FROM clause.  I believe there is a
configuration file option to enable the old behaviour.


--
Who are you working for?  The average Canadian family pays 47% of
their total income in taxes.  If you and your spouse both work, one
of you is working for the government and the other is working for
your family.