By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

Parsing bug?

P: n/a
In the following query the field 'memid' is varchar(8).

Is the error message below a bug?

select substr(memid,1,1) as memtp, substr(memid,2,4) as newx
from memmast group by memtp, newx

ERROR: column "memmast.memid" must appear in the GROUP BY clause or be used in
an aggregate function
--
Mike Nolan
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Mike Nolan <no***@gw.tssi.com> writes:
Is the error message below a bug? select substr(memid,1,1) as memtp, substr(memid,2,4) as newx
from memmast group by memtp, newx ERROR: column "memmast.memid" must appear in the GROUP BY clause or be used in
an aggregate function


Works for me in every branch back to 7.1 ... what version are you using?

regression=# create table memmast (memid varchar(8));
CREATE
regression=# select substr(memid,1,1) as memtp, substr(memid,2,4) as newx, count(*) from memmast group by memtp, newx;
memtp | newx | count
-------+------+-------
(0 rows)
regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #2

P: n/a
> Works for me in every branch back to 7.1 ... what version are you using?

7.4.1, but I figured out what I did wrong. The alias for the first
column turns out to be the same as the name of another column in the table.
--
Mike Nolan
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.