postgresql/src/backend/parser
Bruce Momjian 15cb32d93e This is the final state of the rule system for 6.4 after the
patch is applied:

	Rewrite rules on relation level work fine now.

	Event qualifications on insert/update/delete  rules  work
	fine now.

	I  added  the  new  keyword  OLD to reference the CURRENT
	tuple. CURRENT will be removed in 6.5.

	Update rules can  reference  NEW  and  OLD  in  the  rule
	qualification and the actions.

	Insert/update/delete rules on views can be established to
	let them behave like real tables.

	For  insert/update/delete  rules  multiple  actions   are
	supported  now.   The  actions  can also be surrounded by
	parantheses to make psql  happy.   Multiple  actions  are
	required if update to a view requires updates to multiple
	tables.

	Regular users  are  permitted  to  create/drop  rules  on
	tables     they     have     RULE     permissions     for
	(DefineQueryRewrite() is  now  able  to  get  around  the
	access  restrictions  on  pg_rewrite).  This enables view
	creation for regular users too. This  required  an  extra
	boolean  parameter  to  pg_parse_and_plan() that tells to
	set skipAcl on all rangetable entries  of  the  resulting
	queries.       There      is      a      new     function
	pg_exec_query_acl_override()  that  could  be   used   by
	backend utilities to use this facility.

	All rule actions (not only views) inherit the permissions
	of the event relations  owner.  Sample:  User  A  creates
	tables    T1    and    T2,   creates   rules   that   log
	INSERT/UPDATE/DELETE on T1 in T2 (like in the  regression
	tests  for rules I created) and grants ALL but RULE on T1
	to user B.  User B  can  now  fully  access  T1  and  the
	logging  happens  in  T2.  But user B cannot access T2 at
	all, only the rule actions can. And due to  missing  RULE
	permissions on T1, user B cannot disable logging.

	Rules  on  the  attribute  level are disabled (they don't
	work properly and since regular users are  now  permitted
	to create rules I decided to disable them).

	Rules  on  select  must have exactly one action that is a
	select (so select rules must be a view definition).

	UPDATE NEW/OLD rules  are  disabled  (still  broken,  but
	triggers can do it).

	There are two new system views (pg_rule and pg_view) that
	show the definition of the rules or views so the db admin
	can  see  what  the  users do. They use two new functions
	pg_get_ruledef() and pg_get_viewdef() that are  builtins.

	The functions pg_get_ruledef() and pg_get_viewdef() could
	be used to implement rule and view support in pg_dump.

	PostgreSQL is now the only database system I  know,  that
	has rewrite rules on the query level. All others (where I
	found a  rule  statement  at  all)  use  stored  database
	procedures  or  the  like  (triggers as we call them) for
	active rules (as some call them).

    Future of the rule system:

	The now disabled parts  of  the  rule  system  (attribute
	level,  multiple  actions on select and update new stuff)
	require a complete new rewrite handler from scratch.  The
	old one is too badly wired up.

	After  6.4  I'll  start to work on a new rewrite handler,
	that fully supports the attribute level  rules,  multiple
	actions on select and update new.  This will be available
	for 6.5 so we get full rewrite rule capabilities.

Jan
1998-08-24 01:38:11 +00:00
..
analyze.c From: Jan Wieck <jwieck@debis.com> 1998-08-18 00:49:04 +00:00
gram.c Attached is a patch that uses autoconf to determine whether there 1998-08-23 22:25:54 +00:00
gram.y o note that now pg_database has a new attribuite "encoding" even 1998-08-24 01:14:24 +00:00
keywords.c This is the final state of the rule system for 6.4 after the 1998-08-24 01:38:11 +00:00
Makefile From: t-ishii@sra.co.jp 1998-07-26 04:31:41 +00:00
parse_agg.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse_clause.c From: David Hartwig <daybee@bellatlantic.net> 1998-08-05 04:49:19 +00:00
parse_coerce.c Include OID as a built-in type. 1998-08-14 16:07:00 +00:00
parse_expr.c Change atttypmod from int16 to int32, for Thomas. 1998-07-12 21:29:40 +00:00
parse_func.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse_node.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse_oper.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse_relation.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse_target.c cleanup 1998-08-23 14:43:46 +00:00
parse_type.c heap_fetch requires buffer pointer, must be released; heap_getnext 1998-08-19 02:04:17 +00:00
parse.h Make large objects their own relkind type. Fix dups in pg_class_mb 1998-08-06 05:13:14 +00:00
parser.c Remove un-needed braces around single statements. 1998-06-15 19:30:31 +00:00
README cleanup 1998-08-23 14:43:46 +00:00
scan.c Attached is a patch that uses autoconf to determine whether there 1998-08-23 22:25:54 +00:00
scan.l Hi, here are the patches to enhance existing MB handling. This time 1998-06-16 07:29:54 +00:00
scansup.c pgindent run before 6.3 release, with Thomas' requested changes. 1998-02-26 04:46:47 +00:00

This directory does more than tokenize and parse SQL queries.  It also
creates Query structures for the various complex queries that is passed
to the optimizer and then executor.

parser.c	things start here
scan.l		break query into tokens
scansup.c	handle escapes in input
keywords.c	turn keywords into specific tokens
gram.y		parse the tokens and fill query-type-specific structures
analyze.c	handle post-parse processing for each query type
parse_clause.c	handle clauses like WHERE, ORDER BY, GROUP BY, ...
parse_coerce.c	used for coercing expressions of different types
parse_expr.c	handle expressions like col, col + 3, x = 3 or x = 4
parse_oper.c	handle operations in expressions
parse_agg.c	handle aggregates, like SUM(col1),  AVG(col2), ...
parse_func.c	handle functions, table.column and column identifiers
parse_node.c	create nodes for various structures
parse_target.c	handle the result list of the query
parse_relation.c support routines for tables and column handling
parse_type.c	support routines for type handling