"Richard Huxton" <dev(at)archonet(dot)com> writes:
> [follow-up message said Matteo was interested in plpgsql]
> Still seems OK.
I think a more relevant question is "what version are you running?"
IIRC, LIMIT only works in a top-level SELECT before 7.1.
regards, tom lane