Re: Ambiguous error message

From: Bertrand Petit <pgsql-sql(at)phoe(dot)frmug(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Ambiguous error message
Date: 2004-01-03 01:30:34
Message-ID: 20040103023034.A5150@memo.frmug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Jan 02, 2004 at 05:49:46PM +0100, Samuel Tardieu wrote:
>
> select texten, total
> from (select protocolid, count(*) as total) from ips where catid=1
^
+--- There
> group by protocolid order by protocolid) as c
> inner join protocols using (protocolid);
>
> gives the error message:
>
> ERROR: subquery in FROM must have an alias
> HINT: For example, FROM (SELECT ...) [AS] foo.
>
> Why isn't the "as c" considered as an alias?

That's maybe due to the highlighted spurious parenthesis.

--
%!PS
297.6 420.9 translate 90 rotate 0 setgray gsave 0 1 1{pop 0 180 moveto 100
180 170 100 170 -10 curveto 180 -9 180 -9 190 -10 curveto 190 100 100 180
0 180 curveto fill 180 rotate}for grestore/Bookman-LightItalic findfont
240 scalefont setfont -151.536392 -63.7998886 moveto (bp)show showpage

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2004-01-03 02:40:24 Re: sort by on two columns
Previous Message Andy Lewis 2004-01-03 01:15:49 sort by on two columns