From: | "Gene Sokolov" <hook(at)aktrad(dot)ru> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Curiously confused query parser. |
Date: | 1999-11-19 15:16:26 |
Message-ID: | 181801bf32a1$0cfd6600$0d8cdac3@aktrad.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.6.0 on i386-unknown-freebsd3.2, compiled by gcc 2.7.2.1]
(a side note - wouldn't it be helpful to have a little more info about the
build, namely its time stamp and/or the CVS time stamp)
test=> \d ord
Table = ord
+----------------------------------+----------------------------------+-----
--+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-----
--+
| id | int4 |
4 |
| pos | int4 |
4 |
| tp | int4 |
4 |
+----------------------------------+----------------------------------+-----
--+
test=> select * from ord;
id|pos|tp
--+---+--
1| 1| 1
2| 2| 1
3| 3| 2
4| 1| 2
5| 3| 1
(5 rows)
This query is fine:
test=> select o1.id from ord as o1, ord as o2 where o1.pos>2 and o2.pos<2
test-> and o1.tp=o2.tp;
id
--
5
3
(2 rows)
And this one is invalid:
test=> select o1.id from ord as o1, ord as o2 where o1.pos>2 and o2.pos<2
test-> and o1.tp=o2.tp and ord.id>3;
id
--
5
5
3
3
(4 rows)
This query should probably fail instead of returning an invalid result. MS
SQL 6.5 does just that:
Msg 107, Level 16, State 3
The column prefix 'ord' does not match with a table name or alias name used
in the query.
Gene Sokolov
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Lockhart | 1999-11-19 15:24:52 | Re: [HACKERS] pg_dump bug |
Previous Message | Tom Lane | 1999-11-19 15:07:44 | Re: [HACKERS] pg_dump bug |