Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
43515ba3
Commit
43515ba3
authored
Jul 24, 2002
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove _deadcode.
parent
739adf32
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
4535 deletions
+0
-4535
src/backend/commands/_deadcode/recipe.c
src/backend/commands/_deadcode/recipe.c
+0
-1318
src/backend/commands/_deadcode/version.c
src/backend/commands/_deadcode/version.c
+0
-346
src/backend/executor/_deadcode/nodeTee.c
src/backend/executor/_deadcode/nodeTee.c
+0
-499
src/backend/optimizer/path/_deadcode/predmig.c
src/backend/optimizer/path/_deadcode/predmig.c
+0
-810
src/backend/optimizer/path/_deadcode/xfunc.c
src/backend/optimizer/path/_deadcode/xfunc.c
+0
-1479
src/include/optimizer/_deadcode/xfunc.h
src/include/optimizer/_deadcode/xfunc.h
+0
-83
No files found.
src/backend/commands/_deadcode/recipe.c
deleted
100644 → 0
View file @
739adf32
This diff is collapsed.
Click to expand it.
src/backend/commands/_deadcode/version.c
deleted
100644 → 0
View file @
739adf32
/*-------------------------------------------------------------------------
*
* version.c
* This file contains all the rules that govern all version semantics.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* The version stuff has not been tested under postgres95 and probably
* doesn't work! - jolly 8/19/95
*
*
* $Id: version.c,v 1.30 2002/06/20 20:29:27 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
* <vname>_added and <vname>_deleted.
*
* In addition, 4 rules are defined which govern the semantics of
* versions w.r.t retrieves, appends, replaces and deletes.
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#define MAX_QUERY_LEN 1024
char
rule_buf
[
MAX_QUERY_LEN
];
/*
* problem: the version system assumes that the rules it declares will
* be fired in the order of declaration, it also assumes
* goh's silly instead semantics. Unfortunately, it is a pain
* to make the version system work with the new semantics.
* However the whole problem can be solved, and some nice
* functionality can be achieved if we get multiple action rules
* to work. So thats what I did -- glass
*
* Well, at least they've been working for about 20 minutes.
*
* So any comments in this code about 1 rule per transction are false...:)
*
*/
/*
* This is needed because the rule system only allows
* *1* rule to be defined per transaction.
*
* NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
* OOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* DONT DO THAT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* If you commit the current Xact all the palloced memory GOES AWAY
* and could be re-palloced in the new Xact and the whole hell breaks
* loose and poor people like me spend 2 hours of their live chassing
* a strange memory bug instead of watching the "Get Smart" marathon
* in NICK !
* DO NOT COMMIT THE XACT, just increase the Cid counter!
* _sp.
*/
#ifdef NOT_USED
static
void
eval_as_new_xact
(
char
*
query
)
{
/*------
* WARNING! do not uncomment the following lines WARNING!
*
* CommitTransactionCommand();
* StartTransactionCommand();
*------
*/
CommandCounterIncrement
();
pg_exec_query
(
query
);
}
#endif
/*
* Define a version.
*/
#ifdef NOT_USED
void
DefineVersion
(
char
*
name
,
char
*
fromRelname
,
char
*
date
)
{
char
*
bname
;
static
char
saved_basename
[
512
];
static
char
saved_snapshot
[
512
];
if
(
date
==
NULL
)
{
/* no time ranges */
bname
=
fromRelname
;
strcpy
(
saved_basename
,
(
char
*
)
bname
);
*
saved_snapshot
=
(
char
)
NULL
;
}
else
{
/* version is a snapshot */
bname
=
fromRelname
;
strcpy
(
saved_basename
,
(
char
*
)
bname
);
sprintf
(
saved_snapshot
,
"['%s']"
,
date
);
}
/*
* Calls the routine ``GetAttrList'' get the list of attributes from
* the base relation. Code is put here so that we only need to look up
* the attribute once for both appends and replaces.
*/
setAttrList
(
bname
);
VersionCreate
(
name
,
saved_basename
);
VersionAppend
(
name
,
saved_basename
);
VersionDelete
(
name
,
saved_basename
,
saved_snapshot
);
VersionReplace
(
name
,
saved_basename
,
saved_snapshot
);
VersionRetrieve
(
name
,
saved_basename
,
saved_snapshot
);
}
#endif
/*
* Creates the deltas.
*/
#ifdef NOT_USED
void
VersionCreate
(
char
*
vname
,
char
*
bname
)
{
static
char
query_buf
[
MAX_QUERY_LEN
];
/*
* Creating the dummy version relation for triggering rules.
*/
sprintf
(
query_buf
,
"SELECT * INTO TABLE %s from %s where 1 =2"
,
vname
,
bname
);
pg_exec_query
(
query_buf
);
/*
* Creating the ``v_added'' relation
*/
sprintf
(
query_buf
,
"SELECT * INTO TABLE %s_added from %s where 1 = 2"
,
vname
,
bname
);
eval_as_new_xact
(
query_buf
);
/*
* Creating the ``v_deleted'' relation.
*/
sprintf
(
query_buf
,
"CREATE TABLE %s_del (DOID oid)"
,
vname
);
eval_as_new_xact
(
query_buf
);
}
#endif
/*
* Given the relation name, does a catalog lookup for that relation and
* sets the global variable 'attr_list' with the list of attributes (names)
* for that relation.
*/
#ifdef NOT_USED
static
void
setAttrList
(
char
*
bname
)
{
Relation
rel
;
int
i
=
0
;
int
maxattrs
=
0
;
char
*
attrname
;
char
temp_buf
[
512
];
int
notfirst
=
0
;
rel
=
heap_openr
(
bname
);
if
(
rel
==
NULL
)
{
elog
(
ERROR
,
"Unable to expand all -- amopenr failed "
);
return
;
}
maxattrs
=
RelationGetNumberOfAttributes
(
rel
);
attr_list
[
0
]
=
'\0'
;
for
(
i
=
maxattrs
-
1
;
i
>
-
1
;
--
i
)
{
attrname
=
NameStr
(
rel
->
rd_att
->
attrs
[
i
]
->
attname
);
if
(
notfirst
==
1
)
sprintf
(
temp_buf
,
", %s = new.%s"
,
attrname
,
attrname
);
else
{
sprintf
(
temp_buf
,
"%s = new.%s"
,
attrname
,
attrname
);
notfirst
=
1
;
}
strcat
(
attr_list
,
temp_buf
);
}
heap_close
(
rel
);
return
;
}
#endif
/*
* This routine defines the rule governing the append semantics of
* versions. All tuples appended to a version gets appended to the
* <vname>_added relation.
*/
#ifdef NOT_USED
static
void
VersionAppend
(
char
*
vname
,
char
*
bname
)
{
sprintf
(
rule_buf
,
"define rewrite rule %s_append is on INSERT to %s do instead append %s_added(%s)"
,
vname
,
vname
,
vname
,
attr_list
);
eval_as_new_xact
(
rule_buf
);
}
#endif
/*
* This routine defines the rule governing the retrieval semantics of
* versions. To retrieve tuples from a version , we need to:
*
* 1. Retrieve all tuples in the <vname>_added relation.
* 2. Retrieve all tuples in the base relation which are not in
* the <vname>_del relation.
*/
#ifdef NOT_USED
void
VersionRetrieve
(
char
*
vname
,
char
*
bname
,
char
*
snapshot
)
{
sprintf
(
rule_buf
,
"define rewrite rule %s_retrieve is on SELECT to %s do instead
\n
\
SELECT %s_1.oid, %s_1.* from _%s in %s%s, %s_1 in (%s_added | _%s) \
where _%s.oid !!= '%s_del.DOID'"
,
vname
,
vname
,
vname
,
vname
,
bname
,
bname
,
snapshot
,
vname
,
vname
,
bname
,
bname
,
vname
);
eval_as_new_xact
(
rule_buf
);
/* printf("%s\n",rule_buf); */
}
#endif
/*
* This routine defines the rules that govern the delete semantics of
* versions. Two things happens when we delete a tuple from a version:
*
* 1. If the tuple to be deleted was added to the version *after*
* the version was created, then we simply delete the tuple
* from the <vname>_added relation.
* 2. If the tuple to be deleted is actually in the base relation,
* then we have to mark that tuple as being deleted by adding
* it to the <vname>_del relation.
*/
#ifdef NOT_USED
void
VersionDelete
(
char
*
vname
,
char
*
bname
,
char
*
snapshot
)
{
sprintf
(
rule_buf
,
"define rewrite rule %s_delete1 is on delete to %s do instead
\n
\
[delete %s_added where current.oid = %s_added.oid
\n
\
append %s_del(DOID = current.oid) from _%s in %s%s \
where current.oid = _%s.oid]
\n
"
,
vname
,
vname
,
vname
,
vname
,
vname
,
bname
,
bname
,
snapshot
,
bname
);
eval_as_new_xact
(
rule_buf
);
#ifdef OLD_REWRITE
sprintf
(
rule_buf
,
"define rewrite rule %s_delete2 is on delete to %s do instead
\n
\
append %s_del(DOID = current.oid) from _%s in %s%s \
where current.oid = _%s.oid
\n
"
,
vname
,
vname
,
vname
,
bname
,
bname
,
snapshot
,
bname
);
eval_as_new_xact
(
rule_buf
);
#endif
/* OLD_REWRITE */
}
#endif
/*
* This routine defines the rules that govern the update semantics
* of versions. To update a tuple in a version:
*
* 1. If the tuple is in <vname>_added, we simply ``replace''
* the tuple (as per postgres style).
* 2. if the tuple is in the base relation, then two things have to
* happen:
* 2.1 The tuple is marked ``deleted'' from the base relation by
* adding the tuple to the <vname>_del relation.
* 2.2 A copy of the tuple is appended to the <vname>_added relation
*/
#ifdef NOT_USED
void
VersionReplace
(
char
*
vname
,
char
*
bname
,
char
*
snapshot
)
{
sprintf
(
rule_buf
,
"define rewrite rule %s_replace1 is on replace to %s do instead
\n
\
[replace %s_added(%s) where current.oid = %s_added.oid
\n
\
append %s_del(DOID = current.oid) from _%s in %s%s \
where current.oid = _%s.oid
\n
\
append %s_added(%s) from _%s in %s%s \
where current.oid !!= '%s_added.oid' and current.oid = _%s.oid]
\n
"
,
vname
,
vname
,
vname
,
attr_list
,
vname
,
vname
,
bname
,
bname
,
snapshot
,
bname
,
vname
,
attr_list
,
bname
,
bname
,
snapshot
,
vname
,
bname
);
eval_as_new_xact
(
rule_buf
);
/* printf("%s\n",rule_buf); */
#ifdef OLD_REWRITE
sprintf
(
rule_buf
,
"define rewrite rule %s_replace2 is on replace to %s do
\n
\
append %s_del(DOID = current.oid) from _%s in %s%s \
where current.oid = _%s.oid
\n
"
,
vname
,
vname
,
vname
,
bname
,
bname
,
snapshot
,
bname
);
eval_as_new_xact
(
rule_buf
);
sprintf
(
rule_buf
,
"define rewrite rule %s_replace3 is on replace to %s do instead
\n
\
append %s_added(%s) from _%s in %s%s \
where current.oid !!= '%s_added.oid' and current.oid = \
_%s.oid
\n
"
,
vname
,
vname
,
vname
,
attr_list
,
bname
,
bname
,
snapshot
,
vname
,
bname
);
eval_as_new_xact
(
rule_buf
);
#endif
/* OLD_REWRITE */
/* printf("%s\n",rule_buf); */
}
#endif
src/backend/executor/_deadcode/nodeTee.c
deleted
100644 → 0
View file @
739adf32
This diff is collapsed.
Click to expand it.
src/backend/optimizer/path/_deadcode/predmig.c
deleted
100644 → 0
View file @
739adf32
This diff is collapsed.
Click to expand it.
src/backend/optimizer/path/_deadcode/xfunc.c
deleted
100644 → 0
View file @
739adf32
This diff is collapsed.
Click to expand it.
src/include/optimizer/_deadcode/xfunc.h
deleted
100644 → 0
View file @
739adf32
/*-------------------------------------------------------------------------
*
* xfunc.h
* prototypes for xfunc.c and predmig.c.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: xfunc.h,v 1.9 2002/06/20 20:29:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef XFUNC_H
#define XFUNC_H
#include "nodes/relation.h"
#include "utils/rel.h"
/* command line arg flags */
#define XFUNC_OFF -1
/* do no optimization of expensive preds */
#define XFUNC_NOR 2
/* do no optimization of OR clauses */
#define XFUNC_NOPULL 4
/* never pull restrictions above joins */
#define XFUNC_NOPM 8
/* don't do predicate migration */
#define XFUNC_WAIT 16
/* don't do pullup until predicate
* migration */
#define XFUNC_PULLALL 32
/* pull all expensive restrictions up,
* always */
/* constants for local and join predicates */
#define XFUNC_LOCPRD 1
#define XFUNC_JOINPRD 2
#define XFUNC_UNKNOWN 0
extern
int
XfuncMode
;
/* defined in tcop/postgres.c */
/* default width assumed for variable length attributes */
#define VARLEN_DEFAULT 128;
/* Macro to get group rank out of group cost and group sel */
#define get_grouprank(a) ((get_groupsel(a) - 1) / get_groupcost(a))
/* Macro to see if a path node is actually a Join */
#define is_join(pathnode) (length(get_relids(get_parent(pathnode))) > 1 ? 1 : 0)
/* function prototypes from planner/path/xfunc.c */
extern
void
xfunc_trypullup
(
RelOptInfo
*
rel
);
extern
int
xfunc_shouldpull
(
Path
*
childpath
,
JoinPath
*
parentpath
,
int
whichchild
,
RestrictInfo
*
maxcinfopt
);
extern
RestrictInfo
*
xfunc_pullup
(
Path
*
childpath
,
JoinPath
*
parentpath
,
RestrictInfo
*
cinfo
,
int
whichchild
,
int
clausetype
);
extern
Cost
xfunc_rank
(
Expr
*
clause
);
extern
Cost
xfunc_expense
(
Query
*
queryInfo
,
Expr
*
clause
);
extern
Cost
xfunc_join_expense
(
JoinPath
*
path
,
int
whichchild
);
extern
Cost
xfunc_local_expense
(
Expr
*
clause
);
extern
Cost
xfunc_func_expense
(
Expr
*
node
,
List
*
args
);
extern
int
xfunc_width
(
Expr
*
clause
);
/* static, moved to xfunc.c */
/* extern int xfunc_card_unreferenced(Expr *clause, Relids referenced); */
extern
int
xfunc_card_product
(
Relids
relids
);
extern
List
*
xfunc_find_references
(
List
*
clause
);
extern
List
*
xfunc_primary_join
(
JoinPath
*
pathnode
);
extern
Cost
xfunc_get_path_cost
(
Path
*
pathnode
);
extern
Cost
xfunc_total_path_cost
(
JoinPath
*
pathnode
);
extern
Cost
xfunc_expense_per_tuple
(
JoinPath
*
joinnode
,
int
whichchild
);
extern
void
xfunc_fixvars
(
Expr
*
clause
,
RelOptInfo
*
rel
,
int
varno
);
extern
int
xfunc_cinfo_compare
(
void
*
arg1
,
void
*
arg2
);
extern
int
xfunc_clause_compare
(
void
*
arg1
,
void
*
arg2
);
extern
void
xfunc_disjunct_sort
(
List
*
clause_list
);
extern
int
xfunc_disjunct_compare
(
void
*
arg1
,
void
*
arg2
);
extern
int
xfunc_func_width
(
RegProcedure
funcid
,
List
*
args
);
extern
int
xfunc_tuple_width
(
Relation
rd
);
extern
int
xfunc_num_join_clauses
(
JoinPath
*
path
);
extern
List
*
xfunc_LispRemove
(
List
*
foo
,
List
*
bar
);
extern
bool
xfunc_copyrel
(
RelOptInfo
*
from
,
RelOptInfo
**
to
);
/*
* function prototypes for path/predmig.c
*/
extern
bool
xfunc_do_predmig
(
Path
root
);
#endif
/* XFUNC_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment