mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Tsearch2 functionality migrates to core. The bulk of this work is by
Oleg Bartunov and Teodor Sigaev, but I did a lot of editorializing, so anything that's broken is probably my fault. Documentation is nonexistent as yet, but let's land the patch so we can get some portability testing done.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
# Makefile for backend/commands
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.36 2007/04/26 16:13:09 neilc Exp $
|
||||
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.37 2007/08/21 01:11:14 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -18,7 +18,8 @@ OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
|
||||
indexcmds.o lockcmds.o operatorcmds.o opclasscmds.o \
|
||||
portalcmds.o prepare.o proclang.o \
|
||||
schemacmds.o sequence.o tablecmds.o tablespace.o trigger.o \
|
||||
typecmds.o user.o vacuum.o vacuumlazy.o variable.o view.o
|
||||
tsearchcmds.o typecmds.o user.o vacuum.o vacuumlazy.o \
|
||||
variable.o view.o
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.24 2007/07/03 01:30:36 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.25 2007/08/21 01:11:14 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -138,6 +138,22 @@ ExecRenameStmt(RenameStmt *stmt)
|
||||
break;
|
||||
}
|
||||
|
||||
case OBJECT_TSPARSER:
|
||||
RenameTSParser(stmt->object, stmt->newname);
|
||||
break;
|
||||
|
||||
case OBJECT_TSDICTIONARY:
|
||||
RenameTSDictionary(stmt->object, stmt->newname);
|
||||
break;
|
||||
|
||||
case OBJECT_TSTEMPLATE:
|
||||
RenameTSTemplate(stmt->object, stmt->newname);
|
||||
break;
|
||||
|
||||
case OBJECT_TSCONFIGURATION:
|
||||
RenameTSConfiguration(stmt->object, stmt->newname);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "unrecognized rename stmt type: %d",
|
||||
(int) stmt->renameType);
|
||||
@ -240,6 +256,14 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
|
||||
AlterTypeOwner(stmt->object, newowner);
|
||||
break;
|
||||
|
||||
case OBJECT_TSDICTIONARY:
|
||||
AlterTSDictionaryOwner(stmt->object, newowner);
|
||||
break;
|
||||
|
||||
case OBJECT_TSCONFIGURATION:
|
||||
AlterTSConfigurationOwner(stmt->object, newowner);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "unrecognized AlterOwnerStmt type: %d",
|
||||
(int) stmt->objectType);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.96 2007/02/01 19:10:25 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.97 2007/08/21 01:11:14 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,6 +34,10 @@
|
||||
#include "catalog/pg_shdescription.h"
|
||||
#include "catalog/pg_tablespace.h"
|
||||
#include "catalog/pg_trigger.h"
|
||||
#include "catalog/pg_ts_config.h"
|
||||
#include "catalog/pg_ts_dict.h"
|
||||
#include "catalog/pg_ts_parser.h"
|
||||
#include "catalog/pg_ts_template.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/comment.h"
|
||||
#include "commands/dbcommands.h"
|
||||
@ -78,6 +82,10 @@ static void CommentLargeObject(List *qualname, char *comment);
|
||||
static void CommentCast(List *qualname, List *arguments, char *comment);
|
||||
static void CommentTablespace(List *qualname, char *comment);
|
||||
static void CommentRole(List *qualname, char *comment);
|
||||
static void CommentTSParser(List *qualname, char *comment);
|
||||
static void CommentTSDictionary(List *qualname, char *comment);
|
||||
static void CommentTSTemplate(List *qualname, char *comment);
|
||||
static void CommentTSConfiguration(List *qualname, char *comment);
|
||||
|
||||
|
||||
/*
|
||||
@ -151,6 +159,18 @@ CommentObject(CommentStmt *stmt)
|
||||
case OBJECT_ROLE:
|
||||
CommentRole(stmt->objname, stmt->comment);
|
||||
break;
|
||||
case OBJECT_TSPARSER:
|
||||
CommentTSParser(stmt->objname, stmt->comment);
|
||||
break;
|
||||
case OBJECT_TSDICTIONARY:
|
||||
CommentTSDictionary(stmt->objname, stmt->comment);
|
||||
break;
|
||||
case OBJECT_TSTEMPLATE:
|
||||
CommentTSTemplate(stmt->objname, stmt->comment);
|
||||
break;
|
||||
case OBJECT_TSCONFIGURATION:
|
||||
CommentTSConfiguration(stmt->objname, stmt->comment);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized object type: %d",
|
||||
(int) stmt->objtype);
|
||||
@ -1462,3 +1482,61 @@ CommentCast(List *qualname, List *arguments, char *comment)
|
||||
/* Call CreateComments() to create/drop the comments */
|
||||
CreateComments(castOid, CastRelationId, 0, comment);
|
||||
}
|
||||
|
||||
static void
|
||||
CommentTSParser(List *qualname, char *comment)
|
||||
{
|
||||
Oid prsId;
|
||||
|
||||
prsId = TSParserGetPrsid(qualname, false);
|
||||
|
||||
if (!superuser())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("must be superuser to comment on text search parser")));
|
||||
|
||||
CreateComments(prsId, TSParserRelationId, 0, comment);
|
||||
}
|
||||
|
||||
static void
|
||||
CommentTSDictionary(List *qualname, char *comment)
|
||||
{
|
||||
Oid dictId;
|
||||
|
||||
dictId = TSDictionaryGetDictid(qualname, false);
|
||||
|
||||
if (!pg_ts_dict_ownercheck(dictId, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY,
|
||||
NameListToString(qualname));
|
||||
|
||||
CreateComments(dictId, TSDictionaryRelationId, 0, comment);
|
||||
}
|
||||
|
||||
static void
|
||||
CommentTSTemplate(List *qualname, char *comment)
|
||||
{
|
||||
Oid tmplId;
|
||||
|
||||
tmplId = TSTemplateGetTmplid(qualname, false);
|
||||
|
||||
if (!superuser())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("must be superuser to comment on text search template")));
|
||||
|
||||
CreateComments(tmplId, TSTemplateRelationId, 0, comment);
|
||||
}
|
||||
|
||||
static void
|
||||
CommentTSConfiguration(List *qualname, char *comment)
|
||||
{
|
||||
Oid cfgId;
|
||||
|
||||
cfgId = TSConfigGetCfgid(qualname, false);
|
||||
|
||||
if (!pg_ts_config_ownercheck(cfgId, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION,
|
||||
NameListToString(qualname));
|
||||
|
||||
CreateComments(cfgId, TSConfigRelationId, 0, comment);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.230 2007/07/17 05:02:00 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.231 2007/08/21 01:11:14 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -5079,8 +5079,13 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
|
||||
case OCLASS_LANGUAGE:
|
||||
case OCLASS_OPERATOR:
|
||||
case OCLASS_OPCLASS:
|
||||
case OCLASS_OPFAMILY:
|
||||
case OCLASS_TRIGGER:
|
||||
case OCLASS_SCHEMA:
|
||||
case OCLASS_TSPARSER:
|
||||
case OCLASS_TSDICT:
|
||||
case OCLASS_TSTEMPLATE:
|
||||
case OCLASS_TSCONFIG:
|
||||
|
||||
/*
|
||||
* We don't expect any of these sorts of objects to depend on
|
||||
|
1948
src/backend/commands/tsearchcmds.c
Normal file
1948
src/backend/commands/tsearchcmds.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user