2002-03-26 20:17:02 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* namespace.h
|
|
|
|
* prototypes for functions in backend/catalog/namespace.c
|
|
|
|
*
|
|
|
|
*
|
2011-01-01 19:18:15 +01:00
|
|
|
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
|
2002-03-26 20:17:02 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/catalog/namespace.h
|
2002-03-26 20:17:02 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef NAMESPACE_H
|
|
|
|
#define NAMESPACE_H
|
|
|
|
|
|
|
|
#include "nodes/primnodes.h"
|
2011-07-09 04:19:30 +02:00
|
|
|
#include "storage/lock.h"
|
2002-03-26 20:17:02 +01:00
|
|
|
|
|
|
|
|
2002-04-06 08:59:25 +02:00
|
|
|
/*
|
|
|
|
* This structure holds a list of possible functions or operators
|
2002-09-04 22:31:48 +02:00
|
|
|
* found by namespace lookup. Each function/operator is identified
|
2002-04-06 08:59:25 +02:00
|
|
|
* by OID and by argument types; the list must be pruned by type
|
|
|
|
* resolution rules that are embodied in the parser, not here.
|
2008-12-18 19:20:35 +01:00
|
|
|
* See FuncnameGetCandidates's comments for more info.
|
2002-04-06 08:59:25 +02:00
|
|
|
*/
|
|
|
|
typedef struct _FuncCandidateList
|
|
|
|
{
|
|
|
|
struct _FuncCandidateList *next;
|
|
|
|
int pathpos; /* for internal use of namespace lookup */
|
|
|
|
Oid oid; /* the function or operator's OID */
|
2002-04-25 04:56:56 +02:00
|
|
|
int nargs; /* number of arg types returned */
|
2008-07-16 03:30:23 +02:00
|
|
|
int nvargs; /* number of args to become variadic array */
|
2008-12-18 19:20:35 +01:00
|
|
|
int ndargs; /* number of defaulted args */
|
2009-10-08 04:39:25 +02:00
|
|
|
int *argnumbers; /* args' positional indexes, if named call */
|
2002-04-06 08:59:25 +02:00
|
|
|
Oid args[1]; /* arg types --- VARIABLE LENGTH ARRAY */
|
2007-11-15 22:14:46 +01:00
|
|
|
} *FuncCandidateList; /* VARIABLE LENGTH STRUCT */
|
2002-04-06 08:59:25 +02:00
|
|
|
|
2007-03-23 20:53:52 +01:00
|
|
|
/*
|
|
|
|
* Structure for xxxOverrideSearchPath functions
|
|
|
|
*/
|
|
|
|
typedef struct OverrideSearchPath
|
|
|
|
{
|
|
|
|
List *schemas; /* OIDs of explicitly named schemas */
|
|
|
|
bool addCatalog; /* implicitly prepend pg_catalog? */
|
|
|
|
bool addTemp; /* implicitly prepend temp schema? */
|
2007-11-15 23:25:18 +01:00
|
|
|
} OverrideSearchPath;
|
2007-03-23 20:53:52 +01:00
|
|
|
|
2002-04-06 08:59:25 +02:00
|
|
|
|
2011-07-09 04:19:30 +02:00
|
|
|
extern Oid RangeVarGetRelid(const RangeVar *relation, LOCKMODE lockmode,
|
|
|
|
bool missing_ok, bool nowait);
|
2002-03-26 20:17:02 +01:00
|
|
|
extern Oid RangeVarGetCreationNamespace(const RangeVar *newRelation);
|
2011-04-25 22:55:11 +02:00
|
|
|
extern Oid RangeVarGetAndCheckCreationNamespace(const RangeVar *newRelation);
|
Fix bugs in relpersistence handling during table creation.
Unlike the relistemp field which it replaced, relpersistence must be
set correctly quite early during the table creation process, as we
rely on it quite early on for a number of purposes, including security
checks. Normally, this is set based on whether the user enters CREATE
TABLE, CREATE UNLOGGED TABLE, or CREATE TEMPORARY TABLE, but a
relation may also be made implicitly temporary by creating it in
pg_temp. This patch fixes the handling of that case, and also
disables creation of unlogged tables in temporary tablespace (such
table indeed skip WAL-logging, but we reject an explicit
specification) and creation of relations in the temporary schemas of
other sessions (which is not very sensible, and didn't work right
anyway).
Report by Amit Khandekar.
2011-07-03 23:34:47 +02:00
|
|
|
extern void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid);
|
2002-03-26 20:17:02 +01:00
|
|
|
extern Oid RelnameGetRelid(const char *relname);
|
2002-05-02 01:06:41 +02:00
|
|
|
extern bool RelationIsVisible(Oid relid);
|
2002-03-26 20:17:02 +01:00
|
|
|
|
2002-03-30 02:02:42 +01:00
|
|
|
extern Oid TypenameGetTypid(const char *typname);
|
2002-05-02 01:06:41 +02:00
|
|
|
extern bool TypeIsVisible(Oid typid);
|
2002-04-17 22:57:57 +02:00
|
|
|
|
2009-10-08 04:39:25 +02:00
|
|
|
extern FuncCandidateList FuncnameGetCandidates(List *names,
|
|
|
|
int nargs, List *argnames,
|
2009-06-11 16:49:15 +02:00
|
|
|
bool expand_variadic,
|
|
|
|
bool expand_defaults);
|
2002-05-02 01:06:41 +02:00
|
|
|
extern bool FunctionIsVisible(Oid funcid);
|
2002-04-06 08:59:25 +02:00
|
|
|
|
2006-05-02 01:22:43 +02:00
|
|
|
extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright);
|
2002-04-17 01:08:12 +02:00
|
|
|
extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind);
|
2002-05-02 01:06:41 +02:00
|
|
|
extern bool OperatorIsVisible(Oid oprid);
|
2002-04-17 01:08:12 +02:00
|
|
|
|
2002-05-02 01:06:41 +02:00
|
|
|
extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname);
|
|
|
|
extern bool OpclassIsVisible(Oid opcid);
|
2003-01-07 21:56:07 +01:00
|
|
|
|
2006-12-23 01:43:13 +01:00
|
|
|
extern Oid OpfamilynameGetOpfid(Oid amid, const char *opfname);
|
|
|
|
extern bool OpfamilyIsVisible(Oid opfid);
|
|
|
|
|
2011-02-08 22:04:18 +01:00
|
|
|
extern Oid CollationGetCollid(const char *collname);
|
|
|
|
extern bool CollationIsVisible(Oid collid);
|
|
|
|
|
2002-12-12 22:02:25 +01:00
|
|
|
extern Oid ConversionGetConid(const char *conname);
|
2003-01-07 21:56:07 +01:00
|
|
|
extern bool ConversionIsVisible(Oid conid);
|
2002-04-17 22:57:57 +02:00
|
|
|
|
2010-08-05 17:25:36 +02:00
|
|
|
extern Oid get_ts_parser_oid(List *names, bool missing_ok);
|
2007-08-21 03:11:32 +02:00
|
|
|
extern bool TSParserIsVisible(Oid prsId);
|
|
|
|
|
2010-08-05 17:25:36 +02:00
|
|
|
extern Oid get_ts_dict_oid(List *names, bool missing_ok);
|
2007-08-21 03:11:32 +02:00
|
|
|
extern bool TSDictionaryIsVisible(Oid dictId);
|
|
|
|
|
2010-08-05 17:25:36 +02:00
|
|
|
extern Oid get_ts_template_oid(List *names, bool missing_ok);
|
2007-08-21 03:11:32 +02:00
|
|
|
extern bool TSTemplateIsVisible(Oid tmplId);
|
|
|
|
|
2010-08-05 17:25:36 +02:00
|
|
|
extern Oid get_ts_config_oid(List *names, bool missing_ok);
|
2007-08-21 03:11:32 +02:00
|
|
|
extern bool TSConfigIsVisible(Oid cfgid);
|
|
|
|
|
2002-07-30 01:46:35 +02:00
|
|
|
extern void DeconstructQualifiedName(List *names,
|
2002-09-04 22:31:48 +02:00
|
|
|
char **nspname_p,
|
|
|
|
char **objname_p);
|
2009-10-31 02:41:31 +01:00
|
|
|
extern Oid LookupNamespaceNoError(const char *nspname);
|
2002-08-08 03:44:31 +02:00
|
|
|
extern Oid LookupExplicitNamespace(const char *nspname);
|
2010-08-05 16:45:09 +02:00
|
|
|
extern Oid get_namespace_oid(const char *nspname, bool missing_ok);
|
2002-07-30 01:46:35 +02:00
|
|
|
|
2005-08-01 06:03:59 +02:00
|
|
|
extern Oid LookupCreationNamespace(const char *nspname);
|
2010-11-23 01:46:15 +01:00
|
|
|
extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid, Oid classid,
|
2011-04-10 17:42:00 +02:00
|
|
|
Oid objid);
|
2002-03-29 20:06:29 +01:00
|
|
|
extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
|
|
|
|
extern RangeVar *makeRangeVarFromNameList(List *names);
|
2002-04-09 22:35:55 +02:00
|
|
|
extern char *NameListToString(List *names);
|
2002-11-02 19:41:22 +01:00
|
|
|
extern char *NameListToQuotedString(List *names);
|
2002-04-09 22:35:55 +02:00
|
|
|
|
2002-03-31 08:26:32 +02:00
|
|
|
extern bool isTempNamespace(Oid namespaceId);
|
2007-07-26 00:16:18 +02:00
|
|
|
extern bool isTempToastNamespace(Oid namespaceId);
|
|
|
|
extern bool isTempOrToastNamespace(Oid namespaceId);
|
2005-08-01 06:03:59 +02:00
|
|
|
extern bool isAnyTempNamespace(Oid namespaceId);
|
2002-09-23 22:43:41 +02:00
|
|
|
extern bool isOtherTempNamespace(Oid namespaceId);
|
2008-07-01 04:09:34 +02:00
|
|
|
extern int GetTempNamespaceBackendId(Oid namespaceId);
|
2007-07-26 00:16:18 +02:00
|
|
|
extern Oid GetTempToastNamespace(void);
|
2007-04-13 00:34:45 +02:00
|
|
|
extern void ResetTempTableNamespace(void);
|
2002-03-31 08:26:32 +02:00
|
|
|
|
2007-03-23 20:53:52 +01:00
|
|
|
extern OverrideSearchPath *GetOverrideSearchPath(MemoryContext context);
|
2011-09-16 06:42:53 +02:00
|
|
|
extern OverrideSearchPath *CopyOverrideSearchPath(OverrideSearchPath *path);
|
2007-11-15 23:25:18 +01:00
|
|
|
extern void PushOverrideSearchPath(OverrideSearchPath *newpath);
|
2007-03-23 20:53:52 +01:00
|
|
|
extern void PopOverrideSearchPath(void);
|
2002-05-17 22:53:33 +02:00
|
|
|
|
2011-02-08 22:04:18 +01:00
|
|
|
extern Oid get_collation_oid(List *collname, bool missing_ok);
|
2010-08-05 17:25:36 +02:00
|
|
|
extern Oid get_conversion_oid(List *conname, bool missing_ok);
|
2002-09-04 22:31:48 +02:00
|
|
|
extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
|
2002-07-16 08:58:14 +02:00
|
|
|
|
2002-05-17 22:53:33 +02:00
|
|
|
/* initialization & transaction cleanup code */
|
|
|
|
extern void InitializeSearchPath(void);
|
|
|
|
extern void AtEOXact_Namespace(bool isCommit);
|
2004-09-16 18:58:44 +02:00
|
|
|
extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
|
2005-10-15 04:49:52 +02:00
|
|
|
SubTransactionId parentSubid);
|
2002-05-17 22:53:33 +02:00
|
|
|
|
2002-04-01 05:34:27 +02:00
|
|
|
/* stuff for search_path GUC variable */
|
|
|
|
extern char *namespace_search_path;
|
|
|
|
|
2002-05-17 22:53:33 +02:00
|
|
|
extern List *fetch_search_path(bool includeImplicit);
|
2007-11-28 19:47:56 +01:00
|
|
|
extern int fetch_search_path_array(Oid *sarray, int sarray_len);
|
2002-04-26 03:24:08 +02:00
|
|
|
|
2002-03-26 20:17:02 +01:00
|
|
|
#endif /* NAMESPACE_H */
|