x86
v6.4
1998-10-08
- Mostly working with the Cygwin library. No DLLs yet.
+ Working with the Cygwin library.
the server-side port of
Postgres has recently been
-accomplished. Check
-
the Askesis Postgres Home Page
-for up to date information. You may also want to
-look for possible patches on the
+accomplished. The Cygnus library is required to compile it.
Example of a circular rewrite rule combination.
-create rule bad_rule_combination_1 is
+create rule bad_rule_combination_1 as
on select to EMP
do instead select to TOYEMP
-create rule bad_rule_combination_2 is
+create rule bad_rule_combination_2 as
on select to TOYEMP
do instead select to EMP
Make Sam get the same salary adjustment as Joe:
-create rule example_1 is
+create rule example_1 as
on update EMP.salary where current.name = "Joe"
do update EMP (salary = new.salary)
where EMP.name = "Sam"
Make Bill get Joe's salary when it is accessed:
-create rule example_2 is
+create rule example_2 as
on select to EMP.salary
where current.name = "Bill"
do instead
department (current_user returns the name of
the current user):
-create rule example_3 is
+create rule example_3 as
on select to EMP.salary
where current.dept = "shoe" and current_user = "Joe"
do instead nothing
create TOYEMP(name = char16, salary = int4)
-create rule example_4 is
+create rule example_4 as
on select to TOYEMP
do instead
select (EMP.name, EMP.salary) from EMP
All new employees must make 5,000 or less
-create rule example_5 is
+create rule example_5 as
on insert to EMP where new.salary > 5000
do update newset salary = 5000
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.38 1999/01/25 18:02:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.39 1999/02/02 17:46:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/***S*H***/
/* Use 'new_tlist' instead of 'tlist' */
- result_plan =
- make_groupPlan(&new_tlist,
- tuplePerGroup,
- parse->groupClause,
- result_plan);
+ result_plan = make_groupPlan(&new_tlist,
+ tuplePerGroup,
+ parse->groupClause,
+ result_plan);
}
/*
result_plan = (Plan *) make_agg(tlist, result_plan);
/*
- * set the varno/attno entries to the appropriate references to
+ * get the varno/attno entries to the appropriate references to
* the result tuple of the subplans.
*/
((Agg *) result_plan)->aggs =
get_agg_tlist_references((Agg *) result_plan);
-
/***S*H***/
if(parse->havingQual!=NULL)
{
((Agg *) result_plan)->plan.qual=(List *) parse->havingQual;
/* Check every clause of the havingQual for aggregates used and append
- * them to result_plan->aggs */
+ * them to result_plan->aggs
+ */
foreach(clause, ((Agg *) result_plan)->plan.qual)
{
/* Make sure there are aggregates in the havingQual
- * if so, the list must be longer after check_having_qual_for_aggs */
+ * if so, the list must be longer after check_having_qual_for_aggs
+ */
old_length=length(((Agg *) result_plan)->aggs);
((Agg *) result_plan)->aggs = nconc(((Agg *) result_plan)->aggs,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.34 1999/01/26 05:57:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.35 1999/02/02 17:46:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*---------------------------------------------------------
*
* get_agg_tlist_references -
- * changes the target list of an Agg node so that it points to
+ * generates the target list of an Agg node so that it points to
* the tuples returned by its left tree subplan.
*
* We now also generate a linked list of Aggref pointers for Agg.
foreach(t, ((List *) ((SubLink *) ((SubPlan *)
((Expr *) clause)->oper)->sublink)->lefthand))
{
- agg_list =
- nconc(agg_list,
+ agg_list = nconc(agg_list,
check_having_qual_for_aggs(lfirst(t),
subplanTargetList, groupClause));
}
foreach(tmp_ptr, ((SubLink *) ((SubPlan *)
((Expr *) clause)->oper)->sublink)->oper)
{
- agg_list =
- nconc(agg_list,
- check_having_qual_for_aggs((Node *) lfirst(((Expr *)
+ agg_list = nconc(agg_list,
+ check_having_qual_for_aggs((Node *) lfirst(((Expr *)
lfirst(tmp_ptr))->args),
subplanTargetList, groupClause));
}
*/
if (contained_in_group_clause)
{
- agg_list =
- nconc(agg_list,
- check_having_qual_for_aggs(lfirst(t),
+ agg_list = nconc(agg_list,
+ check_having_qual_for_aggs(lfirst(t),
subplanTargetList, groupClause));
}
else
}
else
{
-
/*
* Ooops! we can not handle that!
*/
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: planmain.h,v 1.18 1999/01/25 18:02:28 momjian Exp $
+ * $Id: planmain.h,v 1.19 1999/02/02 17:46:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
extern void set_tlist_references(Plan *plan);
extern List *join_references(List *clauses, List *outer_tlist,
- List *inner_tlist);
+ List *inner_tlist);
extern List *index_outerjoin_references(List *inner_indxqual,
List *outer_tlist, Index inner_relid);
extern List *get_agg_tlist_references(Agg *aggNode);
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/create_rule.l,v 1.9 1998/06/24 13:21:24 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/create_rule.l,v 1.10 1999/02/02 17:46:17 momjian Exp $
.TH "CREATE RULE" SQL 11/05/95 PostgreSQL PostgreSQL
.SH NAME
create rule - define a new rule
--
--Example of a circular rewrite rule combination.
--
-create rule bad_rule_combination_1 is
+create rule bad_rule_combination_1 as
on select to EMP
do instead select to TOYEMP
-create rule bad_rule_combination_2 is
+create rule bad_rule_combination_2 as
on select to TOYEMP
do instead select to EMP
--
--Make Sam get the same salary adjustment as Joe
--
-create rule example_1 is
+create rule example_1 as
on update EMP.salary where current.name = "Joe"
do update EMP (salary = new.salary)
where EMP.name = "Sam"
--
--Make Bill get Joe's salary when it is accessed
--
-create rule example_2 is
+create rule example_2 as
on select to EMP.salary
where current.name = "Bill"
do instead
--Deny Joe access to the salary of employees in the shoe
--department. (pg_username() returns the name of the current user)
--
-create rule example_3 is
+create rule example_3 as
on select to EMP.salary
where current.dept = "shoe"
and pg_username() = "Joe"
--
create TOYEMP(name = name, salary = int4)
-create rule example_4 is
+create rule example_4 as
on select to TOYEMP
do instead select (EMP.name, EMP.salary) from EMP
where EMP.dept = "toy"
--
--All new employees must make 5,000 or less
--
-create rule example_5 is
+create rule example_5 as
on insert to EMP where new.salary > 5000
do update newset salary = 5000
.fi