~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/backend/commands/tsearchcmds.c

Tags: upstream-8.4.0
ImportĀ upstreamĀ versionĀ 8.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 *
10
10
 *
11
11
 * IDENTIFICATION
12
 
 *        $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.16 2009/01/22 20:16:02 tgl Exp $
 
12
 *        $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.17 2009/06/11 14:48:56 momjian Exp $
13
13
 *
14
14
 *-------------------------------------------------------------------------
15
15
 */
275
275
RemoveTSParsers(DropStmt *drop)
276
276
{
277
277
        ObjectAddresses *objects;
278
 
        ListCell                *cell;
 
278
        ListCell   *cell;
279
279
 
280
280
        if (!superuser())
281
281
                ereport(ERROR,
284
284
 
285
285
        /*
286
286
         * First we identify all the objects, then we delete them in a single
287
 
         * performMultipleDeletions() call.  This is to avoid unwanted
288
 
         * DROP RESTRICT errors if one of the objects depends on another.
 
287
         * performMultipleDeletions() call.  This is to avoid unwanted DROP
 
288
         * RESTRICT errors if one of the objects depends on another.
289
289
         */
290
290
        objects = new_object_addresses();
291
291
 
292
292
        foreach(cell, drop->objects)
293
293
        {
294
 
                List            *names = (List *) lfirst(cell);
 
294
                List       *names = (List *) lfirst(cell);
295
295
                Oid                     prsOid;
296
296
                ObjectAddress object;
297
297
 
309
309
                        else
310
310
                        {
311
311
                                ereport(NOTICE,
312
 
                                        (errmsg("text search parser \"%s\" does not exist, skipping",
313
 
                                                        NameListToString(names))));
 
312
                                (errmsg("text search parser \"%s\" does not exist, skipping",
 
313
                                                NameListToString(names))));
314
314
                        }
315
315
                        continue;
316
316
                }
636
636
RemoveTSDictionaries(DropStmt *drop)
637
637
{
638
638
        ObjectAddresses *objects;
639
 
        ListCell                *cell;
 
639
        ListCell   *cell;
640
640
 
641
641
        /*
642
642
         * First we identify all the objects, then we delete them in a single
643
 
         * performMultipleDeletions() call.  This is to avoid unwanted
644
 
         * DROP RESTRICT errors if one of the objects depends on another.
 
643
         * performMultipleDeletions() call.  This is to avoid unwanted DROP
 
644
         * RESTRICT errors if one of the objects depends on another.
645
645
         */
646
646
        objects = new_object_addresses();
647
647
 
648
648
        foreach(cell, drop->objects)
649
649
        {
650
 
                List            *names = (List *) lfirst(cell);
 
650
                List       *names = (List *) lfirst(cell);
651
651
                Oid                     dictOid;
652
652
                ObjectAddress object;
653
653
                HeapTuple       tup;
661
661
                        {
662
662
                                ereport(ERROR,
663
663
                                                (errcode(ERRCODE_UNDEFINED_OBJECT),
664
 
                                                 errmsg("text search dictionary \"%s\" does not exist",
665
 
                                                                NameListToString(names))));
 
664
                                           errmsg("text search dictionary \"%s\" does not exist",
 
665
                                                          NameListToString(names))));
666
666
                        }
667
667
                        else
668
668
                        {
669
669
                                ereport(NOTICE,
670
 
                                (errmsg("text search dictionary \"%s\" does not exist, skipping",
671
 
                                                NameListToString(names))));
 
670
                                                (errmsg("text search dictionary \"%s\" does not exist, skipping",
 
671
                                                                NameListToString(names))));
672
672
                        }
673
673
                        continue;
674
674
                }
676
676
                tup = SearchSysCache(TSDICTOID,
677
677
                                                         ObjectIdGetDatum(dictOid),
678
678
                                                         0, 0, 0);
679
 
                if (!HeapTupleIsValid(tup)) /* should not happen */
 
679
                if (!HeapTupleIsValid(tup))             /* should not happen */
680
680
                        elog(ERROR, "cache lookup failed for text search dictionary %u",
681
681
                                 dictOid);
682
682
 
824
824
        repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = true;
825
825
 
826
826
        newtup = heap_modify_tuple(tup, RelationGetDescr(rel),
827
 
                                                          repl_val, repl_null, repl_repl);
 
827
                                                           repl_val, repl_null, repl_repl);
828
828
 
829
829
        simple_heap_update(rel, &newtup->t_self, newtup);
830
830
 
1127
1127
RemoveTSTemplates(DropStmt *drop)
1128
1128
{
1129
1129
        ObjectAddresses *objects;
1130
 
        ListCell                *cell;
 
1130
        ListCell   *cell;
1131
1131
 
1132
1132
        if (!superuser())
1133
1133
                ereport(ERROR,
1136
1136
 
1137
1137
        /*
1138
1138
         * First we identify all the objects, then we delete them in a single
1139
 
         * performMultipleDeletions() call.  This is to avoid unwanted
1140
 
         * DROP RESTRICT errors if one of the objects depends on another.
 
1139
         * performMultipleDeletions() call.  This is to avoid unwanted DROP
 
1140
         * RESTRICT errors if one of the objects depends on another.
1141
1141
         */
1142
1142
        objects = new_object_addresses();
1143
1143
 
1144
1144
        foreach(cell, drop->objects)
1145
1145
        {
1146
 
                List            *names = (List *) lfirst(cell);
 
1146
                List       *names = (List *) lfirst(cell);
1147
1147
                Oid                     tmplOid;
1148
1148
                ObjectAddress object;
1149
1149
 
1534
1534
RemoveTSConfigurations(DropStmt *drop)
1535
1535
{
1536
1536
        ObjectAddresses *objects;
1537
 
        ListCell                *cell;
 
1537
        ListCell   *cell;
1538
1538
 
1539
1539
        /*
1540
1540
         * First we identify all the objects, then we delete them in a single
1541
 
         * performMultipleDeletions() call.  This is to avoid unwanted
1542
 
         * DROP RESTRICT errors if one of the objects depends on another.
 
1541
         * performMultipleDeletions() call.  This is to avoid unwanted DROP
 
1542
         * RESTRICT errors if one of the objects depends on another.
1543
1543
         */
1544
1544
        objects = new_object_addresses();
1545
1545
 
1546
1546
        foreach(cell, drop->objects)
1547
1547
        {
1548
 
                List            *names = (List *) lfirst(cell);
 
1548
                List       *names = (List *) lfirst(cell);
1549
1549
                Oid                     cfgOid;
1550
1550
                Oid                     namespaceId;
1551
1551
                ObjectAddress object;
1559
1559
                        {
1560
1560
                                ereport(ERROR,
1561
1561
                                                (errcode(ERRCODE_UNDEFINED_OBJECT),
1562
 
                                                 errmsg("text search configuration \"%s\" does not exist",
1563
 
                                                                NameListToString(names))));
 
1562
                                        errmsg("text search configuration \"%s\" does not exist",
 
1563
                                                   NameListToString(names))));
1564
1564
                        }
1565
1565
                        else
1566
1566
                        {
1923
1923
                                repl_repl[Anum_pg_ts_config_map_mapdict - 1] = true;
1924
1924
 
1925
1925
                                newtup = heap_modify_tuple(maptup,
1926
 
                                                                                  RelationGetDescr(relMap),
1927
 
                                                                                  repl_val, repl_null, repl_repl);
 
1926
                                                                                   RelationGetDescr(relMap),
 
1927
                                                                                   repl_val, repl_null, repl_repl);
1928
1928
                                simple_heap_update(relMap, &newtup->t_self, newtup);
1929
1929
 
1930
1930
                                CatalogUpdateIndexes(relMap, newtup);