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