mirror of
https://github.com/postgres/postgres.git
synced 2025-12-15 02:22:24 +03:00
Arrange to give error when a SetOp member statement refers to a variable
of the containing query (which really can only happen in a rule context). Per example from Brandon Craig Rhodes. Also, make the error message more specific for the similar case with sub-select in FROM. The revised coding should be easier to adapt to SQL99's LATERAL(), when we get around to supporting that.
This commit is contained in:
@@ -18,7 +18,6 @@ INSERT INTO foo2 VALUES(1, 111);
|
||||
CREATE FUNCTION foot(int) returns setof foo2 as 'SELECT * FROM foo2 WHERE fooid = $1;' LANGUAGE SQL;
|
||||
-- supposed to fail with ERROR
|
||||
select * from foo2, foot(foo2.fooid) z where foo2.f2 = z.f2;
|
||||
NOTICE: Adding missing FROM-clause entry for table "foo2"
|
||||
ERROR: FROM function expression may not refer to other relations of same query level
|
||||
-- function in subselect
|
||||
select * from foo2 where f2 in (select f2 from foot(foo2.fooid) z where z.fooid = foo2.fooid) ORDER BY 1,2;
|
||||
|
||||
Reference in New Issue
Block a user