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
75586cb5
Commit
75586cb5
authored
Jul 17, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow non-cachable functions in functional indexes and in index
predicates. Per suggestion from Hiroshi.
parent
84a36344
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+24
-2
No files found.
src/backend/commands/indexcmds.c
View file @
75586cb5
/*-------------------------------------------------------------------------
*
* indexcmds.c
* POSTGRES define
, extend
and remove index code.
* POSTGRES define and remove index code.
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.5
2 2001/07/16 05:06:57
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.5
3 2001/07/17 21:53:01
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -39,8 +39,10 @@
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#define IsFuncIndex(ATTR_LIST) (((IndexElem*)lfirst(ATTR_LIST))->args != NIL)
/* non-export function prototypes */
...
...
@@ -232,10 +234,21 @@ CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid)
elog
(
ERROR
,
"Partial-index predicates may refer only to the base relation"
);
/*
* We don't currently support generation of an actual query plan for a
* predicate, only simple scalar expressions; hence these restrictions.
*/
if
(
contain_subplans
((
Node
*
)
predList
))
elog
(
ERROR
,
"Cannot use subselect in index predicate"
);
if
(
contain_agg_clause
((
Node
*
)
predList
))
elog
(
ERROR
,
"Cannot use aggregate in index predicate"
);
/*
* A predicate using noncachable functions is probably wrong, for the
* same reasons that we don't allow a functional index to use one.
*/
if
(
contain_noncachable_functions
((
Node
*
)
predList
))
elog
(
ERROR
,
"Cannot use non-cachable function in index predicate"
);
}
...
...
@@ -308,6 +321,15 @@ FuncIndexArgs(IndexInfo *indexInfo,
"Index function must be binary-compatible with table datatype"
);
}
/*
* Require that the function be marked cachable. Using a noncachable
* function for a functional index is highly questionable, since if you
* aren't going to get the same result for the same data every time,
* it's not clear what the index entries mean at all.
*/
if
(
!
func_iscachable
(
funcid
))
elog
(
ERROR
,
"DefineIndex: index function must be marked iscachable"
);
/* Process opclass, using func return type as default type */
classOidP
[
0
]
=
GetAttrOpClass
(
funcIndex
,
rettype
,
...
...
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