Re: BUG #4618: nolock changes first column name of query result set to 'nolock'

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #4618: nolock changes first column name of query result set to 'nolock'
Дата
Msg-id 20090116132051.GA65350@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: BUG #4618: nolock changes first column name of query result set to 'nolock'  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: BUG #4618: nolock changes first column name of query result set to 'nolock'  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Fri, Jan 16, 2009 at 01:22:48PM +0100, Magnus Hagander wrote:
> brian wrote:
> > query1 works fine, first column in table is called movieid1:
> > select * from netflix.ratings where movieid = 1
> >
> > query2 is a bug and should work just fine, but gives error:
> > ERROR:  column "movieid" does not exist
> > LINE 2: select * from netflix.ratings with (nolock) where movieid = ...
>
> I don't know where you got "with (nolock)" from, but that's not
> PostgreSQL syntax - and AFAIK it's not standard SQL at all. Just remove
> it and you should be fine.

"with (nolock)" is a SQL Server-ism for improving performance by
using dirty reads.  Thanks to MVCC, PostgreSQL doesn't need such
nonsense.

The second query created a table alias for netflix.ratings named "with",
whose first column (presumably movieid) is aliased as "nolock".  The
following query probably would have worked (not that I'm recommending
it):

select * from netflix.ratings with (nolock) where nolock = ...

--
Michael Fuhr

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: BUG #4618: nolock changes first column name of query result set to 'nolock'
Следующее
От: "Marshall, Steve"
Дата:
Сообщение: Re: pg_listener entries deleted under heavy NOTIFY load only on Windows