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
45708f5e
Commit
45708f5e
authored
Jul 25, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error message editing in backend/optimizer, backend/rewrite.
parent
cfa191f3
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
325 additions
and
246 deletions
+325
-246
src/backend/optimizer/geqo/geqo_erx.c
src/backend/optimizer/geqo/geqo_erx.c
+10
-14
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_eval.c
+2
-2
src/backend/optimizer/geqo/geqo_main.c
src/backend/optimizer/geqo/geqo_main.c
+10
-10
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/geqo/geqo_misc.c
+2
-2
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+6
-4
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+3
-4
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+14
-17
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+6
-4
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+7
-8
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/pathkeys.c
+2
-2
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+10
-10
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+24
-15
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planmain.c
+2
-2
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/planner.c
+14
-10
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/setrefs.c
+5
-5
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/plan/subselect.c
+5
-5
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepjointree.c
+25
-23
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/prep/preptlist.c
+5
-4
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/prep/prepunion.c
+4
-3
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/clauses.c
+17
-15
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+2
-2
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/plancat.c
+4
-4
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/relnode.c
+6
-6
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/tlist.c
+2
-2
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteDefine.c
+65
-29
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteHandler.c
+46
-29
src/backend/rewrite/rewriteManip.c
src/backend/rewrite/rewriteManip.c
+19
-9
src/backend/rewrite/rewriteRemove.c
src/backend/rewrite/rewriteRemove.c
+6
-4
src/backend/rewrite/rewriteSupport.c
src/backend/rewrite/rewriteSupport.c
+2
-2
No files found.
src/backend/optimizer/geqo/geqo_erx.c
View file @
45708f5e
...
...
@@ -3,7 +3,7 @@
* geqo_erx.c
* edge recombination crossover [ER]
*
* $Id: geqo_erx.c,v 1.1
7 2002/03/02 21:39:26 momjian
Exp $
* $Id: geqo_erx.c,v 1.1
8 2003/07/25 00:01:06 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -333,7 +333,7 @@ gimme_gene(Edge edge, Edge *edge_table)
minimum_count
=
1
;
}
else
if
(
minimum_count
==
-
1
)
elog
(
ERROR
,
"
gimme_gene: Internal error -
minimum_count not set"
);
elog
(
ERROR
,
"minimum_count not set"
);
else
if
(
edge_table
[(
int
)
friend
].
unused_edges
==
minimum_edges
)
minimum_count
++
;
...
...
@@ -359,7 +359,7 @@ gimme_gene(Edge edge, Edge *edge_table)
}
/* ... should never be reached */
elog
(
ERROR
,
"
gimme_gene:
neither shared nor minimum number nor random edge found"
);
elog
(
ERROR
,
"neither shared nor minimum number nor random edge found"
);
return
0
;
/* to keep the compiler quiet */
}
...
...
@@ -419,15 +419,11 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
}
}
elog
(
LOG
,
"
edge_failure(1):
no edge found via random decision and total_edges == 4"
);
elog
(
LOG
,
"no edge found via random decision and total_edges == 4"
);
}
else
/* random decision of the gene with remaining edges */
if
(
remaining_edges
!=
0
)
else
if
(
remaining_edges
!=
0
)
{
/* random decision of the gene with remaining edges */
rand_decision
=
(
int
)
geqo_randint
(
remaining_edges
-
1
,
0
);
for
(
i
=
1
;
i
<=
num_gene
;
i
++
)
...
...
@@ -444,7 +440,7 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
}
}
elog
(
LOG
,
"
edge_failure(2): no edge found via random decision and remaini
g edges"
);
elog
(
LOG
,
"
no edge found via random decision with remainin
g edges"
);
}
/*
...
...
@@ -462,11 +458,11 @@ edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene)
if
(
edge_table
[
i
].
unused_edges
>=
0
)
return
(
Gene
)
i
;
elog
(
LOG
,
"
edge_failure(3):
no edge found via looking for the last ununsed point"
);
elog
(
LOG
,
"no edge found via looking for the last ununsed point"
);
}
/* ... should never be reached */
elog
(
ERROR
,
"
edge_failure: no edge detecte
d"
);
/* ... should never be reached */
elog
(
ERROR
,
"
no edge foun
d"
);
return
0
;
/* to keep the compiler quiet */
}
src/backend/optimizer/geqo/geqo_eval.c
View file @
45708f5e
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.6
2 2003/05/02 20:54:34
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.6
3 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -66,7 +66,7 @@ geqo_eval(Query *root, List *initial_rels, Gene *tour, int num_gene)
* Since geqo_eval() will be called many times, we can't afford to let
* all that memory go unreclaimed until end of statement. Note we
* make the temp context a child of the planner's normal context, so that
* it will be freed even if we abort via e
log
(ERROR).
* it will be freed even if we abort via e
report
(ERROR).
*/
mycontext
=
AllocSetContextCreate
(
CurrentMemoryContext
,
"GEQO"
,
...
...
src/backend/optimizer/geqo/geqo_main.c
View file @
45708f5e
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.3
5 2003/05/27 17:49:46 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_main.c,v 1.3
6 2003/07/25 00:01:06 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -120,30 +120,30 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
daddy
=
alloc_chromo
(
pool
->
string_length
);
#if defined (ERX)
elog
(
DEBUG2
,
"
geqo_main:
using edge recombination crossover [ERX]"
);
elog
(
DEBUG2
,
"using edge recombination crossover [ERX]"
);
/* allocate edge table memory */
edge_table
=
alloc_edge_table
(
pool
->
string_length
);
#elif defined(PMX)
elog
(
DEBUG2
,
"
geqo_main:
using partially matched crossover [PMX]"
);
elog
(
DEBUG2
,
"using partially matched crossover [PMX]"
);
/* allocate chromosome kid memory */
kid
=
alloc_chromo
(
pool
->
string_length
);
#elif defined(CX)
elog
(
DEBUG2
,
"
geqo_main:
using cycle crossover [CX]"
);
elog
(
DEBUG2
,
"using cycle crossover [CX]"
);
/* allocate city table memory */
kid
=
alloc_chromo
(
pool
->
string_length
);
city_table
=
alloc_city_table
(
pool
->
string_length
);
#elif defined(PX)
elog
(
DEBUG2
,
"
geqo_main:
using position crossover [PX]"
);
elog
(
DEBUG2
,
"using position crossover [PX]"
);
/* allocate city table memory */
kid
=
alloc_chromo
(
pool
->
string_length
);
city_table
=
alloc_city_table
(
pool
->
string_length
);
#elif defined(OX1)
elog
(
DEBUG2
,
"
geqo_main:
using order crossover [OX1]"
);
elog
(
DEBUG2
,
"using order crossover [OX1]"
);
/* allocate city table memory */
kid
=
alloc_chromo
(
pool
->
string_length
);
city_table
=
alloc_city_table
(
pool
->
string_length
);
#elif defined(OX2)
elog
(
DEBUG2
,
"
geqo_main:
using order crossover [OX2]"
);
elog
(
DEBUG2
,
"using order crossover [OX2]"
);
/* allocate city table memory */
kid
=
alloc_chromo
(
pool
->
string_length
);
city_table
=
alloc_city_table
(
pool
->
string_length
);
...
...
@@ -211,7 +211,7 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
elog
(
LOG
,
"[GEQO] failures: %d, average: %d"
,
edge_failures
,
(
int
)
generation
/
edge_failures
);
else
elog
(
LOG
,
"[GEQO]
No edge failures detected.
"
);
elog
(
LOG
,
"[GEQO]
no edge failures detected
"
);
#endif
...
...
@@ -219,7 +219,7 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
if
(
mutations
!=
0
)
elog
(
LOG
,
"[GEQO] mutations: %d, generations: %d"
,
mutations
,
generation
);
else
elog
(
LOG
,
"[GEQO]
No mutations processed.
"
);
elog
(
LOG
,
"[GEQO]
no mutations processed
"
);
#endif
...
...
@@ -239,7 +239,7 @@ geqo(Query *root, int number_of_rels, List *initial_rels)
best_tour
,
pool
->
string_length
);
if
(
best_rel
==
NULL
)
elog
(
ERROR
,
"
geqo:
failed to make a valid plan"
);
elog
(
ERROR
,
"failed to make a valid plan"
);
/* DBG: show the query plan */
#ifdef NOT_USED
...
...
src/backend/optimizer/geqo/geqo_misc.c
View file @
45708f5e
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.3
6 2002/12/16 21:30:29
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/geqo_misc.c,v 1.3
7 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -38,7 +38,7 @@ avg_pool(Pool *pool)
double
cumulative
=
0
.
0
;
if
(
pool
->
size
<=
0
)
elog
(
ERROR
,
"
avg_pool: pool_size of
zero"
);
elog
(
ERROR
,
"
pool_size is
zero"
);
/*
* Since the pool may contain multiple occurrences of DBL_MAX, divide
...
...
src/backend/optimizer/path/allpaths.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.10
3 2003/06/29 23:05:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.10
4 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -209,7 +209,9 @@ set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
* do better?
*/
if
(
intMember
(
parentRTindex
,
root
->
rowMarks
))
elog
(
ERROR
,
"SELECT FOR UPDATE is not supported for inherit queries"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE is not supported for inherit queries"
)));
/*
* The executor will check the parent table's access permissions when
...
...
@@ -642,7 +644,7 @@ recurse_pushdown_safe(Node *setOp, Query *topquery,
}
else
{
elog
(
ERROR
,
"
recurse_pushdown_safe: unexpected node
%d"
,
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
setOp
));
}
return
true
;
...
...
@@ -839,7 +841,7 @@ recurse_push_qual(Node *setOp, Query *topquery,
}
else
{
elog
(
ERROR
,
"
recurse_push_qual: unexpected node
%d"
,
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
setOp
));
}
}
...
...
src/backend/optimizer/path/costsize.c
View file @
45708f5e
...
...
@@ -49,7 +49,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.11
0 2003/07/14 22:35:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.11
1 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1513,7 +1513,7 @@ cost_qual_eval_walker(Node *node, QualCost *total)
else
if
(
IsA
(
node
,
SubLink
))
{
/* This routine should not be applied to un-planned expressions */
elog
(
ERROR
,
"c
ost_qual_eval: can'
t handle unplanned sub-select"
);
elog
(
ERROR
,
"c
anno
t handle unplanned sub-select"
);
}
else
if
(
IsA
(
node
,
SubPlan
))
{
...
...
@@ -1805,8 +1805,7 @@ set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
temp
=
inner_rel
->
rows
;
break
;
default:
elog
(
ERROR
,
"set_joinrel_size_estimates: unsupported join type %d"
,
(
int
)
jointype
);
elog
(
ERROR
,
"unrecognized join type: %d"
,
(
int
)
jointype
);
temp
=
0
;
/* keep compiler quiet */
break
;
}
...
...
src/backend/optimizer/path/indxpath.c
View file @
45708f5e
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.14
4 2003/06/15 22:51:45
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.14
5 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -490,7 +490,7 @@ extract_or_indexqual_conditions(RelOptInfo *rel,
}
while
(
!
DoneMatchingIndexKeys
(
classes
));
if
(
FastListValue
(
&
quals
)
==
NIL
)
elog
(
ERROR
,
"
extract_or_indexqual_conditions: no matching
clause"
);
elog
(
ERROR
,
"
no matching OR
clause"
);
return
FastListValue
(
&
quals
);
}
...
...
@@ -1245,7 +1245,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
if
(
!
OidIsValid
(
test_op
))
{
/* This should not fail, else pg_amop entry is missing */
elog
(
ERROR
,
"
M
issing pg_amop entry for opclass %u strategy %d"
,
elog
(
ERROR
,
"
m
issing pg_amop entry for opclass %u strategy %d"
,
opclass_id
,
test_strategy
);
}
...
...
@@ -1281,7 +1281,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
if
(
isNull
)
{
/* Treat a null result as false ... but it's a tad fishy ... */
elog
(
DEBUG2
,
"
pred_test_simple_clause: null
test result"
);
elog
(
DEBUG2
,
"
null predicate
test result"
);
return
false
;
}
return
DatumGetBool
(
test_result
);
...
...
@@ -2055,7 +2055,8 @@ prefix_quals(Node *leftop, Oid opclass,
break
;
default:
elog
(
ERROR
,
"prefix_quals: unexpected opclass %u"
,
opclass
);
/* shouldn't get here */
elog
(
ERROR
,
"unexpected opclass: %u"
,
opclass
);
return
NIL
;
}
...
...
@@ -2078,7 +2079,7 @@ prefix_quals(Node *leftop, Oid opclass,
prefix_const
->
constvalue
));
break
;
default:
elog
(
ERROR
,
"
prefix_quals: unexpected consttype
%u"
,
elog
(
ERROR
,
"
unexpected const type:
%u"
,
prefix_const
->
consttype
);
return
NIL
;
}
...
...
@@ -2093,7 +2094,7 @@ prefix_quals(Node *leftop, Oid opclass,
{
oproid
=
get_opclass_member
(
opclass
,
BTEqualStrategyNumber
);
if
(
oproid
==
InvalidOid
)
elog
(
ERROR
,
"
prefix_quals: no operator =
for opclass %u"
,
opclass
);
elog
(
ERROR
,
"
no = operator
for opclass %u"
,
opclass
);
expr
=
make_opclause
(
oproid
,
BOOLOID
,
false
,
(
Expr
*
)
leftop
,
(
Expr
*
)
prefix_const
);
result
=
makeList1
(
expr
);
...
...
@@ -2107,7 +2108,7 @@ prefix_quals(Node *leftop, Oid opclass,
*/
oproid
=
get_opclass_member
(
opclass
,
BTGreaterEqualStrategyNumber
);
if
(
oproid
==
InvalidOid
)
elog
(
ERROR
,
"
prefix_quals: no operator >=
for opclass %u"
,
opclass
);
elog
(
ERROR
,
"
no >= operator
for opclass %u"
,
opclass
);
expr
=
make_opclause
(
oproid
,
BOOLOID
,
false
,
(
Expr
*
)
leftop
,
(
Expr
*
)
prefix_const
);
result
=
makeList1
(
expr
);
...
...
@@ -2122,7 +2123,7 @@ prefix_quals(Node *leftop, Oid opclass,
{
oproid
=
get_opclass_member
(
opclass
,
BTLessStrategyNumber
);
if
(
oproid
==
InvalidOid
)
elog
(
ERROR
,
"
prefix_quals: no operator <
for opclass %u"
,
opclass
);
elog
(
ERROR
,
"
no < operator
for opclass %u"
,
opclass
);
expr
=
make_opclause
(
oproid
,
BOOLOID
,
false
,
(
Expr
*
)
leftop
,
(
Expr
*
)
greaterstr
);
result
=
lappend
(
result
,
expr
);
...
...
@@ -2167,8 +2168,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
is_eq
=
true
;
break
;
default:
elog
(
ERROR
,
"network_prefix_quals: unexpected operator %u"
,
expr_op
);
elog
(
ERROR
,
"unexpected operator: %u"
,
expr_op
);
return
NIL
;
}
...
...
@@ -2180,15 +2180,13 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
{
opr1oid
=
get_opclass_member
(
opclass
,
BTGreaterEqualStrategyNumber
);
if
(
opr1oid
==
InvalidOid
)
elog
(
ERROR
,
"network_prefix_quals: no >= operator for opclass %u"
,
opclass
);
elog
(
ERROR
,
"no >= operator for opclass %u"
,
opclass
);
}
else
{
opr1oid
=
get_opclass_member
(
opclass
,
BTGreaterStrategyNumber
);
if
(
opr1oid
==
InvalidOid
)
elog
(
ERROR
,
"network_prefix_quals: no > operator for opclass %u"
,
opclass
);
elog
(
ERROR
,
"no > operator for opclass %u"
,
opclass
);
}
opr1right
=
network_scan_first
(
rightop
);
...
...
@@ -2203,8 +2201,7 @@ network_prefix_quals(Node *leftop, Oid expr_op, Oid opclass, Datum rightop)
opr2oid
=
get_opclass_member
(
opclass
,
BTLessEqualStrategyNumber
);
if
(
opr2oid
==
InvalidOid
)
elog
(
ERROR
,
"network_prefix_quals: no <= operator for opclass %u"
,
opclass
);
elog
(
ERROR
,
"no <= operator for opclass %u"
,
opclass
);
opr2right
=
network_scan_last
(
rightop
);
...
...
src/backend/optimizer/path/joinpath.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.7
8 2003/02/08 20:20:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.7
9 2003/07/25 00:01:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -165,7 +165,7 @@ sort_inner_and_outer(Query *root,
useallclauses
=
true
;
break
;
default:
elog
(
ERROR
,
"
sort_inner_and_outer: unexpected join type
%d"
,
elog
(
ERROR
,
"
unrecognized join type:
%d"
,
(
int
)
jointype
);
useallclauses
=
false
;
/* keep compiler quiet */
break
;
...
...
@@ -363,7 +363,7 @@ match_unsorted_outer(Query *root,
useallclauses
=
true
;
break
;
default:
elog
(
ERROR
,
"
match_unsorted_outer: unexpected join type
%d"
,
elog
(
ERROR
,
"
unrecognized join type:
%d"
,
(
int
)
jointype
);
nestjoinOK
=
false
;
/* keep compiler quiet */
useallclauses
=
false
;
...
...
@@ -815,7 +815,9 @@ select_mergejoin_clauses(RelOptInfo *joinrel,
case
JOIN_FULL
:
if
(
restrictinfo
->
left_relids
==
NULL
||
restrictinfo
->
mergejoinoperator
==
InvalidOid
)
elog
(
ERROR
,
"FULL JOIN is only supported with mergejoinable join conditions"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"FULL JOIN is only supported with mergejoinable join conditions"
)));
break
;
default:
/* otherwise, it's OK to have nonmergeable join quals */
...
...
src/backend/optimizer/path/joinrels.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.6
0 2003/02/08 20:20:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.6
1 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -227,8 +227,7 @@ make_rels_by_joins(Query *root, int level, List **joinrels)
}
if
(
result_rels
==
NIL
)
elog
(
ERROR
,
"make_rels_by_joins: failed to build any %d-way joins"
,
level
);
elog
(
ERROR
,
"failed to build any %d-way joins"
,
level
);
}
return
result_rels
;
...
...
@@ -367,8 +366,8 @@ make_jointree_rel(Query *root, Node *jtnode)
/* Make this join rel */
rel
=
make_join_rel
(
root
,
lrel
,
rrel
,
j
->
jointype
);
if
(
rel
==
NULL
)
elog
(
ERROR
,
"
make_jointree_rel: invalid join order!?
"
);
if
(
rel
==
NULL
)
/* oops */
elog
(
ERROR
,
"
invalid join order
"
);
/*
* Since we are only going to consider this one way to do it,
...
...
@@ -385,8 +384,8 @@ make_jointree_rel(Query *root, Node *jtnode)
return
rel
;
}
else
elog
(
ERROR
,
"
make_jointree_rel: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
NULL
;
/* keep compiler quiet */
}
...
...
@@ -571,7 +570,7 @@ make_join_rel(Query *root, RelOptInfo *rel1, RelOptInfo *rel2,
restrictlist
);
break
;
default:
elog
(
ERROR
,
"
make_join_rel: unsupported join type
%d"
,
elog
(
ERROR
,
"
unrecognized join type:
%d"
,
(
int
)
jointype
);
break
;
}
...
...
src/backend/optimizer/path/pathkeys.c
View file @
45708f5e
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.5
0 2003/06/29 23:05:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.5
1 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1089,7 +1089,7 @@ make_pathkeys_for_mergeclauses(Query *root,
}
else
{
elog
(
ERROR
,
"
make_pathkeys_for_mergeclauses: can'
t identify which side of mergeclause to use"
);
elog
(
ERROR
,
"
could no
t identify which side of mergeclause to use"
);
pathkey
=
NIL
;
/* keep compiler quiet */
}
...
...
src/backend/optimizer/plan/createplan.c
View file @
45708f5e
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.14
8 2003/07/14 22:35:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.14
9 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -155,8 +155,8 @@ create_plan(Query *root, Path *best_path)
(
UniquePath
*
)
best_path
);
break
;
default:
elog
(
ERROR
,
"
create_plan: unknown pathtype
%d"
,
best_path
->
pathtype
);
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
best_path
->
pathtype
);
plan
=
NULL
;
/* keep compiler quiet */
break
;
}
...
...
@@ -252,8 +252,8 @@ create_scan_plan(Query *root, Path *best_path)
break
;
default:
elog
(
ERROR
,
"
create_scan_plan: unknown
node type: %d"
,
best_path
->
pathtype
);
elog
(
ERROR
,
"
unrecognized
node type: %d"
,
(
int
)
best_path
->
pathtype
);
plan
=
NULL
;
/* keep compiler quiet */
break
;
}
...
...
@@ -384,8 +384,8 @@ create_join_plan(Query *root, JoinPath *best_path)
inner_plan
);
break
;
default:
elog
(
ERROR
,
"un
supported node type
%d"
,
best_path
->
path
.
pathtype
);
elog
(
ERROR
,
"un
recognized node type:
%d"
,
(
int
)
best_path
->
path
.
pathtype
);
plan
=
NULL
;
/* keep compiler quiet */
break
;
}
...
...
@@ -1172,7 +1172,7 @@ fix_indxqual_sublist(List *indexqual,
Oid
opclass
;
if
(
!
IsA
(
clause
,
OpExpr
)
||
length
(
clause
->
args
)
!=
2
)
elog
(
ERROR
,
"
fix_indxqual_sublist:
indexqual clause is not binary opclause"
);
elog
(
ERROR
,
"indexqual clause is not binary opclause"
);
/*
* Make a copy that will become the fixed clause.
...
...
@@ -1287,7 +1287,7 @@ fix_indxqual_operand(Node *node, int baserelid, IndexOptInfo *index,
}
/* Ooops... */
elog
(
ERROR
,
"
fix_indxqual_operand: node is not
index attribute"
);
elog
(
ERROR
,
"
node is not an
index attribute"
);
return
NULL
;
/* keep compiler quiet */
}
...
...
@@ -1804,7 +1804,7 @@ make_sort_from_pathkeys(Query *root, Plan *lefttree,
break
;
}
if
(
!
j
)
elog
(
ERROR
,
"
make_sort_from_pathkeys: can
not find pathkey item to sort"
);
elog
(
ERROR
,
"
could
not find pathkey item to sort"
);
/*
* Do we need to insert a Result node?
*
...
...
src/backend/optimizer/plan/initsplan.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.8
6 2003/06/29 23:05:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.8
7 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -97,11 +97,13 @@ add_base_rels_to_query(Query *root, Node *jtnode)
* Safety check: join RTEs should not be SELECT FOR UPDATE targets
*/
if
(
intMember
(
j
->
rtindex
,
root
->
rowMarks
))
elog
(
ERROR
,
"SELECT FOR UPDATE cannot be applied to a join"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE cannot be applied to a join"
)));
}
else
elog
(
ERROR
,
"
add_base_rels_to_query: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
}
...
...
@@ -284,11 +286,12 @@ distribute_quals_to_rels(Query *root, Node *jtnode)
* This is where we fail if upper levels of planner
* haven't rewritten UNION JOIN as an Append ...
*/
elog
(
ERROR
,
"UNION JOIN is not implemented yet"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"UNION JOIN is not implemented yet"
)));
break
;
default:
elog
(
ERROR
,
"distribute_quals_to_rels: unsupported join type %d"
,
elog
(
ERROR
,
"unrecognized join type: %d"
,
(
int
)
j
->
jointype
);
break
;
}
...
...
@@ -302,8 +305,8 @@ distribute_quals_to_rels(Query *root, Node *jtnode)
mark_baserels_for_outer_join
(
root
,
nullable_rels
,
result
);
}
else
elog
(
ERROR
,
"
distribute_quals_to_rels: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
result
;
}
...
...
@@ -340,7 +343,9 @@ mark_baserels_for_outer_join(Query *root, Relids rels, Relids outerrels)
if
(
rel
->
outerjoinset
==
NULL
)
{
if
(
intMember
(
relno
,
root
->
rowMarks
))
elog
(
ERROR
,
"SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN"
)));
}
rel
->
outerjoinset
=
outerrels
;
...
...
@@ -603,7 +608,7 @@ distribute_qual_to_rels(Query *root, Node *clause,
* 'clause' references no rels, and therefore we have no place to
* attach it. Shouldn't get here if callers are working properly.
*/
elog
(
ERROR
,
"
distribute_qual_to_rels: can'
t cope with variable-free clause"
);
elog
(
ERROR
,
"
canno
t cope with variable-free clause"
);
break
;
}
...
...
@@ -745,8 +750,10 @@ process_implied_equality(Query *root,
* we have no suitable equality operator for the combination of
* datatypes? NO, because sortkey selection may screw up anyway.
*/
elog
(
ERROR
,
"Unable to identify an equality operator for types '%s' and '%s'"
,
format_type_be
(
ltype
),
format_type_be
(
rtype
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_FUNCTION
),
errmsg
(
"unable to identify an equality operator for types %s and %s"
,
format_type_be
(
ltype
),
format_type_be
(
rtype
))));
}
pgopform
=
(
Form_pg_operator
)
GETSTRUCT
(
eq_operator
);
...
...
@@ -756,8 +763,10 @@ process_implied_equality(Query *root,
if
(
pgopform
->
oprlsortop
!=
sortop1
||
pgopform
->
oprrsortop
!=
sortop2
||
pgopform
->
oprresult
!=
BOOLOID
)
elog
(
ERROR
,
"Equality operator for types '%s' and '%s' should be mergejoinable, but isn't"
,
format_type_be
(
ltype
),
format_type_be
(
rtype
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_FUNCTION_DEFINITION
),
errmsg
(
"equality operator for types %s and %s should be mergejoinable, but isn't"
,
format_type_be
(
ltype
),
format_type_be
(
rtype
))));
clause
=
make_opclause
(
oprid
(
eq_operator
),
/* opno */
BOOLOID
,
/* opresulttype */
...
...
src/backend/optimizer/plan/planmain.c
View file @
45708f5e
...
...
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.7
5 2003/03/10 03:53:50
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.7
6 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -154,7 +154,7 @@ query_planner(Query *root, List *tlist, double tuple_fraction,
final_rel
=
make_one_rel
(
root
);
if
(
!
final_rel
||
!
final_rel
->
cheapest_total_path
)
elog
(
ERROR
,
"
query_planner: failed to construct a
relation"
);
elog
(
ERROR
,
"
failed to construct the join
relation"
);
/*
* Now that we have an estimate of the final rel's size, we can
...
...
src/backend/optimizer/plan/planner.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.15
6 2003/07/03 19:07:20
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.15
7 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -448,8 +448,8 @@ preprocess_qual_conditions(Query *parse, Node *jtnode)
j
->
quals
=
preprocess_expression
(
parse
,
j
->
quals
,
EXPRKIND_QUAL
);
}
else
elog
(
ERROR
,
"
preprocess_qual_conditions: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
}
/*--------------------
...
...
@@ -582,7 +582,9 @@ grouping_planner(Query *parse, double tuple_fraction)
* already, but let's make sure).
*/
if
(
parse
->
rowMarks
)
elog
(
ERROR
,
"SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE is not allowed with UNION/INTERSECT/EXCEPT"
)));
/*
* We set current_pathkeys NIL indicating we do not know sort
...
...
@@ -646,7 +648,9 @@ grouping_planner(Query *parse, double tuple_fraction)
* level
*/
if
(
PlannerQueryLevel
>
1
)
elog
(
ERROR
,
"SELECT FOR UPDATE is not allowed in subselects"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"SELECT FOR UPDATE is not allowed in subselects"
)));
foreach
(
l
,
parse
->
rowMarks
)
{
...
...
@@ -1491,7 +1495,7 @@ locate_grouping_columns(Query *parse,
break
;
}
if
(
!
sl
)
elog
(
ERROR
,
"
locate_grouping_columns: failed
"
);
elog
(
ERROR
,
"
failed to locate grouping columns
"
);
groupColIdx
[
keyno
++
]
=
te
->
resdom
->
resno
;
}
...
...
@@ -1504,7 +1508,7 @@ locate_grouping_columns(Query *parse,
* We need to transpose sort key info from the orig_tlist into new_tlist.
* NOTE: this would not be good enough if we supported resjunk sort keys
* for results of set operations --- then, we'd need to project a whole
* new tlist to evaluate the resjunk columns. For now, just e
log
if we
* new tlist to evaluate the resjunk columns. For now, just e
report
if we
* find any resjunk columns in orig_tlist.
*/
static
List
*
...
...
@@ -1524,13 +1528,13 @@ postprocess_setop_tlist(List *new_tlist, List *orig_tlist)
Assert
(
orig_tlist
!=
NIL
);
orig_tle
=
(
TargetEntry
*
)
lfirst
(
orig_tlist
);
orig_tlist
=
lnext
(
orig_tlist
);
if
(
orig_tle
->
resdom
->
resjunk
)
elog
(
ERROR
,
"
postprocess_setop_tlist: resjunk output columns
not implemented"
);
if
(
orig_tle
->
resdom
->
resjunk
)
/* should not happen */
elog
(
ERROR
,
"
resjunk output columns are
not implemented"
);
Assert
(
new_tle
->
resdom
->
resno
==
orig_tle
->
resdom
->
resno
);
Assert
(
new_tle
->
resdom
->
restype
==
orig_tle
->
resdom
->
restype
);
new_tle
->
resdom
->
ressortgroupref
=
orig_tle
->
resdom
->
ressortgroupref
;
}
if
(
orig_tlist
!=
NIL
)
elog
(
ERROR
,
"
postprocess_setop_tlist: resjunk output columns
not implemented"
);
elog
(
ERROR
,
"
resjunk output columns are
not implemented"
);
return
new_tlist
;
}
src/backend/optimizer/plan/setrefs.c
View file @
45708f5e
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.9
3 2003/06/29 00:33:43
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.9
4 2003/07/25 00:01:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -233,8 +233,8 @@ set_plan_references(Plan *plan, List *rtable)
set_plan_references
((
Plan
*
)
lfirst
(
pl
),
rtable
);
break
;
default:
elog
(
ERROR
,
"
set_plan_references: unknown plan type
%d"
,
nodeTag
(
plan
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
plan
));
break
;
}
...
...
@@ -584,7 +584,7 @@ join_references_mutator(Node *node,
return
(
Node
*
)
copyObject
(
var
);
/* No referent found for Var */
elog
(
ERROR
,
"
join_references: variable not
in subplan target lists"
);
elog
(
ERROR
,
"
variable not found
in subplan target lists"
);
}
/* Try matching more complex expressions too, if tlists have any */
if
(
context
->
tlists_have_non_vars
)
...
...
@@ -680,7 +680,7 @@ replace_vars_with_subplan_refs_mutator(Node *node,
resdom
=
tlist_member
((
Node
*
)
var
,
context
->
subplan_targetlist
);
if
(
!
resdom
)
elog
(
ERROR
,
"
replace_vars_with_subplan_refs: variable not
in subplan target list"
);
elog
(
ERROR
,
"
variable not found
in subplan target list"
);
newvar
=
(
Var
*
)
copyObject
(
var
);
newvar
->
varno
=
context
->
subvarno
;
newvar
->
varattno
=
resdom
->
resno
;
...
...
src/backend/optimizer/plan/subselect.c
View file @
45708f5e
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.7
8 2003/06/25 21:30:30 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.7
9 2003/07/25 00:01:08 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -359,7 +359,7 @@ make_subplan(SubLink *slink, List *lefthand, bool isTopQual)
Assert
(
!
te
->
resdom
->
resjunk
);
arraytype
=
get_array_type
(
te
->
resdom
->
restype
);
if
(
!
OidIsValid
(
arraytype
))
elog
(
ERROR
,
"
Can
not find array type for datatype %s"
,
elog
(
ERROR
,
"
could
not find array type for datatype %s"
,
format_type_be
(
te
->
resdom
->
restype
));
prm
=
generate_new_param
(
arraytype
,
-
1
);
node
->
setParam
=
makeListi1
(
prm
->
paramid
);
...
...
@@ -1012,8 +1012,8 @@ finalize_plan(Plan *plan, List *rtable,
break
;
default:
elog
(
ERROR
,
"
finalize_plan: node %d unsupporte
d"
,
nodeTag
(
plan
));
elog
(
ERROR
,
"
unrecognized node type: %
d"
,
(
int
)
nodeTag
(
plan
));
}
/* Process left and right child plans, if any */
...
...
@@ -1032,7 +1032,7 @@ finalize_plan(Plan *plan, List *rtable,
/* Now we have all the paramids */
if
(
!
bms_is_subset
(
context
.
paramids
,
valid_params
))
elog
(
ERROR
,
"
finalize_plan: plan shouldn'
t reference subplan's variable"
);
elog
(
ERROR
,
"
plan should no
t reference subplan's variable"
);
plan
->
extParam
=
bms_intersect
(
context
.
paramids
,
outer_params
);
plan
->
allParam
=
context
.
paramids
;
...
...
src/backend/optimizer/prep/prepjointree.c
View file @
45708f5e
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.
7 2003/03/10 03:53:50
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.
8 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -334,17 +334,19 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
* This is where we fail if upper levels of planner
* haven't rewritten UNION JOIN as an Append ...
*/
elog
(
ERROR
,
"UNION JOIN is not implemented yet"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"UNION JOIN is not implemented yet"
)));
break
;
default:
elog
(
ERROR
,
"
pull_up_subqueries: unexpected join type
%d"
,
j
->
jointype
);
elog
(
ERROR
,
"
unrecognized join type:
%d"
,
(
int
)
j
->
jointype
);
break
;
}
}
else
elog
(
ERROR
,
"
pull_up_subqueries: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
jtnode
;
}
...
...
@@ -363,7 +365,7 @@ is_simple_subquery(Query *subquery)
subquery
->
commandType
!=
CMD_SELECT
||
subquery
->
resultRelation
!=
0
||
subquery
->
into
!=
NULL
)
elog
(
ERROR
,
"
is_simple_subquery:
subquery is bogus"
);
elog
(
ERROR
,
"subquery is bogus"
);
/*
* Can't currently pull up a query with setops. Maybe after querytree
...
...
@@ -478,8 +480,8 @@ resolvenew_in_jointree(Node *jtnode, int varno, List *subtlist)
*/
}
else
elog
(
ERROR
,
"
resolvenew_in_jointree: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
}
/*
...
...
@@ -524,7 +526,7 @@ reduce_outer_joins(Query *parse)
/* planner.c shouldn't have called me if no outer joins */
if
(
state
==
NULL
||
!
state
->
contains_outer
)
elog
(
ERROR
,
"
reduce_outer_joins:
so where are the outer joins?"
);
elog
(
ERROR
,
"so where are the outer joins?"
);
reduce_outer_joins_pass2
((
Node
*
)
parse
->
jointree
,
state
,
parse
,
NULL
);
}
...
...
@@ -591,8 +593,8 @@ reduce_outer_joins_pass1(Node *jtnode)
result
->
sub_states
=
lappend
(
result
->
sub_states
,
sub_state
);
}
else
elog
(
ERROR
,
"
reduce_outer_joins_pass1: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
result
;
}
...
...
@@ -615,10 +617,10 @@ reduce_outer_joins_pass2(Node *jtnode,
* because it's only called on subtrees marked as contains_outer.
*/
if
(
jtnode
==
NULL
)
elog
(
ERROR
,
"re
duce_outer_joins_pass2: re
ached empty jointree"
);
elog
(
ERROR
,
"reached empty jointree"
);
if
(
IsA
(
jtnode
,
RangeTblRef
))
{
elog
(
ERROR
,
"re
duce_outer_joins_pass2: re
ached base rel"
);
elog
(
ERROR
,
"reached base rel"
);
}
else
if
(
IsA
(
jtnode
,
FromExpr
))
{
...
...
@@ -735,8 +737,8 @@ reduce_outer_joins_pass2(Node *jtnode,
}
}
else
elog
(
ERROR
,
"
reduce_outer_joins_pass2: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
}
/*
...
...
@@ -972,8 +974,8 @@ simplify_jointree(Query *parse, Node *jtnode)
}
}
else
elog
(
ERROR
,
"
simplify_jointree: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
jtnode
;
}
...
...
@@ -1043,8 +1045,8 @@ get_relids_in_jointree(Node *jtnode)
result
=
bms_join
(
result
,
get_relids_in_jointree
(
j
->
rarg
));
}
else
elog
(
ERROR
,
"
get_relids_in_jointree: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
result
;
}
...
...
@@ -1061,7 +1063,7 @@ get_relids_for_join(Query *parse, int joinrelid)
jtnode
=
find_jointree_node_for_rel
((
Node
*
)
parse
->
jointree
,
joinrelid
);
if
(
!
jtnode
)
elog
(
ERROR
,
"
get_relids_for_join: join node %d not foun
d"
,
joinrelid
);
elog
(
ERROR
,
"
could not find join node %
d"
,
joinrelid
);
return
get_relids_in_jointree
(
jtnode
);
}
...
...
@@ -1108,7 +1110,7 @@ find_jointree_node_for_rel(Node *jtnode, int relid)
return
jtnode
;
}
else
elog
(
ERROR
,
"
find_jointree_node_for_rel: unexpected node type
%d"
,
nodeTag
(
jtnode
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
jtnode
));
return
NULL
;
}
src/backend/optimizer/prep/preptlist.c
View file @
45708f5e
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.6
1 2003/05/12 00:17:03
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.6
2 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -55,7 +55,7 @@ preprocess_targetlist(List *tlist,
RangeTblEntry
*
rte
=
rt_fetch
(
result_relation
,
range_table
);
if
(
rte
->
subquery
!=
NULL
||
rte
->
relid
==
InvalidOid
)
elog
(
ERROR
,
"
preprocess_targetlist:
subquery cannot be result relation"
);
elog
(
ERROR
,
"subquery cannot be result relation"
);
}
/*
...
...
@@ -236,7 +236,8 @@ expand_targetlist(List *tlist, int command_type,
}
break
;
default:
elog
(
ERROR
,
"expand_targetlist: unexpected command_type"
);
elog
(
ERROR
,
"unrecognized command_type: %d"
,
(
int
)
command_type
);
new_expr
=
NULL
;
/* keep compiler quiet */
break
;
}
...
...
@@ -266,7 +267,7 @@ expand_targetlist(List *tlist, int command_type,
Resdom
*
resdom
=
old_tle
->
resdom
;
if
(
!
resdom
->
resjunk
)
elog
(
ERROR
,
"
expand_targetlist:
targetlist is not sorted correctly"
);
elog
(
ERROR
,
"targetlist is not sorted correctly"
);
/* Get the resno right, but don't copy unnecessarily */
if
(
resdom
->
resno
!=
attrno
)
{
...
...
src/backend/optimizer/prep/prepunion.c
View file @
45708f5e
...
...
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.
99 2003/07/20 21:56:34
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.
100 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -195,7 +195,7 @@ recurse_set_operations(Node *setOp, Query *parse,
}
else
{
elog
(
ERROR
,
"
recurse_set_operations: unexpected node
%d"
,
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
setOp
));
return
NULL
;
/* keep compiler quiet */
}
...
...
@@ -312,7 +312,8 @@ generate_nonunion_plan(SetOperationStmt *op, Query *parse,
cmd
=
op
->
all
?
SETOPCMD_EXCEPT_ALL
:
SETOPCMD_EXCEPT
;
break
;
default:
elog
(
ERROR
,
"generate_nonunion_plan: bogus operation code"
);
elog
(
ERROR
,
"unrecognized set operation code: %d"
,
(
int
)
op
->
op
);
cmd
=
SETOPCMD_INTERSECT
;
/* keep compiler quiet */
break
;
}
...
...
src/backend/optimizer/util/clauses.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.14
6 2003/07/03 19:07:25
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.14
7 2003/07/25 00:01:08
tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -404,7 +404,9 @@ count_agg_clause_walker(Node *node, int *count)
* nested agg functions are semantically nonsensical.
*/
if
(
contain_agg_clause
((
Node
*
)
((
Aggref
*
)
node
)
->
target
))
elog
(
ERROR
,
"Aggregate function calls may not be nested"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_GROUPING_ERROR
),
errmsg
(
"aggregate function calls may not be nested"
)));
/*
* Having checked that, we need not recurse into the argument.
...
...
@@ -982,14 +984,15 @@ CommuteClause(OpExpr *clause)
Oid
opoid
;
Node
*
temp
;
/* Sanity checks: caller is at fault if these fail */
if
(
!
is_opclause
(
clause
)
||
length
(
clause
->
args
)
!=
2
)
elog
(
ERROR
,
"
CommuteClause: applied to
non-binary-operator clause"
);
elog
(
ERROR
,
"
cannot commute
non-binary-operator clause"
);
opoid
=
get_commutator
(
clause
->
opno
);
if
(
!
OidIsValid
(
opoid
))
elog
(
ERROR
,
"
CommuteClause: no
commutator for operator %u"
,
elog
(
ERROR
,
"
could not find
commutator for operator %u"
,
clause
->
opno
);
/*
...
...
@@ -1346,7 +1349,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
/* Else we still need a NOT node */
return
(
Node
*
)
make_notclause
(
lfirst
(
args
));
default:
elog
(
ERROR
,
"
eval_const_expressions: unexpected boolop
%d"
,
elog
(
ERROR
,
"
unrecognized boolop:
%d"
,
(
int
)
expr
->
boolop
);
break
;
}
...
...
@@ -1357,7 +1360,7 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
* Return a SubPlan unchanged --- too late to do anything
* with it.
*
* XXX should we e
log
() here instead? Probably this routine
* XXX should we e
report
() here instead? Probably this routine
* should never be invoked after SubPlan creation.
*/
return
node
;
...
...
@@ -1610,7 +1613,7 @@ simplify_function(Oid funcid, Oid result_type, List *args,
ObjectIdGetDatum
(
funcid
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
func_tuple
))
elog
(
ERROR
,
"
Function OID %u does not exist
"
,
funcid
);
elog
(
ERROR
,
"
cache lookup failed for function %u
"
,
funcid
);
newexpr
=
evaluate_function
(
funcid
,
result_type
,
args
,
func_tuple
);
...
...
@@ -1794,8 +1797,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
Anum_pg_proc_prosrc
,
&
isNull
);
if
(
isNull
)
elog
(
ERROR
,
"inline_function: null prosrc for procedure %u"
,
funcid
);
elog
(
ERROR
,
"null prosrc for function %u"
,
funcid
);
src
=
DatumGetCString
(
DirectFunctionCall1
(
textout
,
tmp
));
/*
...
...
@@ -1961,9 +1963,9 @@ substitute_actual_parameters_mutator(Node *node,
Param
*
param
=
(
Param
*
)
node
;
if
(
param
->
paramkind
!=
PARAM_NUM
)
elog
(
ERROR
,
"
substitute_actual_parameters_mutator: unexpected paramkind"
);
elog
(
ERROR
,
"
unexpected paramkind: %d"
,
param
->
paramkind
);
if
(
param
->
paramid
<=
0
||
param
->
paramid
>
context
->
nargs
)
elog
(
ERROR
,
"
substitute_actual_parameters_mutator: unexpected paramid"
);
elog
(
ERROR
,
"
invalid paramid: %d"
,
param
->
paramid
);
/* Count usage of parameter */
context
->
usecounts
[
param
->
paramid
-
1
]
++
;
...
...
@@ -2350,8 +2352,8 @@ expression_tree_walker(Node *node,
}
break
;
default:
elog
(
ERROR
,
"
expression_tree_walker: Unexpected node type
%d"
,
nodeTag
(
node
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
node
));
break
;
}
return
false
;
...
...
@@ -2816,8 +2818,8 @@ expression_tree_mutator(Node *node,
}
break
;
default:
elog
(
ERROR
,
"
expression_tree_mutator: Unexpected node type
%d"
,
nodeTag
(
node
));
elog
(
ERROR
,
"
unrecognized node type:
%d"
,
(
int
)
nodeTag
(
node
));
break
;
}
/* can't get here, but keep compiler happy */
...
...
src/backend/optimizer/util/pathnode.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.9
2 2003/07/14 22:35:54
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.9
3 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -133,7 +133,7 @@ set_cheapest(RelOptInfo *parent_rel)
Assert
(
IsA
(
parent_rel
,
RelOptInfo
));
if
(
pathlist
==
NIL
)
elog
(
ERROR
,
"
Unable to
devise a query plan for the given query"
);
elog
(
ERROR
,
"
could not
devise a query plan for the given query"
);
cheapest_startup_path
=
cheapest_total_path
=
(
Path
*
)
lfirst
(
pathlist
);
...
...
src/backend/optimizer/util/plancat.c
View file @
45708f5e
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.8
4 2003/06/29 23:05:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.8
5 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -258,7 +258,7 @@ restriction_selectivity(Query *root,
Int32GetDatum
(
varRelid
)));
if
(
result
<
0
.
0
||
result
>
1
.
0
)
elog
(
ERROR
,
"
restriction_selectivity: bad value
%f"
,
result
);
elog
(
ERROR
,
"
invalid restriction selectivity:
%f"
,
result
);
return
(
Selectivity
)
result
;
}
...
...
@@ -293,7 +293,7 @@ join_selectivity(Query *root,
Int16GetDatum
(
jointype
)));
if
(
result
<
0
.
0
||
result
>
1
.
0
)
elog
(
ERROR
,
"
join_selectivity: bad value
%f"
,
result
);
elog
(
ERROR
,
"
invalid join selectivity:
%f"
,
result
);
return
(
Selectivity
)
result
;
}
...
...
@@ -365,7 +365,7 @@ has_subclass(Oid relationId)
ObjectIdGetDatum
(
relationId
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
elog
(
ERROR
,
"
has_subclass: Relation %u not found
"
,
relationId
);
elog
(
ERROR
,
"
cache lookup failed for relation %u
"
,
relationId
);
result
=
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relhassubclass
;
ReleaseSysCache
(
tuple
);
...
...
src/backend/optimizer/util/relnode.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
49 2003/06/29 23:05:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
50 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -55,7 +55,7 @@ build_base_rel(Query *root, int relid)
{
rel
=
(
RelOptInfo
*
)
lfirst
(
rels
);
if
(
relid
==
rel
->
relid
)
elog
(
ERROR
,
"
build_base_rel:
rel already exists"
);
elog
(
ERROR
,
"rel already exists"
);
}
/* It should not exist as an "other" rel, either */
...
...
@@ -63,7 +63,7 @@ build_base_rel(Query *root, int relid)
{
rel
=
(
RelOptInfo
*
)
lfirst
(
rels
);
if
(
relid
==
rel
->
relid
)
elog
(
ERROR
,
"
build_base_rel: rel already exists as 'other'
rel"
);
elog
(
ERROR
,
"
rel already exists as
\"
other
\"
rel"
);
}
/* No existing RelOptInfo for this base rel, so make a new one */
...
...
@@ -98,7 +98,7 @@ build_other_rel(Query *root, int relid)
{
rel
=
(
RelOptInfo
*
)
lfirst
(
rels
);
if
(
relid
==
rel
->
relid
)
elog
(
ERROR
,
"
build_other_rel:
rel already exists as base rel"
);
elog
(
ERROR
,
"rel already exists as base rel"
);
}
/* No existing RelOptInfo for this other rel, so make a new one */
...
...
@@ -165,7 +165,7 @@ make_base_rel(Query *root, int relid)
rel
->
max_attr
=
length
(
rte
->
eref
->
colnames
);
break
;
default:
elog
(
ERROR
,
"
make_base_rel: unsupported RTE kind
%d"
,
elog
(
ERROR
,
"
unrecognized RTE kind:
%d"
,
(
int
)
rte
->
rtekind
);
break
;
}
...
...
@@ -211,7 +211,7 @@ find_base_rel(Query *root, int relid)
return
rel
;
}
elog
(
ERROR
,
"
find_base_rel:
no relation entry for relid %d"
,
relid
);
elog
(
ERROR
,
"no relation entry for relid %d"
,
relid
);
return
NULL
;
/* keep compiler quiet */
}
...
...
src/backend/optimizer/util/tlist.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.5
7 2003/06/29 23:05:05
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.5
8 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -183,7 +183,7 @@ get_sortgroupclause_tle(SortClause *sortClause,
return
tle
;
}
elog
(
ERROR
,
"
get_sortgroupclause_tle:
ORDER/GROUP BY expression not found in targetlist"
);
elog
(
ERROR
,
"ORDER/GROUP BY expression not found in targetlist"
);
return
NULL
;
/* keep compiler quiet */
}
...
...
src/backend/rewrite/rewriteDefine.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.8
2 2003/01/17 02:01:16
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.8
3 2003/07/25 00:01:08
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,6 +29,7 @@
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
...
...
@@ -97,8 +98,10 @@ InsertRule(char *rulname,
if
(
HeapTupleIsValid
(
oldtup
))
{
if
(
!
replace
)
elog
(
ERROR
,
"Attempt to insert rule
\"
%s
\"
failed: already exists"
,
rulname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_DUPLICATE_OBJECT
),
errmsg
(
"rule
\"
%s
\"
for relation
\"
%s
\"
already exists"
,
rulname
,
get_rel_name
(
eventrel_oid
))));
/*
* When replacing, we don't need to replace every attribute
...
...
@@ -224,11 +227,15 @@ DefineQueryRewrite(RuleStmt *stmt)
if
(
query
!=
getInsertSelectQuery
(
query
,
NULL
))
continue
;
if
(
query
->
resultRelation
==
PRS2_OLD_VARNO
)
elog
(
ERROR
,
"rule actions on OLD currently not supported"
"
\n\t
use views or triggers instead"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"rule actions on OLD are not implemented"
),
errhint
(
"Use views or triggers instead."
)));
if
(
query
->
resultRelation
==
PRS2_NEW_VARNO
)
elog
(
ERROR
,
"rule actions on NEW currently not supported"
"
\n\t
use triggers instead"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"rule actions on NEW are not implemented"
),
errhint
(
"Use triggers instead."
)));
}
/*
...
...
@@ -243,29 +250,35 @@ DefineQueryRewrite(RuleStmt *stmt)
* So there cannot be INSTEAD NOTHING, ...
*/
if
(
length
(
action
)
==
0
)
{
elog
(
ERROR
,
"instead nothing rules on select currently not supported"
"
\n\t
use views instead"
);
}
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"INSTEAD NOTHING rules on select are not implemented"
),
errhint
(
"Use views instead."
)));
/*
* ... there cannot be multiple actions, ...
*/
if
(
length
(
action
)
>
1
)
elog
(
ERROR
,
"multiple action rules on select currently not supported"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"multiple action rules on select are not implemented"
)));
/*
* ... the one action must be a SELECT, ...
*/
query
=
(
Query
*
)
lfirst
(
action
);
if
(
!
is_instead
||
query
->
commandType
!=
CMD_SELECT
)
elog
(
ERROR
,
"only instead-select rules currently supported on select"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"only instead-select rules are currently supported on select"
)));
/*
* ... there can be no rule qual, ...
*/
if
(
event_qual
!=
NULL
)
elog
(
ERROR
,
"event qualifications not supported for rules on select"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"event qualifications are not implemented for rules on select"
)));
/*
* ... the targetlist of the SELECT action must exactly match the
...
...
@@ -283,7 +296,9 @@ DefineQueryRewrite(RuleStmt *stmt)
continue
;
i
++
;
if
(
i
>
event_relation
->
rd_att
->
natts
)
elog
(
ERROR
,
"select rule's target list has too many entries"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"select rule's target list has too many entries"
)));
attr
=
event_relation
->
rd_att
->
attrs
[
i
-
1
];
attname
=
NameStr
(
attr
->
attname
);
...
...
@@ -297,13 +312,19 @@ DefineQueryRewrite(RuleStmt *stmt)
* positions.
*/
if
(
attr
->
attisdropped
)
elog
(
ERROR
,
"cannot convert relation containing dropped columns to view"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"cannot convert relation containing dropped columns to view"
)));
if
(
strcmp
(
resdom
->
resname
,
attname
)
!=
0
)
elog
(
ERROR
,
"select rule's target entry %d has different column name from %s"
,
i
,
attname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"select rule's target entry %d has different column name from
\"
%s
\"
"
,
i
,
attname
)));
if
(
attr
->
atttypid
!=
resdom
->
restype
)
elog
(
ERROR
,
"select rule's target entry %d has different type from attribute %s"
,
i
,
attname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"select rule's target entry %d has different type from attribute
\"
%s
\"
"
,
i
,
attname
)));
/*
* Allow typmods to be different only if one of them is -1,
...
...
@@ -314,11 +335,15 @@ DefineQueryRewrite(RuleStmt *stmt)
*/
if
(
attr
->
atttypmod
!=
resdom
->
restypmod
&&
attr
->
atttypmod
!=
-
1
&&
resdom
->
restypmod
!=
-
1
)
elog
(
ERROR
,
"select rule's target entry %d has different size from attribute %s"
,
i
,
attname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"select rule's target entry %d has different size from attribute
\"
%s
\"
"
,
i
,
attname
)));
}
if
(
i
!=
event_relation
->
rd_att
->
natts
)
elog
(
ERROR
,
"select rule's target list has too few entries"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"select rule's target list has too few entries"
)));
/*
* ... there must not be another ON SELECT rule already ...
...
...
@@ -331,8 +356,10 @@ DefineQueryRewrite(RuleStmt *stmt)
rule
=
event_relation
->
rd_rules
->
rules
[
i
];
if
(
rule
->
event
==
CMD_SELECT
)
elog
(
ERROR
,
"
\"
%s
\"
is already a view"
,
RelationGetRelationName
(
event_relation
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
),
errmsg
(
"
\"
%s
\"
is already a view"
,
RelationGetRelationName
(
event_relation
))));
}
}
...
...
@@ -353,8 +380,10 @@ DefineQueryRewrite(RuleStmt *stmt)
if
(
strncmp
(
stmt
->
rulename
,
"_RET"
,
4
)
!=
0
||
strncmp
(
stmt
->
rulename
+
4
,
event_obj
->
relname
,
NAMEDATALEN
-
4
-
4
)
!=
0
)
elog
(
ERROR
,
"view rule for
\"
%s
\"
must be named
\"
%s
\"
"
,
event_obj
->
relname
,
ViewSelectRuleName
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"view rule for
\"
%s
\"
must be named
\"
%s
\"
"
,
event_obj
->
relname
,
ViewSelectRuleName
)));
stmt
->
rulename
=
pstrdup
(
ViewSelectRuleName
);
}
...
...
@@ -370,8 +399,10 @@ DefineQueryRewrite(RuleStmt *stmt)
scanDesc
=
heap_beginscan
(
event_relation
,
SnapshotNow
,
0
,
NULL
);
if
(
heap_getnext
(
scanDesc
,
ForwardScanDirection
)
!=
NULL
)
elog
(
ERROR
,
"Relation
\"
%s
\"
is not empty. Cannot convert it to view"
,
event_obj
->
relname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
),
errmsg
(
"cannot convert non-empty table
\"
%s
\"
to a view"
,
event_obj
->
relname
)));
heap_endscan
(
scanDesc
);
RelisBecomingView
=
true
;
...
...
@@ -509,12 +540,17 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
PointerGetDatum
(
oldName
),
0
,
0
);
if
(
!
HeapTupleIsValid
(
ruletup
))
elog
(
ERROR
,
"RenameRewriteRule: rule
\"
%s
\"
does not exist"
,
oldName
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"rule
\"
%s
\"
for relation
\"
%s
\"
does not exist"
,
oldName
,
get_rel_name
(
owningRel
))));
/* should not already exist */
if
(
IsDefinedRewriteRule
(
owningRel
,
newName
))
elog
(
ERROR
,
"Attempt to rename rule
\"
%s
\"
failed:
\"
%s
\"
already exists"
,
oldName
,
newName
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_DUPLICATE_OBJECT
),
errmsg
(
"rule
\"
%s
\"
for relation
\"
%s
\"
already exists"
,
newName
,
get_rel_name
(
owningRel
))));
namestrcpy
(
&
(((
Form_pg_rewrite
)
GETSTRUCT
(
ruletup
))
->
rulename
),
newName
);
...
...
src/backend/rewrite/rewriteHandler.c
View file @
45708f5e
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.12
3 2003/07/16 17:25:4
8 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.12
4 2003/07/25 00:01:0
8 tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -168,7 +168,9 @@ rewriteRuleAction(Query *parsetree,
* member statements of the setop?)
*/
if
(
sub_action
->
setOperations
!=
NULL
)
elog
(
ERROR
,
"Conditional UNION/INTERSECT/EXCEPT statements are not implemented"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"conditional UNION/INTERSECT/EXCEPT statements are not implemented"
)));
sub_action
->
jointree
->
fromlist
=
nconc
(
newjointree
,
sub_action
->
jointree
->
fromlist
);
...
...
@@ -407,8 +409,7 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
{
/* Let's just make sure we processed all the non-junk items */
if
(
resdom
->
resno
<
1
||
resdom
->
resno
>
numattrs
)
elog
(
ERROR
,
"rewriteTargetList: bogus resno %d in targetlist"
,
resdom
->
resno
);
elog
(
ERROR
,
"bogus resno %d in targetlist"
,
resdom
->
resno
);
}
}
...
...
@@ -449,8 +450,10 @@ process_matched_tle(TargetEntry *src_tle,
((
ArrayRef
*
)
prior_tle
->
expr
)
->
refassgnexpr
==
NULL
||
((
ArrayRef
*
)
src_tle
->
expr
)
->
refrestype
!=
((
ArrayRef
*
)
prior_tle
->
expr
)
->
refrestype
)
elog
(
ERROR
,
"Multiple assignments to same attribute
\"
%s
\"
"
,
resdom
->
resname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"multiple assignments to same attribute
\"
%s
\"
"
,
resdom
->
resname
)));
/*
* Prior TLE could be a nest of ArrayRefs if we do this more than
...
...
@@ -461,8 +464,10 @@ process_matched_tle(TargetEntry *src_tle,
((
ArrayRef
*
)
priorbottom
)
->
refassgnexpr
!=
NULL
)
priorbottom
=
(
Node
*
)
((
ArrayRef
*
)
priorbottom
)
->
refexpr
;
if
(
!
equal
(
priorbottom
,
((
ArrayRef
*
)
src_tle
->
expr
)
->
refexpr
))
elog
(
ERROR
,
"Multiple assignments to same attribute
\"
%s
\"
"
,
resdom
->
resname
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"multiple assignments to same attribute
\"
%s
\"
"
,
resdom
->
resname
)));
/*
* Looks OK to nest 'em.
...
...
@@ -550,12 +555,14 @@ build_column_default(Relation rel, int attrno)
* type when it was created ...
*/
if
(
expr
==
NULL
)
elog
(
ERROR
,
"Column
\"
%s
\"
is of type %s"
" but default expression is of type %s"
"
\n\t
You will need to rewrite or cast the expression"
,
NameStr
(
att_tup
->
attname
),
format_type_be
(
atttype
),
format_type_be
(
exprtype
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_DATATYPE_MISMATCH
),
errmsg
(
"column
\"
%s
\"
is of type %s"
" but default expression is of type %s"
,
NameStr
(
att_tup
->
attname
),
format_type_be
(
atttype
),
format_type_be
(
exprtype
)),
errhint
(
"You will need to rewrite or cast the expression."
)));
return
expr
;
}
...
...
@@ -619,11 +626,11 @@ ApplyRetrieveRule(Query *parsetree,
*
subrte
;
if
(
length
(
rule
->
actions
)
!=
1
)
elog
(
ERROR
,
"
ApplyRetrieveRule:
expected just one rule action"
);
elog
(
ERROR
,
"expected just one rule action"
);
if
(
rule
->
qual
!=
NULL
)
elog
(
ERROR
,
"
ApplyRetrieveRule: can'
t handle qualified ON SELECT rule"
);
elog
(
ERROR
,
"
canno
t handle qualified ON SELECT rule"
);
if
(
!
relation_level
)
elog
(
ERROR
,
"
ApplyRetrieveRule: can'
t handle per-attribute ON SELECT rule"
);
elog
(
ERROR
,
"
canno
t handle per-attribute ON SELECT rule"
);
/*
* Make a modifiable copy of the view query, and recursively expand
...
...
@@ -872,8 +879,10 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
List
*
l
;
if
(
oidMember
(
RelationGetRelid
(
rel
),
activeRIRs
))
elog
(
ERROR
,
"Infinite recursion detected in rules for relation %s"
,
RelationGetRelationName
(
rel
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"infinite recursion detected in rules for relation
\"
%s
\"
"
,
RelationGetRelationName
(
rel
))));
newActiveRIRs
=
lconso
(
RelationGetRelid
(
rel
),
activeRIRs
);
foreach
(
l
,
locks
)
...
...
@@ -913,7 +922,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
parsetree
->
hasAggs
=
checkExprHasAggs
((
Node
*
)
parsetree
);
if
(
parsetree
->
hasAggs
)
if
(
checkExprHasAggs
((
Node
*
)
parsetree
->
jointree
))
elog
(
ERROR
,
"f
ireRIRrules: failed to remove agg
s from qual"
);
elog
(
ERROR
,
"f
ailed to remove aggregate
s from qual"
);
}
if
(
parsetree
->
hasSubLinks
)
parsetree
->
hasSubLinks
=
checkExprHasSubLink
((
Node
*
)
parsetree
);
...
...
@@ -1151,8 +1160,10 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
rev
=
(
rewrite_event
*
)
lfirst
(
n
);
if
(
rev
->
relation
==
RelationGetRelid
(
rt_entry_relation
)
&&
rev
->
event
==
event
)
elog
(
ERROR
,
"Infinite recursion detected in rules for relation %s"
,
RelationGetRelationName
(
rt_entry_relation
));
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_OBJECT_DEFINITION
),
errmsg
(
"infinite recursion detected in rules for relation
\"
%s
\"
"
,
RelationGetRelationName
(
rt_entry_relation
))));
}
rev
=
(
rewrite_event
*
)
palloc
(
sizeof
(
rewrite_event
));
...
...
@@ -1259,19 +1270,25 @@ QueryRewrite(Query *parsetree)
switch
(
query
->
commandType
)
{
case
CMD_INSERT
:
elog
(
ERROR
,
"Cannot insert into a view"
"
\n\t
You need an unconditional ON INSERT DO INSTEAD rule"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"cannot insert into a view"
),
errhint
(
"You need an unconditional ON INSERT DO INSTEAD rule."
)));
break
;
case
CMD_UPDATE
:
elog
(
ERROR
,
"Cannot update a view"
"
\n\t
You need an unconditional ON UPDATE DO INSTEAD rule"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"cannot update a view"
),
errhint
(
"You need an unconditional ON UPDATE DO INSTEAD rule."
)));
break
;
case
CMD_DELETE
:
elog
(
ERROR
,
"Cannot delete from a view"
"
\n\t
You need an unconditional ON DELETE DO INSTEAD rule"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"cannot delete from a view"
),
errhint
(
"You need an unconditional ON DELETE DO INSTEAD rule."
)));
break
;
default:
elog
(
ERROR
,
"
QueryRewrite: unexpected commandType
%d"
,
elog
(
ERROR
,
"
unrecognized commandType:
%d"
,
(
int
)
query
->
commandType
);
break
;
}
...
...
src/backend/rewrite/rewriteManip.c
View file @
45708f5e
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.7
3 2003/07/16 17:25:48
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.7
4 2003/07/25 00:01:09
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -678,14 +678,14 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
return
parsetree
;
Assert
(
parsetree
->
jointree
&&
IsA
(
parsetree
->
jointree
,
FromExpr
));
if
(
length
(
parsetree
->
jointree
->
fromlist
)
!=
1
)
elog
(
ERROR
,
"
getInsertSelectQuery:
expected to find SELECT subquery"
);
elog
(
ERROR
,
"expected to find SELECT subquery"
);
rtr
=
(
RangeTblRef
*
)
lfirst
(
parsetree
->
jointree
->
fromlist
);
Assert
(
IsA
(
rtr
,
RangeTblRef
));
selectrte
=
rt_fetch
(
rtr
->
rtindex
,
parsetree
->
rtable
);
selectquery
=
selectrte
->
subquery
;
if
(
!
(
selectquery
&&
IsA
(
selectquery
,
Query
)
&&
selectquery
->
commandType
==
CMD_SELECT
))
elog
(
ERROR
,
"
getInsertSelectQuery:
expected to find SELECT subquery"
);
elog
(
ERROR
,
"expected to find SELECT subquery"
);
if
(
length
(
selectquery
->
rtable
)
>=
2
&&
strcmp
(
rt_fetch
(
PRS2_OLD_VARNO
,
selectquery
->
rtable
)
->
eref
->
aliasname
,
"*OLD*"
)
==
0
&&
...
...
@@ -696,7 +696,7 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
*
subquery_ptr
=
&
(
selectrte
->
subquery
);
return
selectquery
;
}
elog
(
ERROR
,
"
getInsertSelectQuery: can'
t find rule placeholders"
);
elog
(
ERROR
,
"
could no
t find rule placeholders"
);
return
NULL
;
/* not reached */
}
...
...
@@ -730,7 +730,9 @@ AddQual(Query *parsetree, Node *qual)
if
(
parsetree
->
utilityStmt
&&
IsA
(
parsetree
->
utilityStmt
,
NotifyStmt
))
return
;
else
elog
(
ERROR
,
"Conditional utility statements are not implemented"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"conditional utility statements are not implemented"
)));
}
if
(
parsetree
->
setOperations
!=
NULL
)
...
...
@@ -740,7 +742,9 @@ AddQual(Query *parsetree, Node *qual)
* (This could be fixed, but right now the planner simply ignores
* any qual condition on a setop query.)
*/
elog
(
ERROR
,
"Conditional UNION/INTERSECT/EXCEPT statements are not implemented"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"conditional UNION/INTERSECT/EXCEPT statements are not implemented"
)));
}
/* INTERSECT want's the original, but we need to copy - Jan */
...
...
@@ -780,7 +784,9 @@ AddHavingQual(Query *parsetree, Node *havingQual)
if
(
parsetree
->
utilityStmt
&&
IsA
(
parsetree
->
utilityStmt
,
NotifyStmt
))
return
;
else
elog
(
ERROR
,
"Conditional utility statements are not implemented"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"conditional utility statements are not implemented"
)));
}
if
(
parsetree
->
setOperations
!=
NULL
)
...
...
@@ -790,7 +796,9 @@ AddHavingQual(Query *parsetree, Node *havingQual)
* (This could be fixed, but right now the planner simply ignores
* any qual condition on a setop query.)
*/
elog
(
ERROR
,
"Conditional UNION/INTERSECT/EXCEPT statements are not implemented"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"conditional UNION/INTERSECT/EXCEPT statements are not implemented"
)));
}
/* INTERSECT want's the original, but we need to copy - Jan */
...
...
@@ -905,7 +913,9 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
/* band-aid: don't do the wrong thing with a whole-tuple Var */
if
(
var
->
varattno
==
InvalidAttrNumber
)
elog
(
ERROR
,
"ResolveNew: can't handle whole-tuple reference"
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"cannot handle whole-tuple reference"
)));
n
=
FindMatchingNew
(
context
->
targetlist
,
var
->
varattno
);
...
...
src/backend/rewrite/rewriteRemove.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.5
3 2002/09/04 20:31:25 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.5
4 2003/07/25 00:01:09 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -54,7 +54,10 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName, DropBehavior behavior)
* complain if no rule with such name exists
*/
if
(
!
HeapTupleIsValid
(
tuple
))
elog
(
ERROR
,
"Rule
\"
%s
\"
not found"
,
ruleName
);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"rule
\"
%s
\"
for relation
\"
%s
\"
does not exist"
,
ruleName
,
get_rel_name
(
owningRel
))));
/*
* Verify user has appropriate permissions.
...
...
@@ -110,8 +113,7 @@ RemoveRewriteRuleById(Oid ruleOid)
tuple
=
systable_getnext
(
rcscan
);
if
(
!
HeapTupleIsValid
(
tuple
))
elog
(
ERROR
,
"RemoveRewriteRuleById: Rule %u does not exist"
,
ruleOid
);
elog
(
ERROR
,
"could not find tuple for rule %u"
,
ruleOid
);
/*
* We had better grab AccessExclusiveLock so that we know no other
...
...
src/backend/rewrite/rewriteSupport.c
View file @
45708f5e
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.5
4 2002/08/05 03:29:17
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.5
5 2003/07/25 00:01:09
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -65,7 +65,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
ObjectIdGetDatum
(
relationId
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
elog
(
ERROR
,
"
SetRelationRuleStatus:
cache lookup failed for relation %u"
,
relationId
);
elog
(
ERROR
,
"cache lookup failed for relation %u"
,
relationId
);
classForm
=
(
Form_pg_class
)
GETSTRUCT
(
tuple
);
if
(
classForm
->
relhasrules
!=
relHasRules
||
...
...
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