Re: list blocking queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scot Kreienkamp <SKreien(at)la-z-boy(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: list blocking queries
Date: 2012-01-31 21:43:03
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Scot Kreienkamp <SKreien(at)la-z-boy(dot)com> writes:
> There's something wrong with the query that I've written based on what you gave me.

It looks like you forgot the ON condition for the next-to-last JOIN,
so the parser is still expecting another ON when it runs into the WHERE.

Personally I think this sort of FROM construction is pretty bad style
anyway, because it takes an eagle eye to see which ON goes with which
JOIN, and even worse it's very easy to get them connected up wrongly.
You'd be a lot better off with explicit parentheses, viz

(pg_catalog.pg_locks bl join pg_catalog.pg_stat_activity a on = a.procpid)
(pg_catalog.pg_locks kl join pg_catalog.pg_stat_activity ka on = ka.procpid)
on the-long-on-condition-goes-here

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Mamin 2012-01-31 21:49:34 Re: normalizing & join to table function
Previous Message xavieremv 2012-01-31 21:41:01 Re: INSERT with RETURNING clause inside SQL function