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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *
9
9
 *
10
10
 * IDENTIFICATION
11
 
 *        $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.38 2009/02/27 16:35:26 heikki Exp $
 
11
 *        $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.39 2009/06/11 14:48:55 momjian Exp $
12
12
 *
13
13
 *-------------------------------------------------------------------------
14
14
 */
87
87
        if (get_func_rettype(funcoid) != VOIDOID)
88
88
                ereport(ERROR,
89
89
                                (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
90
 
                                 errmsg("encoding conversion function %s must return type \"void\"",
91
 
                                                NameListToString(func_name))));
 
90
                  errmsg("encoding conversion function %s must return type \"void\"",
 
91
                                 NameListToString(func_name))));
92
92
 
93
93
        /* Check we have EXECUTE rights for the function */
94
94
        aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
97
97
                                           NameListToString(func_name));
98
98
 
99
99
        /*
100
 
         * Check that the conversion function is suitable for the requested
101
 
         * source and target encodings. We do that by calling the function with
102
 
         * an empty string; the conversion function should throw an error if it
103
 
         * can't perform the requested conversion.
 
100
         * Check that the conversion function is suitable for the requested source
 
101
         * and target encodings. We do that by calling the function with an empty
 
102
         * string; the conversion function should throw an error if it can't
 
103
         * perform the requested conversion.
104
104
         */
105
105
        OidFunctionCall5(funcoid,
106
106
                                         Int32GetDatum(from_encoding),
124
124
DropConversionsCommand(DropStmt *drop)
125
125
{
126
126
        ObjectAddresses *objects;
127
 
        ListCell *cell;
 
127
        ListCell   *cell;
128
128
 
129
129
        /*
130
130
         * First we identify all the conversions, then we delete them in a single
131
 
         * performMultipleDeletions() call.  This is to avoid unwanted
132
 
         * DROP RESTRICT errors if one of the conversions depends on another.
133
 
         * (Not that that is very likely, but we may as well do this consistently.)
 
131
         * performMultipleDeletions() call.  This is to avoid unwanted DROP
 
132
         * RESTRICT errors if one of the conversions depends on another. (Not that
 
133
         * that is very likely, but we may as well do this consistently.)
134
134
         */
135
135
        objects = new_object_addresses();
136
136
 
137
137
        foreach(cell, drop->objects)
138
138
        {
139
 
                List            *name = (List *) lfirst(cell);
 
139
                List       *name = (List *) lfirst(cell);
140
140
                Oid                     conversionOid;
141
141
                HeapTuple       tuple;
142
142
                Form_pg_conversion con;