"Paul" <[email protected]> wrote: > update cart set status = 1 where userid = (select userid from > users where email = '[email protected]'); > > As you can see, the subquery is broken (users table doesn't have > the column userid). By standard, if the identifier isn't defined within the most local scope, each enclosing scope, from the inside out, will be checked. I would expect the above to update each row where cart.userid was not null. I always use and recommend aliases where practical. If you wrote it this way, such a mistake would be clearly identified: update cart set status = 1 where userid = (select u.userid from users u where u.email = '[email protected]'); Not a bug. -Kevin
-- Sent via pgsql-bugs mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
