postgresql/doc/src/sgml/ref
Tom Lane 5ebaaa4944 Implement SQL-standard LATERAL subqueries.
This patch implements the standard syntax of LATERAL attached to a
sub-SELECT in FROM, and also allows LATERAL attached to a function in FROM,
since set-returning function calls are expected to be one of the principal
use-cases.

The main change here is a rewrite of the mechanism for keeping track of
which relations are visible for column references while the FROM clause is
being scanned.  The parser "namespace" lists are no longer lists of bare
RTEs, but are lists of ParseNamespaceItem structs, which carry an RTE
pointer as well as some visibility-controlling flags.  Aside from
supporting LATERAL correctly, this lets us get rid of the ancient hacks
that required rechecking subqueries and JOIN/ON and function-in-FROM
expressions for invalid references after they were initially parsed.
Invalid column references are now always correctly detected on sight.

In passing, remove assorted parser error checks that are now dead code by
virtue of our having gotten rid of add_missing_from, as well as some
comments that are obsolete for the same reason.  (It was mainly
add_missing_from that caused so much fudging here in the first place.)

The planner support for this feature is very minimal, and will be improved
in future patches.  It works well enough for testing purposes, though.

catversion bump forced due to new field in RangeTblEntry.
2012-08-07 19:02:54 -04:00
..
abort.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
allfiles.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
alter_aggregate.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
alter_collation.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_conversion.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_database.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_default_privileges.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
alter_domain.sgml Add support for renaming domain constraints 2012-04-03 08:11:51 +03:00
alter_event_trigger.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
alter_extension.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
alter_foreign_data_wrapper.sgml Add ALTER FOREIGN DATA WRAPPER / RENAME and ALTER SERVER / RENAME 2011-12-09 20:42:30 +02:00
alter_foreign_table.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
alter_function.sgml Make CREATE/ALTER FUNCTION support NOT LEAKPROOF. 2012-02-15 10:45:08 -05:00
alter_group.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_index.sgml ALTER <thing> [IF EXISTS] ... allows silent DDL if required, 2012-01-23 23:25:04 +00:00
alter_language.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
alter_large_object.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
alter_opclass.sgml Add more ALTER <object> .. SET SCHEMA commands. 2010-11-26 17:31:54 -05:00
alter_operator.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_opfamily.sgml Add SP-GiST (space-partitioned GiST) index access method. 2011-12-17 16:42:30 -05:00
alter_role.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_schema.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
alter_sequence.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
alter_server.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
alter_table.sgml Change syntax of new CHECK NO INHERIT constraints 2012-07-24 16:01:32 -04:00
alter_tablespace.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_trigger.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
alter_tsconfig.sgml Add more ALTER <object> .. SET SCHEMA commands. 2010-11-26 17:31:54 -05:00
alter_tsdictionary.sgml Add more ALTER <object> .. SET SCHEMA commands. 2010-11-26 17:31:54 -05:00
alter_tsparser.sgml Add more ALTER <object> .. SET SCHEMA commands. 2010-11-26 17:31:54 -05:00
alter_tstemplate.sgml Add more ALTER <object> .. SET SCHEMA commands. 2010-11-26 17:31:54 -05:00
alter_type.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
alter_user_mapping.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
alter_user.sgml Add REPLICATION privilege for ROLEs 2010-12-29 11:05:03 +01:00
alter_view.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
analyze.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
begin.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
checkpoint.sgml Make the CHECKPOINT reference page more clear. 2011-10-18 20:14:51 -04:00
close.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
cluster.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
clusterdb.sgml doc: Fix for too many brackets in command synopses on man pages 2012-05-03 22:58:00 +03:00
comment.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
commit_prepared.sgml Add compatibility information for prepared transaction commands 2012-04-16 22:40:54 +03:00
commit.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
copy.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_aggregate.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
create_cast.sgml Casts to or from a domain type are ignored; warn and document. 2012-04-24 09:20:53 -04:00
create_collation.sgml Make a code-cleanup pass over the collations patch. 2011-04-22 17:43:18 -04:00
create_conversion.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_database.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_domain.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
create_event_trigger.sgml Make new event trigger facility actually do something. 2012-07-20 11:39:01 -04:00
create_extension.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_foreign_data_wrapper.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_foreign_table.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
create_function.sgml Make CREATE/ALTER FUNCTION support NOT LEAKPROOF. 2012-02-15 10:45:08 -05:00
create_group.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_index.sgml Reword documentation for concurrent index rebuilds to be clearer. 2012-08-04 10:35:47 -04:00
create_language.sgml Remove ancient downcasing code from procedural language operations. 2011-11-17 14:25:18 -05:00
create_opclass.sgml Add SP-GiST (space-partitioned GiST) index access method. 2011-12-17 16:42:30 -05:00
create_operator.sgml Add support for privileges on types 2011-12-20 00:05:19 +02:00
create_opfamily.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_role.sgml Make superuser imply replication privilege. The idea of a privilege that 2012-01-14 18:22:16 +02:00
create_rule.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_schema.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_sequence.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_server.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_table_as.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_table.sgml Change syntax of new CHECK NO INHERIT constraints 2012-07-24 16:01:32 -04:00
create_tablespace.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_trigger.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
create_tsconfig.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_tsdictionary.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_tsparser.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_tstemplate.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
create_type.sgml Reworded sentence as suggested by Stephen Frost. 2012-05-19 14:44:56 +02:00
create_user_mapping.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
create_user.sgml Add REPLICATION privilege for ROLEs 2010-12-29 11:05:03 +01:00
create_view.sgml Typo fixes. 2011-12-22 17:57:17 -05:00
createdb.sgml doc: Fix for too many brackets in command synopses on man pages 2012-05-03 22:58:00 +03:00
createlang.sgml doc: Fix for too many brackets in command synopses on man pages 2012-05-03 22:58:00 +03:00
createuser.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
deallocate.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
declare.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
delete.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
discard.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
do.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_aggregate.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_cast.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_collation.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_conversion.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_database.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_domain.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_event_trigger.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
drop_extension.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_foreign_data_wrapper.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_foreign_table.sgml Remove whitespace from end of lines 2011-08-07 16:11:55 +03:00
drop_function.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_group.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
drop_index.sgml Add DROP INDEX CONCURRENTLY [IF EXISTS], uses ShareUpdateExclusiveLock 2012-04-06 10:21:40 +01:00
drop_language.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_opclass.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_operator.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_opfamily.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_owned.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
drop_role.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_rule.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_schema.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_sequence.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_server.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_table.sgml Improve doc wording of drop table permission. 2011-10-15 10:08:02 -04:00
drop_tablespace.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_trigger.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
drop_tsconfig.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_tsdictionary.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_tsparser.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_tstemplate.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
drop_type.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_user_mapping.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
drop_user.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
drop_view.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
dropdb.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
droplang.sgml doc: Fix for too many brackets in command synopses on man pages 2012-05-03 22:58:00 +03:00
dropuser.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
ecpg-ref.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
end.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
execute.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
explain.sgml Make EXPLAIN (BUFFERS) track blocks dirtied, as well as those written. 2012-02-22 20:33:05 -05:00
fetch.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
grant.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
initdb.sgml Add fsync capability to initdb, and use sync_file_range() if available. 2012-07-13 17:16:58 -04:00
insert.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
listen.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
load.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
lock.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
move.sgml Duplicate expansion of "direction" from FETCH's synopsis into MOVE 2011-04-04 12:04:43 -04:00
notify.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
pg_basebackup.sgml pg_basebackup: stylistic adjustments 2012-07-31 11:02:39 -04:00
pg_config-ref.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
pg_controldata.sgml Some reference page improvements 2012-05-20 01:15:55 +03:00
pg_ctl-ref.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
pg_dump.sgml Rewrite --section option to decouple it from --schema-only/--data-only. 2012-05-29 23:22:14 -04:00
pg_dumpall.sgml Put options in some sensible order 2011-05-25 21:53:26 +03:00
pg_receivexlog.sgml pg_basebackup: stylistic adjustments 2012-07-31 11:02:39 -04:00
pg_resetxlog.sgml Fix pg_upgrade, broken by the xlogid/segno -> 64-bit int refactoring. 2012-06-26 07:49:02 +03:00
pg_restore.sgml Rewrite --section option to decouple it from --schema-only/--data-only. 2012-05-29 23:22:14 -04:00
postgres-ref.sgml Make documentation of --help and --version options more consistent 2012-06-18 02:46:59 +03:00
postmaster.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
prepare_transaction.sgml Add compatibility information for prepared transaction commands 2012-04-16 22:40:54 +03:00
prepare.sgml Redesign the plancache mechanism for more flexibility and efficiency. 2011-09-16 00:43:52 -04:00
psql-ref.sgml Document that, for psql -c, only the result of the last command is 2012-08-03 14:02:22 -04:00
reassign_owned.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
reindex.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
reindexdb.sgml Fix reindexdb manual page to say --maintenance-db controls what is 2012-05-22 17:31:46 -04:00
release_savepoint.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
reset.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
revoke.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
rollback_prepared.sgml Add compatibility information for prepared transaction commands 2012-04-16 22:40:54 +03:00
rollback_to.sgml Some markup cleanup to deconfuse the find_gt_lt tool 2011-08-30 20:32:49 +03:00
rollback.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
savepoint.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
security_label.sgml Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
select_into.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
select.sgml Implement SQL-standard LATERAL subqueries. 2012-08-07 19:02:54 -04:00
set_constraints.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
set_role.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
set_session_auth.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
set_transaction.sgml Tweak markup to avoid extra whitespace in man pages 2012-03-28 20:37:19 +03:00
set.sgml Simplify handling of the timezone GUC by making initdb choose the default. 2011-09-09 17:59:11 -04:00
show.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
start_transaction.sgml Implement genuine serializable isolation level. 2011-02-08 00:09:08 +02:00
truncate.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
unlisten.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00
update.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
vacuum.sgml Make placeholders in SQL command help more consistent and precise 2012-06-22 01:06:14 +03:00
vacuumdb.sgml doc: Fix for too many brackets in command synopses on man pages 2012-05-03 22:58:00 +03:00
values.sgml Fix a whitespace issue with the man pages 2011-08-07 10:55:32 +03:00